|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.quartz.impl.jdbcjobstore.DBSemaphore
public abstract class DBSemaphore
Base class for database based lock handlers for providing thread/resource locking in order to protect resources from being altered by multiple threads at the same time.
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
DBSemaphore(String tablePrefix,
String schedName,
String defaultSQL,
String defaultInsertSQL)
|
|
| Method Summary | |
|---|---|
protected abstract void |
executeSQL(Connection conn,
String lockName,
String theExpandedSQL,
String theExpandedInsertSQL)
Execute the SQL that will lock the proper database row. |
protected org.slf4j.Logger |
getLog()
|
String |
getSchedName()
|
protected String |
getSchedulerNameLiteral()
|
protected String |
getSQL()
|
protected String |
getTablePrefix()
|
boolean |
isLockOwner(String lockName)
Determine whether the calling thread owns a lock on the identified resource. |
boolean |
obtainLock(Connection conn,
String lockName)
Grants a lock on the identified resource to the calling thread (blocking until it is available). |
void |
releaseLock(String lockName)
Release the lock on the identified resource if it is held by the calling thread. |
boolean |
requiresConnection()
This Semaphore implementation does use the database. |
protected void |
setInsertSQL(String insertSql)
|
void |
setSchedName(String schedName)
|
protected void |
setSQL(String sql)
|
void |
setTablePrefix(String tablePrefix)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DBSemaphore(String tablePrefix,
String schedName,
String defaultSQL,
String defaultInsertSQL)
| Method Detail |
|---|
protected org.slf4j.Logger getLog()
protected abstract void executeSQL(Connection conn,
String lockName,
String theExpandedSQL,
String theExpandedInsertSQL)
throws LockException
LockException
public boolean obtainLock(Connection conn,
String lockName)
throws LockException
obtainLock in interface Semaphoreconn - Database connection used to establish lock. Can be null if
Semaphore.requiresConnection() returns false.
LockExceptionpublic void releaseLock(String lockName)
releaseLock in interface Semaphorepublic boolean isLockOwner(String lockName)
public boolean requiresConnection()
requiresConnection in interface SemaphoreSemaphore.obtainLock(Connection, String),
Semaphore.releaseLock(String)protected String getSQL()
protected void setSQL(String sql)
protected void setInsertSQL(String insertSql)
protected String getSchedulerNameLiteral()
public String getSchedName()
public void setSchedName(String schedName)
setSchedName in interface TablePrefixAwareprotected String getTablePrefix()
public void setTablePrefix(String tablePrefix)
setTablePrefix in interface TablePrefixAware
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||