org.quartz.impl.jdbcjobstore
Interface Semaphore

All Known Implementing Classes:
DBSemaphore, JTANonClusteredSemaphore, SimpleSemaphore, StdRowLockSemaphore, UpdateLockRowSemaphore

public interface 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

Method Summary
 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()
          Whether this Semaphore implementation requires a database connection for its lock management operations.
 

Method Detail

obtainLock

boolean obtainLock(Connection conn,
                   String lockName)
                   throws LockException
Grants 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 if requiresConnection() returns false.
Returns:
true if the lock was obtained.
Throws:
LockException

releaseLock

void releaseLock(String lockName)
                 throws LockException
Release 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.

See Also:
obtainLock(Connection, String), releaseLock(String)


Copyright 2001-2019, Terracotta, Inc.