Package org.quartz.impl.jdbcjobstore
Interface Semaphore
-
- All Known Implementing Classes:
DBSemaphore,JTANonClusteredSemaphore,SimpleSemaphore,StdRowLockSemaphore,UpdateLockRowSemaphore
public interface SemaphoreAn 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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()Whether this Semaphore implementation requires a database connection for its lock management operations.
-
-
-
Method Detail
-
obtainLock
boolean obtainLock(java.sql.Connection conn, java.lang.String lockName) throws LockExceptionGrants a lock on the identified resource to the calling thread (blocking until it is available).- Parameters:
conn- Database connection used to establish lock. Can be null ifreturns false.requiresConnection()- Returns:
- true if the lock was obtained.
- Throws:
LockException
-
releaseLock
void releaseLock(java.lang.String lockName) throws LockExceptionRelease the lock on the identified resource if it is held by the calling thread.- Throws:
LockException
-
requiresConnection
boolean requiresConnection()
Whether this Semaphore implementation requires a database connection for its lock management operations.
-
-