Class Signal

java.lang.Object
io.temporal.internal.Signal

public class Signal extends 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 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

      public boolean waitForSignal(long timeout, TimeUnit timeUnit) throws InterruptedException
      Wait up to timeout for the signal
      Parameters:
      timeout - timeout
      timeUnit - unit for timeout
      Returns:
      true if signaled, false if returned by timeout
      Throws:
      InterruptedException - on interruption of awaiting thread
    • waitForSignal

      public boolean waitForSignal(long timeout, TemporalUnit timeUnit) throws InterruptedException
      Wait up to timeout for the signal
      Parameters:
      timeout - timeout
      timeUnit - unit for timeout
      Returns:
      true if signaled, false if returned by timeout
      Throws:
      InterruptedException - on interruption of awaiting thread
    • waitForSignal

      public boolean waitForSignal(Duration timeout) throws InterruptedException
      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

      public boolean waitForSignal(long timeoutMs) throws InterruptedException
      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

      public void waitForSignal() throws InterruptedException
      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