Package org.quartz.impl.jdbcjobstore
Class SimpleSemaphore
- java.lang.Object
-
- org.quartz.impl.jdbcjobstore.SimpleSemaphore
-
-
Constructor Summary
Constructors Constructor Description SimpleSemaphore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.slf4j.LoggergetLog()booleanisLockOwner(java.lang.String lockName)Determine whether the calling thread owns a lock on the identified resource.booleanobtainLock(java.sql.Connection conn, java.lang.String lockName)Grants a lock on the identified resource to the calling thread (blocking until it is available).voidreleaseLock(java.lang.String lockName)Release the lock on the identified resource if it is held by the calling thread.booleanrequiresConnection()This Semaphore implementation does not use the database.
-
-
-
Method Detail
-
getLog
protected org.slf4j.Logger getLog()
-
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:
obtainLockin interfaceSemaphore- Parameters:
conn- Database connection used to establish lock. Can be null ifreturns false.Semaphore.requiresConnection()- Returns:
- true if the lock was obtained.
-
releaseLock
public void releaseLock(java.lang.String lockName)
Release the lock on the identified resource if it is held by the calling thread.- Specified by:
releaseLockin interfaceSemaphore
-
isLockOwner
public boolean isLockOwner(java.lang.String lockName)
Determine whether the calling thread owns a lock on the identified resource.
-
requiresConnection
public boolean requiresConnection()
This Semaphore implementation does not use the database.- Specified by:
requiresConnectionin interfaceSemaphore- See Also:
Semaphore.obtainLock(Connection, String),Semaphore.releaseLock(String)
-
-