org.apache.geronimo.lock
Class WriterPreferredInstanceLock3

java.lang.Object
  extended byorg.apache.geronimo.lock.WriterPreferredInstanceLock3
All Implemented Interfaces:
InstanceLock

public class WriterPreferredInstanceLock3
extends Object
implements InstanceLock

Implementation of InstanceLock using a simple prefer-writer allocation policy.

If the workload makes many exclusive requests, this policy may result in starvation of shared requests.

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

Constructor Summary
WriterPreferredInstanceLock3()
           
 
Method Summary
 void exclusiveLock(Object context)
          Provide context with exclusive access to this resource.
 int getSharedCount()
           
 int getSharedWaiting()
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriterPreferredInstanceLock3

public WriterPreferredInstanceLock3()
Method Detail

sharedLock

public void sharedLock(Object context)
                throws InterruptedException
Description copied from interface: InstanceLock
Provide context with shared access to this resource.

Specified by:
sharedLock in interface InstanceLock
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
Description copied from interface: InstanceLock
Provide context with exclusive access to this resource.

Specified by:
exclusiveLock in interface InstanceLock
Parameters:
context - the context requesting access
Throws:
InterruptedException - if the thread is interrupted before receiving the lock

release

public void release(Object context)
Description copied from interface: InstanceLock
Notification from context that it no longer requires access to this resource

Specified by:
release in interface InstanceLock
Parameters:
context - the context relinguishing access

getSharedCount

public int getSharedCount()

getSharedWaiting

public int getSharedWaiting()


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