|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.latch.Java5LatchImpl
class Java5LatchImpl
Java5LatchImpl provides an implementation of the Latch interface. By using a wrapper class we can avoid link errors when we run in Java 1.4 JVMs. LatchSupport.java will only reference this class if it knows that the ReentrantLock class is available at runtime through Class.forName(). LatchSupport only references this class through the Latch interface and only constructs an instance using Class.forName("Java5LatchImpl").newInstance();
Constructor Summary | |
---|---|
Java5LatchImpl()
|
Method Summary | |
---|---|
void |
acquire()
Acquire a latch for exclusive/write access. |
boolean |
acquireNoWait()
Acquire a latch for exclusive/write access, but do not block if it's not available. |
LatchStats |
getLatchStats()
|
boolean |
isOwner()
Return true if the current thread holds this latch. |
int |
nWaiters()
Return the number of threads waiting. |
Thread |
owner()
Used only for unit tests. |
void |
release()
Release the latch. |
void |
releaseIfOwner()
Release the latch. |
void |
setName(String name)
Set the latch name, used for latches in objects instantiated from the log. |
String |
toString()
Formats a latch owner and waiters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
Java5LatchImpl()
Method Detail |
---|
public void setName(String name)
setName
in interface Latch
public void acquire() throws DatabaseException
Wait for the latch if some other thread is holding it. If there are threads waiting for access, they will be granted the latch on a FIFO basis. When the method returns, the latch is held for exclusive access.
acquire
in interface Latch
LatchException
- if the latch is already held by the calling
thread.
RunRecoveryException
- if an InterruptedException exception
occurs.
DatabaseException
public boolean acquireNoWait() throws LatchException
acquireNoWait
in interface Latch
LatchException
- if the latch is already held by the calling
thread.public void releaseIfOwner()
releaseIfOwner
in interface Latch
public void release() throws LatchNotHeldException
release
in interface Latch
LatchNotHeldException
- if the latch is not currently held.public boolean isOwner()
isOwner
in interface Latch
public Thread owner()
owner
in interface Latch
public int nWaiters()
nWaiters
in interface Latch
public LatchStats getLatchStats()
getLatchStats
in interface Latch
public String toString()
toString
in interface Latch
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |