org.mule.util.lock
Class InstanceLockGroup

java.lang.Object
  extended by org.mule.util.lock.InstanceLockGroup
All Implemented Interfaces:
Disposable, LockGroup

public class InstanceLockGroup
extends Object
implements LockGroup

LockGroup implementation for holding references to created locks inside a mule instance.


Nested Class Summary
static class InstanceLockGroup.LockEntry
           
 
Field Summary
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
InstanceLockGroup(LockProvider lockProvider)
           
 
Method Summary
 void dispose()
          A lifecycle method where implementor should free up any resources.
 void lock(String lockId)
           
 void lockInterruptibly(String lockId)
           
 boolean tryLock(String lockId)
           
 boolean tryLock(String lockId, long timeout, TimeUnit timeUnit)
          Tries to acquire the lock for a certain amount of time
 void unlock(String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceLockGroup

public InstanceLockGroup(LockProvider lockProvider)
Method Detail

lock

public void lock(String lockId)
Specified by:
lock in interface LockGroup

unlock

public void unlock(String key)
Specified by:
unlock in interface LockGroup

tryLock

public boolean tryLock(String lockId,
                       long timeout,
                       TimeUnit timeUnit)
                throws InterruptedException
Description copied from interface: LockGroup
Tries to acquire the lock for a certain amount of time

Specified by:
tryLock in interface LockGroup
timeout - the time in timeUnit to wait until the lock is acquired
timeUnit - the time unit of timeout
Returns:
true if the lock was successfully acquired, false otherwise
Throws:
InterruptedException - if thread was interrupted during the lock acquisition

tryLock

public boolean tryLock(String lockId)
Specified by:
tryLock in interface LockGroup

lockInterruptibly

public void lockInterruptibly(String lockId)
                       throws InterruptedException
Specified by:
lockInterruptibly in interface LockGroup
Throws:
InterruptedException

dispose

public void dispose()
Description copied from interface: Disposable
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.