pt.ua.concurrent
Class GroupMutexComposedCV

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

public class GroupMutexComposedCV
extends CObject
implements SyncCV

A composed conditional variable for an exterior GroupMutex with a list of alternative internal Sync objects (used, for example, to integrate internal, external and conditional synchronization of shared objects). A unique null reference is allowed to enable the inclusion of lock-free schemes.

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

Version:
0.5, October 2013
Author:
Miguel Oliveira e Silva (mos@ua.pt)

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 broadcast()
          Object's nofifyAll replacement.
 GroupMutex gmutex()
           
 boolean lockIsMine()
          Is lock owned by me?
 void signal()
          Object's nofify replacement.
static boolean validList(Sync[] list)
          Is list a valid array of Sync objects?
 
Methods inherited from class pt.ua.concurrent.CObject
await, await, interruptWaitingThreads, registerAwaitingThreads, 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
 

Method Detail

validList

public static boolean validList(Sync[] list)
Is list a valid array of Sync objects?

Returns:
true, if it is valid, false otherwise

gmutex

public GroupMutex gmutex()

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 SyncCV
Overrides:
await in class CObject

signal

public void signal()
Description copied from class: CObject
Object's nofify replacement.

Precondition:
syncronizedLockIsMine() - native lock owned by me

Specified by:
signal in interface SyncCV
Overrides:
signal in class CObject

broadcast

public void broadcast()
Description copied from class: CObject
Object's nofifyAll replacement.

Precondition:
syncronizedLockIsMine() - native lock owned by me

Specified by:
broadcast in interface SyncCV
Overrides:
broadcast in class CObject

lockIsMine

public boolean lockIsMine()
Description copied from class: CObject
Is lock owned by me?

Specified by:
lockIsMine in interface SyncCV
Overrides:
lockIsMine in class CObject
Returns:
true, if lock is mine