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.Logger
getLog()
boolean
isLockOwner(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.lang.String lockName)
Release the lock on the identified resource if it is held by the calling thread.boolean
requiresConnection()
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:
obtainLock
in interfaceSemaphore
- Parameters:
conn
- Database connection used to establish lock. Can be null if
returns 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:
releaseLock
in 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:
requiresConnection
in interfaceSemaphore
- See Also:
Semaphore.obtainLock(Connection, String)
,Semaphore.releaseLock(String)
-
-