public class CObject extends java.lang.Object implements SyncCV
This class is only usable by extension.
This class follows DbC(tm) methodology
(Wikipedia).
Where possible, contracts are implement with native's Java
assert.
Constructor and Description |
---|
CObject()
Constructor of an object without registering waiting threads in await service.
|
CObject(boolean registerAwaitingThreads)
Constructor of an object.
|
Modifier and Type | Method and Description |
---|---|
void |
await()
Object's wait replacement, in which:
- the checked exception InterruptedException, is replaced by the unchecked exception ThreadInterruptedException; - supports the registration of waiting threads for interrupt purposes. |
boolean |
await(long millis)
Object's wait replacement, in which:
- the checked exception InterruptedException, is replaced by the unchecked exception ThreadInterruptedException; - supports the registration of waiting threads for interrupt purposes; - timeout expiration can be tested using the method's result. |
boolean |
await(long millis,
int nanos)
Object's wait replacement, in which:
- the checked exception InterruptedException, is replaced by the unchecked exception ThreadInterruptedException; - supports the registration of waiting threads for interrupt purposes; - timeout expiration can be tested using the method's result. |
void |
broadcast()
Object's nofifyAll replacement.
|
void |
interruptWaitingThreads()
Requests the interruption all threads blocked on current lock and/or related condition variables.
|
boolean |
lockIsMine()
Is lock owned by me?
|
boolean |
registerAwaitingThreads()
Are threads registered when waiting (in await)?
|
void |
signal()
Object's nofify replacement.
|
boolean |
syncronizedLockIsMine()
Is native (synchronized) lock owned by me?
|
public CObject()
public CObject(boolean registerAwaitingThreads)
registerAwaitingThreads
- if true, threads are registered when waitingpublic boolean registerAwaitingThreads()
registerAwaitingThreads
in interface InterruptibleAwaitingThreads
public boolean lockIsMine()
lockIsMine
in interface SyncCV
public final boolean syncronizedLockIsMine()
public void await() throws ThreadInterruptedException
syncronizedLockIsMine()
- native lock owned by meawait
in interface SyncCV
ThreadInterruptedException
public boolean await(long millis) throws ThreadInterruptedException
millis >= 0
- non negative timeoutsyncronizedLockIsMine()
- native lock owned by memillis
- timeout (in milliseconds)ThreadInterruptedException
public boolean await(long millis, int nanos) throws ThreadInterruptedException
millis > 0 || nanos > 0
- positive timeoutsyncronizedLockIsMine()
- native lock owned by memillis
- timeout (in milliseconds)nanos
- timeout (in nanoseconds)ThreadInterruptedException
public void signal()
syncronizedLockIsMine()
- native lock owned by mepublic void broadcast()
syncronizedLockIsMine()
- native lock owned by mepublic void interruptWaitingThreads()
registerAwaitingThreads()
- registering of waiting threads activatedinterruptWaitingThreads
in interface InterruptibleAwaitingThreads