org.quartz.impl.jdbcjobstore
Class SimpleSemaphore

java.lang.Object
  extended byorg.quartz.impl.jdbcjobstore.SimpleSemaphore
All Implemented Interfaces:
Semaphore

public class SimpleSemaphore
extends 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

Constructor Summary
SimpleSemaphore()
           
 
Method Summary
 void init(Connection conn, List listOfLocks)
           
 boolean isLockOwner(Connection conn, 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(Connection conn, 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
 

Constructor Detail

SimpleSemaphore

public SimpleSemaphore()
Method Detail

obtainLock

public boolean obtainLock(Connection conn,
                          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(Connection conn,
                        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(Connection conn,
                           String lockName)
Determine whether the calling thread owns a lock on the identified resource.

Specified by:
isLockOwner in interface Semaphore

init

public void init(Connection conn,
                 List listOfLocks)

Quartz Enterprise Job Scheduler Project Page