public class SyncBlock
extends java.lang.Object
Constructor and Description |
---|
SyncBlock(java.lang.String name)
A synchronized block
|
SyncBlock(java.lang.String name,
int seconds)
A synchronized block
|
Modifier and Type | Method and Description |
---|---|
static long |
errorCount()
The error count
|
void |
release()
release the lock
|
void |
take()
take the lock and throw an error if you can't get it.
|
java.lang.String |
toString()
The name of this SyncBlock
|
boolean |
tryLock()
try to get the lock
|
boolean |
tryLock(int seconds)
Try for a few seconds to get the lock
|
public SyncBlock(java.lang.String name)
name
- the name of the blockpublic SyncBlock(java.lang.String name, int seconds)
name
- the name of the blockseconds
- the secondspublic static long errorCount()
@CheckReturnValue @Nonnull public java.lang.String toString()
toString
in class java.lang.Object
public void release()
public boolean tryLock()
public boolean tryLock(int seconds) throws java.lang.InterruptedException
seconds
- the number of secondsjava.lang.InterruptedException
- interrupted.public void take()
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.