public class Latch
extends java.lang.Object
Constructor and Description |
---|
Latch(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
clear() |
StatGroup |
getLatchStats() |
java.lang.String |
getName()
Used by com.sleepycat.je.utilint.TimingLatch.
|
boolean |
isOwner()
Return true if the current thread holds this latch.
|
int |
nWaiters()
Return the number of threads waiting.
|
java.lang.Thread |
owner()
Used only for unit tests.
|
void |
release()
Release the latch.
|
void |
releaseIfOwner()
Release the latch.
|
void |
setName(java.lang.String name)
Set the latch name, used for latches in objects instantiated from
the log.
|
java.lang.String |
toString()
Formats a latch owner and waiters.
|
public void setName(java.lang.String name)
public java.lang.String getName()
public void acquire()
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.
EnvironmentFailureException
- if the latch is already held by the
calling thread.public boolean acquireNoWait()
EnvironmentFailureException
- if the latch is already held by the
calling thread.public void releaseIfOwner()
public void release()
EnvironmentFailureException
- if the latch is not currently held.public boolean isOwner()
public java.lang.Thread owner()
public int nWaiters()
public StatGroup getLatchStats()
public void clear()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2004-2012 Oracle. All rights reserved.