Java Doc for CommonsOJBLockManager.java in  » Database-ORM » db-ojb » org » apache » ojb » broker » locking » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » db ojb » org.apache.ojb.broker.locking 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.ojb.broker.locking.CommonsOJBLockManager

CommonsOJBLockManager
class CommonsOJBLockManager extends GenericLockManager (Code)
Extension of org.apache.commons.transaction.locking.GenericLockManager to support all locking isolation level defined in OJB locking api and a provider of specific org.apache.commons.transaction.locking.GenericLock implementation classes representing the isolation levels specified in org.apache.ojb.broker.locking.LockManager , like org.apache.ojb.broker.locking.LockManager.IL_READ_COMMITTED , ... .

The specific lock classes will be returned on call of CommonsOJBLockManager.createIsolationLevel(Object,Object,org.apache.commons.transaction.util.LoggerFacade) dependend on the specified isolation level.
author:
   Armin Waibel
version:
   $Id: CommonsOJBLockManager.java,v 1.1.2.4 2005/12/21 22:25:32 tomdz Exp $


Inner Class :abstract static class OJBLock extends GenericLock
Inner Class :static class ReadUncommittedLock extends RepeadableReadsLock
Inner Class :final static class ReadCommitedLock extends RepeadableReadsLock
Inner Class :static class RepeadableReadsLock extends OJBLock
Inner Class :final static class SerializeableLock extends ReadUncommittedLock

Field Summary
final static  intCOMMON_READ_LOCK
    
final static  intCOMMON_UPGRADE_LOCK
    
final static  intCOMMON_WRITE_LOCK
    

Constructor Summary
public  CommonsOJBLockManager(LoggerFacade logger, long timeoutMSecs, long checkThreshholdMSecs)
    

Method Summary
public  MultiLevelLockatomicGetOrCreateLock(Object resourceId)
    
public  OJBLockatomicGetOrCreateLock(Object resourceId, Object isolationId)
     Either gets an existing lock on the specified resource or creates one if none exists. This methods guarantees to do this atomically.
Parameters:
  resourceId - the resource to get or create the lock on
Parameters:
  isolationId - the isolation level identity key.
public  OJBLockcreateIsolationLevel(Object resourceId, Object isolationId, LoggerFacade logger)
     Creates org.apache.commons.transaction.locking.GenericLock based org.apache.commons.transaction.locking.MultiLevelLock2 instances dependend on the specified isolation identity object.
protected  GenericLockcreateLock(Object resourceId)
    
protected  GenericLockcreateLock(Object resourceId, Object isolationId)
    
public  voidlock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs)
    
public  voidlock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs, Object isolationId)
     Most flexible way to acquire a lock on a resource.
 intmapLockLevelDependendOnIsolationLevel(Integer isolationId, int lockLevel)
     Helper method to map the specified common lock level (e.g like CommonsOJBLockManager.COMMON_READ_LOCK , #COMMON_UPGRADE_LOCK, ...
public  booleantryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant)
    
public  booleantryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant, Object isolationId)
     Tries to acquire a lock on a resource.

Field Detail
COMMON_READ_LOCK
final static int COMMON_READ_LOCK(Code)



COMMON_UPGRADE_LOCK
final static int COMMON_UPGRADE_LOCK(Code)



COMMON_WRITE_LOCK
final static int COMMON_WRITE_LOCK(Code)




Constructor Detail
CommonsOJBLockManager
public CommonsOJBLockManager(LoggerFacade logger, long timeoutMSecs, long checkThreshholdMSecs) throws IllegalArgumentException(Code)




Method Detail
atomicGetOrCreateLock
public MultiLevelLock atomicGetOrCreateLock(Object resourceId)(Code)

See Also:   org.apache.commons.transaction.locking.GenericLockManager.atomicGetOrCreateLock(Object)



atomicGetOrCreateLock
public OJBLock atomicGetOrCreateLock(Object resourceId, Object isolationId)(Code)
Either gets an existing lock on the specified resource or creates one if none exists. This methods guarantees to do this atomically.
Parameters:
  resourceId - the resource to get or create the lock on
Parameters:
  isolationId - the isolation level identity key. See CommonsOJBLockManager. the lock for the specified resource



createIsolationLevel
public OJBLock createIsolationLevel(Object resourceId, Object isolationId, LoggerFacade logger)(Code)
Creates org.apache.commons.transaction.locking.GenericLock based org.apache.commons.transaction.locking.MultiLevelLock2 instances dependend on the specified isolation identity object.



createLock
protected GenericLock createLock(Object resourceId)(Code)

See Also:   org.apache.commons.transaction.locking.GenericLockManager.createLock(Object)



createLock
protected GenericLock createLock(Object resourceId, Object isolationId)(Code)



lock
public void lock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs) throws LockException(Code)

See Also:   org.apache.commons.transaction.locking.GenericLockManager.lock(ObjectObjectintintbooleanlong)



lock
public void lock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs, Object isolationId) throws LockException(Code)
Most flexible way to acquire a lock on a resource.

This method blocks and waits for the lock in case it is not avaiable. If there is a timeout or a deadlock or the thread is interrupted a LockException is thrown.
Parameters:
  ownerId - a unique id identifying the entity that wants to acquire thislock
Parameters:
  resourceId - the resource to get the level for
Parameters:
  targetLockLevel - the lock level to acquire
Parameters:
  compatibility - GenericLock.COMPATIBILITY_NONEif no additional compatibility isdesired (same as reentrant set to false) ,GenericLock.COMPATIBILITY_REENTRANTif lock level by the sameowner shall not affect compatibility (same as reentrant set totrue), or GenericLock.COMPATIBILITY_SUPPORTif lock levels thatare the same as the desired shall not affect compatibility, orfinally GenericLock.COMPATIBILITY_REENTRANT_AND_SUPPORTwhich isa combination of reentrant and support
Parameters:
  preferred - in case this lock request is incompatible with existing onesand we wait, it shall be granted before other waiting requeststhat are not preferred
Parameters:
  timeoutMSecs - specifies the maximum wait time in milliseconds
Parameters:
  isolationId - the isolation level identity key. See CommonsOJBLockManager.
throws:
  LockException - will be thrown when the lock can not be acquired



mapLockLevelDependendOnIsolationLevel
int mapLockLevelDependendOnIsolationLevel(Integer isolationId, int lockLevel)(Code)
Helper method to map the specified common lock level (e.g like CommonsOJBLockManager.COMMON_READ_LOCK , #COMMON_UPGRADE_LOCK, ... ) based on the isolation level to the internal used lock level value by the org.apache.commons.transaction.locking.MultiLevelLock2 implementation.
Parameters:
  isolationId -
Parameters:
  lockLevel -



tryLock
public boolean tryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant)(Code)

See Also:   org.apache.commons.transaction.locking.GenericLockManager.tryLock(ObjectObjectintboolean)



tryLock
public boolean tryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant, Object isolationId)(Code)
Tries to acquire a lock on a resource.

This method does not block, but immediatly returns. If a lock is not available false will be returned.
Parameters:
  ownerId - a unique id identifying the entity that wants to acquire thislock
Parameters:
  resourceId - the resource to get the level for
Parameters:
  targetLockLevel - the lock level to acquire
Parameters:
  reentrant - true if this request shall not be influenced byother locks held by the same owner
Parameters:
  isolationId - the isolation level identity key. See CommonsOJBLockManager. true if the lock has been acquired, false otherwise



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.