org.quartz.impl.jdbcjobstore
Class SimpleSemaphore
java.lang.Object
|
+--org.quartz.impl.jdbcjobstore.SimpleSemaphore
- All Implemented Interfaces:
- Semaphore
- public class SimpleSemaphore
- extends java.lang.Object
- implements Semaphore
An interface for providing thread/resource locking in order to protect
resources from being altered by multiple threads at the same time.
- Author:
- jhouse
|
Method Summary |
void |
init(java.sql.Connection conn,
java.util.List listOfLocks)
|
boolean |
isLockOwner(java.sql.Connection conn,
java.lang.String lockName)
Determine whether the calling thread owns a lock on the identified
resource. |
boolean |
obtainLock(java.sql.Connection conn,
java.lang.String lockName)
Grants a lock on the identified resource to the calling thread (blocking
until it is available). |
void |
releaseLock(java.sql.Connection conn,
java.lang.String lockName)
Release the lock on the identified resource if it is held by the calling
thread. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleSemaphore
public SimpleSemaphore()
obtainLock
public boolean obtainLock(java.sql.Connection conn,
java.lang.String lockName)
- Grants a lock on the identified resource to the calling thread (blocking
until it is available).
- Specified by:
obtainLock in interface Semaphore
- Returns:
- true if the lock was obtained.
releaseLock
public void releaseLock(java.sql.Connection conn,
java.lang.String lockName)
- Release the lock on the identified resource if it is held by the calling
thread.
- Specified by:
releaseLock in interface Semaphore
isLockOwner
public boolean isLockOwner(java.sql.Connection conn,
java.lang.String lockName)
- Determine whether the calling thread owns a lock on the identified
resource.
- Specified by:
isLockOwner in interface Semaphore
init
public void init(java.sql.Connection conn,
java.util.List listOfLocks)