org.apache.hadoop.hbase
Interface InterProcessLock

All Known Implementing Classes:
ZKInterProcessLockBase, ZKInterProcessReadLock, ZKInterProcessWriteLock

@InterfaceAudience.Private
public interface InterProcessLock

An interface for an application-specific lock.


Nested Class Summary
static interface InterProcessLock.MetadataHandler
          An interface for objects that process lock metadata.
 
Method Summary
 void acquire()
          Acquire the lock, waiting indefinitely until the lock is released or the thread is interrupted.
 void reapAllLocks()
          If supported, attempts to reap all the locks of this type by forcefully deleting the locks.
 void release()
          Release the lock.
 boolean tryAcquire(long timeoutMs)
          Acquire the lock within a wait time.
 

Method Detail

acquire

void acquire()
             throws IOException,
                    InterruptedException
Acquire the lock, waiting indefinitely until the lock is released or the thread is interrupted.

Throws:
IOException - If there is an unrecoverable error releasing the lock
InterruptedException - If current thread is interrupted while waiting for the lock

tryAcquire

boolean tryAcquire(long timeoutMs)
                   throws IOException,
                          InterruptedException
Acquire the lock within a wait time.

Parameters:
timeoutMs - The maximum time (in milliseconds) to wait for the lock, -1 to wait indefinitely
Returns:
True if the lock was acquired, false if waiting time elapsed before the lock was acquired
Throws:
IOException - If there is an unrecoverable error talking talking (e.g., when talking to a lock service) when acquiring the lock
InterruptedException - If the thread is interrupted while waiting to acquire the lock

release

void release()
             throws IOException,
                    InterruptedException
Release the lock.

Throws:
IOException - If there is an unrecoverable error releasing the lock
InterruptedException - If the thread is interrupted while releasing the lock

reapAllLocks

void reapAllLocks()
                  throws IOException
If supported, attempts to reap all the locks of this type by forcefully deleting the locks. Lock reaping is different than coordinated lock revocation in that, there is no coordination, and the behavior is undefined if the lock holder is still alive.

Throws:
IOException - If there is an unrecoverable error reaping the locks


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.