|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttron.VirtualLock
public class VirtualLock
VirtualLock replaces the Lock when running within virtual time framework. If the VirtualThread is configured to run without virtual clock, then internal ReentrantLock (and its Conditions) is created. Only threads originating from VirtualThread object can create and manipulate instances of VirtualLock.
VirtualThread
,
VirtualCondition
,
Lock
,
Condition
Field Summary | |
---|---|
protected int |
id
The id of this lock in a remote virtual clock process. |
protected VirtualThread |
owner
Current owner thread of this lock, null if not owned. |
Constructor Summary | |
---|---|
VirtualLock()
Creates a virtual lock which is located at virtual clock process. |
|
VirtualLock(String name)
Creates a virtual lock which is located at virtual clock process. |
Method Summary | |
---|---|
String |
getName()
Returns the name of this lock. |
VirtualThread |
getOwner()
Returns the owner thread of the lock if lock is acquired, returns null if lock is not owned/acquired. |
boolean |
isLocked()
Checks whether this lock is acquired/owned/locked. |
void |
lock()
Acquires the oqnership of this lock. |
void |
lockInterruptibly()
Not implemented in virtual time framework. |
Condition |
newCondition()
Creates a condition variable associated with this lock. |
Condition |
newCondition(String name)
Creates a named condition variable associated with this lock. |
void |
setOwner(VirtualThread t)
Sets the owner of this lock. |
boolean |
tryLock()
Not implemented in virtual time framework. |
boolean |
tryLock(long time,
TimeUnit unit)
Not implemented in virtual time framework. |
void |
unlock()
Releases this lock and lets any waiting thread to acquire it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final int id
protected VirtualThread owner
Constructor Detail |
---|
public VirtualLock(String name)
name
- specify your friendly name to identify it in debug logs.VirtualThread.DBG
public VirtualLock()
VirtualThread.DBG
Method Detail |
---|
public String getName()
public VirtualThread getOwner()
public void setOwner(VirtualThread t)
public boolean isLocked()
public void lock()
lock
in interface Lock
public void lockInterruptibly()
lockInterruptibly
in interface Lock
public boolean tryLock()
tryLock
in interface Lock
public boolean tryLock(long time, TimeUnit unit)
tryLock
in interface Lock
public Condition newCondition()
newCondition
in interface Lock
public Condition newCondition(String name)
VirtualThread.DBG
public void unlock()
unlock
in interface Lock
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |