dist1.acb.common
Class Signal

java.lang.Object
  extended bydist1.acb.common.Signal

public class Signal
extends java.lang.Object

Signal (for synchronization of threads)

Version:
$Revision: 1.2 $
Author:
Alexander Stasiv

Constructor Summary
Signal(java.lang.String signalName)
          Creates a new instance of Signal (not signaled state)
Signal(java.lang.String signalName, boolean isSignaled)
          Creates a new instance of Signal
 
Method Summary
 void signal()
          Signal to one of waiters
 void signalToAll()
          Signal to all waiters
 void waitForSignal()
          Waits for signal
 boolean waitForSignal(long timeout)
          Waits for signal (maximum timeout ms)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Signal

public Signal(java.lang.String signalName)
Creates a new instance of Signal (not signaled state)

Parameters:
signalName - A name of the signal

Signal

public Signal(java.lang.String signalName,
              boolean isSignaled)
Creates a new instance of Signal

Parameters:
signalName - A name of the signal
isSignaled - if start state is signaled state
Method Detail

signal

public void signal()
Signal to one of waiters


signalToAll

public void signalToAll()
Signal to all waiters


waitForSignal

public void waitForSignal()
                   throws java.lang.InterruptedException
Waits for signal

Throws:
java.lang.InterruptedException - Snother thread interrupted current thread using the interrupt method in class Thread

waitForSignal

public boolean waitForSignal(long timeout)
                      throws java.lang.InterruptedException
Waits for signal (maximum timeout ms)

Parameters:
timeout - the maximum time to wait in milliseconds
Returns:
true if signal was received, false if timeout was occurred or signalToAll was called and someone took the signal
Throws:
java.lang.InterruptedException - Snother thread interrupted current thread using the interrupt method in class Thread


Copyright © 2004 Phoenix Team (CMU/AIT). All Rights Reserved.