Java Doc for LockManager2.java in  » Database-JDBC-Connection-Pool » Apache-commons-transaction-1.2 » org » apache » commons » transaction » 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 JDBC Connection Pool » Apache commons transaction 1.2 » org.apache.commons.transaction.locking 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.commons.transaction.locking.LockManager2

All known Subclasses:   org.apache.commons.transaction.locking.GenericLockManager,
LockManager2
public interface LockManager2 (Code)
Extended version of a lock manager that also has global knowledge or all locks and should be used as a delegate for all locking requests. This allows for things like deadlock detection.
version:
   $Id: LockManager2.java 493628 2007-01-07 01:42:48Z joerg $
See Also:   MultiLevelLock
See Also:   MultiLevelLock2
See Also:   LockManager
See Also:   GenericLockManager
See Also:   GenericLock
since:
   1.1




Method Summary
public  booleancheckLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant)
     Determines if a lock could be acquire without actually acquiring it.
public  SetgetAll(Object ownerId)
     Gets all locks (partially) held by an owner.
public  intgetLevel(Object ownerId, Object resourceId)
     Gets the lock level held by certain owner on a certain resource.
public  MultiLevelLockgetLock(Object resourceId)
     Gets an existing lock on the specified resource.
public  booleanhasLock(Object ownerId, Object resourceId, int lockLevel)
     Determines if a lock is owner by an owner.
public  voidlock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant)
     Tries to acquire a lock on a resource.
public  voidlock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant, long timeoutMSecs)
     Tries to acquire a lock on a resource.
public  voidlock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs)
     Most flexible way to acquire a lock on a resource.
public  booleanrelease(Object ownerId, Object resourceId)
     Releases all locks for a certain resource held by a certain owner.
public  voidreleaseAll(Object ownerId)
     Releases all locks (partially) held by an owner.
public  voidremoveLock(MultiLevelLock lock)
     Removes the specified lock from the associated resource.
public  voidstartGlobalTimeout(Object ownerId, long timeoutMSecs)
     Starts a global timeout for an owner.
public  booleantryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant)
     Tries to acquire a lock on a resource.



Method Detail
checkLock
public boolean checkLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant)(Code)
Determines if a lock could be acquire without actually acquiring it.

This method does not block, but immediatly returns.
Parameters:
  ownerId - a unique id identifying the entity that wants to check thislock
Parameters:
  resourceId - the resource to get the level for
Parameters:
  targetLockLevel - the lock level to check
Parameters:
  reentrant - true if this request shall not be influenced byother locks held by the same owner true if the lock could be acquired, false otherwise



getAll
public Set getAll(Object ownerId)(Code)
Gets all locks (partially) held by an owner.
Parameters:
  ownerId - the id of the owner all locks held by ownerId



getLevel
public int getLevel(Object ownerId, Object resourceId)(Code)
Gets the lock level held by certain owner on a certain resource.
Parameters:
  ownerId - the id of the owner of the lock
Parameters:
  resourceId - the resource to get the level for



getLock
public MultiLevelLock getLock(Object resourceId)(Code)
Gets an existing lock on the specified resource. If none exists it returns null.
Parameters:
  resourceId - the resource to get the lock for the lock on the specified resource



hasLock
public boolean hasLock(Object ownerId, Object resourceId, int lockLevel)(Code)
Determines if a lock is owner by an owner.

Parameters:
  ownerId - a unique id identifying the entity that wants to check thislock
Parameters:
  resourceId - the resource to get the level for
Parameters:
  lockLevel - the lock level to check true if the owner has the lock, false otherwise



lock
public void lock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant) throws LockException(Code)
Tries 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:
  reentrant - true if this request shall not be blocked byother locks held by the same owner
throws:
  LockException - will be thrown when the lock can not be acquired



lock
public void lock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant, long timeoutMSecs) throws LockException(Code)
Tries 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:
  reentrant - true if this request shall not be blocked byother locks held by the same owner
Parameters:
  timeoutMSecs - specifies the maximum wait time in milliseconds
throws:
  LockException - will be thrown when the lock can not be acquired



lock
public void lock(Object ownerId, Object resourceId, int targetLockLevel, int compatibility, boolean preferred, long timeoutMSecs) 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
throws:
  LockException - will be thrown when the lock can not be acquired



release
public boolean release(Object ownerId, Object resourceId)(Code)
Releases all locks for a certain resource held by a certain owner.
Parameters:
  ownerId - the id of the owner of the lock
Parameters:
  resourceId - the resource to releases the lock for true if the lock actually was released, false in casethere was no lock held by the owner



releaseAll
public void releaseAll(Object ownerId)(Code)
Releases all locks (partially) held by an owner.
Parameters:
  ownerId - the id of the owner



removeLock
public void removeLock(MultiLevelLock lock)(Code)
Removes the specified lock from the associated resource. Caution: This does not release the lock, but only moves it out of the scope of this manager. Use LockManager2.release(Object,Object) for that.
Parameters:
  lock - the lock to be removed



startGlobalTimeout
public void startGlobalTimeout(Object ownerId, long timeoutMSecs)(Code)
Starts a global timeout for an owner. This is especially usefull, when the owner is a transaction. After a global timeout occurs all of the owner's lock will be released and the owner will not be allowed to access any locks before before calling LockManager2.releaseAll(Object) .
Parameters:
  ownerId - a unique id identifying the entity that wants to acquire thislock
Parameters:
  timeoutMSecs - specifies the global timeout in milliseconds



tryLock
public boolean tryLock(Object ownerId, Object resourceId, int targetLockLevel, boolean reentrant)(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 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.