Package io.temporal.internal
Class Signal
- java.lang.Object
-
- io.temporal.internal.Signal
-
public class Signal extends java.lang.Object
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 Constructor Description Signal()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 trueboolean
isSignalled()
Peek at the signalvoid
signal()
Set the done flagvoid
waitForSignal()
Wait indefinitely for the done signalboolean
waitForSignal(long timeoutMs)
Wait up to timeout for the signalboolean
waitForSignal(long timeout, java.time.temporal.TemporalUnit timeUnit)
Wait up to timeout for the signalboolean
waitForSignal(long timeout, java.util.concurrent.TimeUnit timeUnit)
Wait up to timeout for the signalboolean
waitForSignal(java.time.Duration timeout)
Wait up to timeout for the signal
-
-
-
Method Detail
-
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
public boolean waitForSignal(long timeout, java.util.concurrent.TimeUnit timeUnit) throws java.lang.InterruptedException
Wait up to timeout for the signal- Parameters:
timeout
- timeouttimeUnit
- unit for timeout- Returns:
- true if signaled, false if returned by timeout
- Throws:
java.lang.InterruptedException
- on interruption of awaiting thread
-
waitForSignal
public boolean waitForSignal(long timeout, java.time.temporal.TemporalUnit timeUnit) throws java.lang.InterruptedException
Wait up to timeout for the signal- Parameters:
timeout
- timeouttimeUnit
- unit for timeout- Returns:
- true if signaled, false if returned by timeout
- Throws:
java.lang.InterruptedException
- on interruption of awaiting thread
-
waitForSignal
public boolean waitForSignal(java.time.Duration timeout) throws java.lang.InterruptedException
Wait up to timeout for the signal- Parameters:
timeout
- timeout- Returns:
- true if signaled, false if returned by timeout
- Throws:
java.lang.InterruptedException
- on interruption of awaiting thread
-
waitForSignal
public boolean waitForSignal(long timeoutMs) throws java.lang.InterruptedException
Wait up to timeout for the signal- Parameters:
timeoutMs
- timeout in milliseconds- Returns:
- true if signaled, false if returned by timeout
- Throws:
java.lang.InterruptedException
- on interruption of awaiting thread
-
waitForSignal
public void waitForSignal() throws java.lang.InterruptedException
Wait indefinitely for the done signal- Throws:
java.lang.InterruptedException
- on interruption of awaiting thread
-
isSignalled
public boolean isSignalled()
Peek at the signal- Returns:
- the state of the signal
-
-