org.apache.geronimo.lock
Interface InstanceLock

All Known Implementing Classes:
ConcurrentInstanceLock, WriterPreferredInstanceLock, WriterPreferredInstanceLock2, WriterPreferredInstanceLock3

public interface InstanceLock

Interface providing a pessimistic lock mechanism to an instance of a resource. Access is controlled by shared and exclusive locks; multiple contexts can hold a shared lock at the same time, but only one may hold an exclusive lock at any time. Lock allocation policy is determined by the implementation and may or may not be fair.

Version:
$Revision: 1.4 $ $Date: 2004/03/10 09:58:43 $

Method Summary
 void exclusiveLock(Object context)
          Provide context with exclusive access to this resource.
 void release(Object context)
          Notification from context that it no longer requires access to this resource
 void sharedLock(Object context)
          Provide context with shared access to this resource.
 

Method Detail

sharedLock

public void sharedLock(Object context)
                throws InterruptedException
Provide context with shared access to this resource.

Parameters:
context - the context requesting access
Throws:
InterruptedException - if the thread is interrupted before receiving the lock

exclusiveLock

public void exclusiveLock(Object context)
                   throws InterruptedException
Provide context with exclusive access to this resource.

Parameters:
context - the context requesting access
Throws:
InterruptedException - if the thread is interrupted before receiving the lock

release

public void release(Object context)
Notification from context that it no longer requires access to this resource

Parameters:
context - the context relinguishing access


Copyright © 2003-2005 Apache Software Foundation. All Rights Reserved.