Class Signal
java.lang.Object
io.temporal.internal.Signal
Represents a flag which can be set or waited for. Once signalled, threads waiting for it unblock
or will not be blocked if started to wait when flag is already set.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear the signal - doesn't notify, as nothing should be waiting for this, even if they are they're waiting for it to go truebooleanPeek at the signalvoidsignal()Set the done flagvoidWait indefinitely for the done signalbooleanwaitForSignal(long timeoutMs) Wait up to timeout for the signalbooleanwaitForSignal(long timeout, TemporalUnit timeUnit) Wait up to timeout for the signalbooleanwaitForSignal(long timeout, TimeUnit timeUnit) Wait up to timeout for the signalbooleanwaitForSignal(Duration timeout) Wait up to timeout for the signal
-
Constructor Details
-
Signal
public Signal()
-
-
Method Details
-
signal
public void signal()Set the done flag -
clearSignal
public void clearSignal()Clear the signal - doesn't notify, as nothing should be waiting for this, even if they are they're waiting for it to go true -
waitForSignal
Wait up to timeout for the signal- Parameters:
timeout- timeouttimeUnit- unit for timeout- Returns:
- true if signaled, false if returned by timeout
- Throws:
InterruptedException- on interruption of awaiting thread
-
waitForSignal
Wait up to timeout for the signal- Parameters:
timeout- timeouttimeUnit- unit for timeout- Returns:
- true if signaled, false if returned by timeout
- Throws:
InterruptedException- on interruption of awaiting thread
-
waitForSignal
Wait up to timeout for the signal- Parameters:
timeout- timeout- Returns:
- true if signaled, false if returned by timeout
- Throws:
InterruptedException- on interruption of awaiting thread
-
waitForSignal
Wait up to timeout for the signal- Parameters:
timeoutMs- timeout in milliseconds- Returns:
- true if signaled, false if returned by timeout
- Throws:
InterruptedException- on interruption of awaiting thread
-
waitForSignal
Wait indefinitely for the done signal- Throws:
InterruptedException- on interruption of awaiting thread
-
isSignalled
public boolean isSignalled()Peek at the signal- Returns:
- the state of the signal
-