com.plumtree.openfoundation.util
Class XPLock

java.lang.Object
  extended bycom.plumtree.openfoundation.util.XPLock

public class XPLock
extends java.lang.Object

Example of usage: XPLock lock = new XPLock(); try { lock.Acquire(); // your processing here } finally { lock.Release(); } Relies on internal class XPMutex, stolen from Doug Lea's concurrent library.


Constructor Summary
XPLock()
           
 
Method Summary
 void Acquire()
          Attempts to acquire the lock (possibly forever).
 void Attempt(long msecs)
          Attempts to acquire the lock for approximately msecs milliseconds.
 void Release()
          Releases the Mutex aquired by XPLock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPLock

public XPLock()
Method Detail

Acquire

public void Acquire()
Attempts to acquire the lock (possibly forever). If the lock cannot be acquired, an exception is thrown. If the method returns normally, it means the lock was acquired.


Attempt

public void Attempt(long msecs)
Attempts to acquire the lock for approximately msecs milliseconds. If the lock cannot be acquired in that time period, an exception will be thrown. If the lock was acquired succesfully, this method will return true.

Parameters:
msecs - Attempt time in milli seconds.

Release

public void Release()
Releases the Mutex aquired by XPLock.



Copyright 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.