pt.ua.concurrent
Class PersistentSignal

java.lang.Object
  extended by pt.ua.concurrent.CObject
      extended by pt.ua.concurrent.PersistentSignal
All Implemented Interfaces:
InterruptibleAwaitingThreads, Signal, SyncCV

public class PersistentSignal
extends CObject
implements Signal

A persistent signal module (signals are kept until a successful delivery).

This class follows DbC(tm) methodology (Wikipedia). Where possible, contracts are implement with native's Java assert.

Author:
Miguel Oliveira e Silva (mos@ua.pt)

Constructor Summary
PersistentSignal()
          Constructs a new PersistentSignal registering waiting threads.
PersistentSignal(boolean registerAwaitingThreads)
          Constructs a new PersistentSignal.
 
Method Summary
 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.
 void send()
          Signaling (sender).
 
Methods inherited from class pt.ua.concurrent.CObject
await, await, broadcast, interruptWaitingThreads, lockIsMine, registerAwaitingThreads, signal, syncronizedLockIsMine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pt.ua.concurrent.InterruptibleAwaitingThreads
interruptWaitingThreads, registerAwaitingThreads
 

Constructor Detail

PersistentSignal

public PersistentSignal()
Constructs a new PersistentSignal registering waiting threads.


PersistentSignal

public PersistentSignal(boolean registerAwaitingThreads)
Constructs a new PersistentSignal.

Parameters:
registerAwaitingThreads - if true, threads are registered when waiting
Method Detail

send

public void send()
Description copied from interface: Signal
Signaling (sender).

Specified by:
send in interface Signal

await

public void await()
Description copied from class: CObject
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.

Precondition:
syncronizedLockIsMine() - native lock owned by me

Specified by:
await in interface Signal
Specified by:
await in interface SyncCV
Overrides:
await in class CObject