org.apache.curator.framework.recipes.locks
Interface InterProcessLock

All Known Implementing Classes:
InterProcessMultiLock, InterProcessMutex, InterProcessSemaphoreMutex

public interface InterProcessLock


Method Summary
 void acquire()
          Acquire the mutex - blocking until it's available.
 boolean acquire(long time, TimeUnit unit)
          Acquire the mutex - blocks until it's available or the given time expires.
 boolean isAcquiredInThisProcess()
          Returns true if the mutex is acquired by a thread in this JVM
 void release()
          Perform one release of the mutex.
 

Method Detail

acquire

void acquire()
             throws Exception
Acquire the mutex - blocking until it's available. Each call to acquire must be balanced by a call to release()

Throws:
Exception - ZK errors, connection interruptions

acquire

boolean acquire(long time,
                TimeUnit unit)
                throws Exception
Acquire the mutex - blocks until it's available or the given time expires. Each call to acquire that returns true must be balanced by a call to release()

Parameters:
time - time to wait
unit - time unit
Returns:
true if the mutex was acquired, false if not
Throws:
Exception - ZK errors, connection interruptions

release

void release()
             throws Exception
Perform one release of the mutex.

Throws:
Exception - ZK errors, interruptions, current thread does not own the lock

isAcquiredInThisProcess

boolean isAcquiredInThisProcess()
Returns true if the mutex is acquired by a thread in this JVM

Returns:
true/false


Copyright © 2011–2014 The Apache Software Foundation. All rights reserved.