|
IBM Branch Transformation Toolkit Javadoc | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.connector2.sna.lu0.host.Semaphore
This class provides a semaphore with timeOut option. SignalOn or signalOnAll must be used depending if processes are awoken once at a time or all of them at once. SignalOn method works with a signals counter which is really important to know if there are signals to be processed using hasSignals method. Then, reset signal does not make any sense in this case and the use of waitOnAndResetSignal methods must be forbbiden to ensure a good use of the semaphore in the application. Also the application must be consistent using the different options of the wait methods, so it is advised be aware of merge waits with different values of waitEvenIfSignalAlreadyNotified parameter. SignalOnAll always must be used with waitOnAndResetSignal methods in order to grant consistency with the signals counter because in this case it is not needed.
Constructor Summary | |
---|---|
Semaphore()
This constructor creates a Semaphore object. |
Method Summary | |
---|---|
void |
clearSignal()
Clears signalsCounter property. |
boolean |
hasSignals()
Returns true if a signal has already been notified when a process wants to enter the semaphore. |
boolean |
hasTimedOut()
Returns true if a thread has been woken up by time out. |
void |
signalOn()
Wakes up a thread that is waiting on the Semaphore. |
void |
signalOnAll()
Wakes up all threads that are waiting on the Semaphore. |
void |
waitOn()
Unless a signal has already been notified, this method holds the process indefinitely until the Semaphore receives a signal. |
void |
waitOn(boolean waitEvenIfSignalAlreadyNotified,
boolean resetSignal)
Holds the process until the Semaphore receives the signal. |
void |
waitOn(long timeout)
Unless a signal has already been notified, this method holds the process until the Semaphore receives a signal or until the timeout is reached. |
void |
waitOn(long timeout,
boolean waitEvenIfSignalAlreadyNotified,
boolean resetSignal)
Holds the process until the Semaphore receives the signal or until the timeout is reached. |
void |
waitOnAndResetSignal()
Unless a signal has already been notified, this method holds the process until the Semaphore receives a signal. |
void |
waitOnAndResetSignal(long timeout)
Unless a signal has already been notified, this method holds the process until the Semaphore receives a signal or until the timeout is reached. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Semaphore()
Method Detail |
public void clearSignal()
public boolean hasSignals()
public boolean hasTimedOut()
public void signalOn()
public void signalOnAll()
public void waitOn()
public void waitOn(long timeout)
timeout
- long the maximum time to wait in millisecondspublic void waitOn(long timeout, boolean waitEvenIfSignalAlreadyNotified, boolean resetSignal)
timeout
- long the maximum time to wait in millisecondswaitEvenIfSignalAlreadyNotified
- boolean allows to choose to wait or no if a signal
has already been notified.resetSignal
- boolean allows to reset signalAlreadyNotified property.public void waitOn(boolean waitEvenIfSignalAlreadyNotified, boolean resetSignal)
waitEvenIfSignalAlreadyNotified
- boolean allows to choose to wait or no if a signal
has already been notified.public void waitOnAndResetSignal()
public void waitOnAndResetSignal(long timeout)
timeout
- long the maximum time to wait in milliseconds
|
IBM Branch Transformation Toolkit Javadoc | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |