Interface AsyncRunnable

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Implementing Classes:
    AsyncRunnableBase, DaemonBase

    public interface AsyncRunnable
    extends java.io.Closeable
    • Method Detail

      • state

        AsyncRunnable.State state()
                           throws java.rmi.RemoteException
        Returns:
        the current state, null if closed
        Throws:
        java.rmi.RemoteException
      • isInitial

        boolean isInitial()
                   throws java.rmi.RemoteException
        Returns:
        true if the state is "initial", false otherwise
        Throws:
        java.rmi.RemoteException
      • isStarted

        boolean isStarted()
                   throws java.rmi.RemoteException
        Returns:
        true if the state is "started", false otherwise
        Throws:
        java.rmi.RemoteException
      • isShutdown

        boolean isShutdown()
                    throws java.rmi.RemoteException
        Returns:
        true if the state is "shutdown", false otherwise
        Throws:
        java.rmi.RemoteException
      • isStopped

        boolean isStopped()
                   throws java.rmi.RemoteException
        Returns:
        true if the state is "stopped", false otherwise
        Throws:
        java.rmi.RemoteException
      • isClosed

        boolean isClosed()
                  throws java.rmi.RemoteException
        Returns:
        true if there's no state, false otherwise
        Throws:
        java.rmi.RemoteException
      • start

        AsyncRunnable start()
                     throws java.rmi.RemoteException
        Start/resume the execution
        Returns:
        the same instance with state changed to STARTED if call was successful.
        Throws:
        java.rmi.RemoteException
      • shutdown

        AsyncRunnable shutdown()
                        throws java.rmi.RemoteException
        Notify to stop to enqueue incoming requests. The await method should be used after this to make sure that everything accepted before the shutdown is done.
        Throws:
        java.rmi.RemoteException
      • stop

        AsyncRunnable stop()
                    throws java.rmi.RemoteException
        Stop (with further resumption capability)
        Returns:
        the same instance with state changed to STOPPED if call was successful
        Throws:
        java.rmi.RemoteException
      • await

        AsyncRunnable await()
                     throws java.lang.InterruptedException,
                            java.rmi.RemoteException
        Wait while the state is STARTED
        Returns:
        the same instance
        Throws:
        java.lang.InterruptedException
        java.rmi.RemoteException
      • await

        boolean await​(long timeout,
                      java.util.concurrent.TimeUnit timeUnit)
               throws java.lang.InterruptedException,
                      java.rmi.RemoteException
        Throws:
        java.lang.InterruptedException
        java.rmi.RemoteException