public final class ZTrigger extends Object
A trigger is a synchronization object with the following features:
- It can be waited on, with or without a timeout interval.
- It can be released to let the waiting thread continue.
- It can be released before it is being requested so that the requesting thread will continue without pausing.
- It can be released only if it is being requested, i.e. there is a thread pausing on it.
Constructors Constructor Description
public void pause(long timeout)Pauses the calling thread until the trigger is released or the given timeout interval has elapsed.
The calling thread does not pause if the trigger was released before it is requested.
timeout- the maximum time to wait in milliseconds, or zero if the calling thread shall wait unlimited until the trigger is released.
public void activate()Releases the trigger.
This method can be used to release the trigger before it is being requested, so that a following request for the trigger will cause the calling thread to continue without pausing.
public void release()Releases the trigger only if it has been requested, i.e. it is paused on by another thread.
Use this method if you want to release the thread (or threads) that is pausing on the trigger, but you don't want the trigger to be released before it is requested.