Class AsyncRunnableBase

  • All Implemented Interfaces:
    AsyncRunnable, java.io.Closeable, java.lang.AutoCloseable
    Direct Known Subclasses:
    DaemonBase

    public abstract class AsyncRunnableBase
    extends java.lang.Object
    implements AsyncRunnable
    • Constructor Detail

      • AsyncRunnableBase

        public AsyncRunnableBase()
    • Method Detail

      • isInitial

        public boolean isInitial()
        Specified by:
        isInitial in interface AsyncRunnable
        Returns:
        true if the state is "initial", false otherwise
      • isStarted

        public boolean isStarted()
        Specified by:
        isStarted in interface AsyncRunnable
        Returns:
        true if the state is "started", false otherwise
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface AsyncRunnable
        Returns:
        true if the state is "shutdown", false otherwise
      • isStopped

        public boolean isStopped()
        Specified by:
        isStopped in interface AsyncRunnable
        Returns:
        true if the state is "stopped", false otherwise
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface AsyncRunnable
        Returns:
        true if there's no state, false otherwise
      • start

        public final AsyncRunnableBase start()
        Description copied from interface: AsyncRunnable
        Start/resume the execution
        Specified by:
        start in interface AsyncRunnable
        Returns:
        the same instance with state changed to STARTED if call was successful.
      • shutdown

        public final AsyncRunnableBase shutdown()
        Description copied from interface: AsyncRunnable
        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.
        Specified by:
        shutdown in interface AsyncRunnable
      • stop

        public final AsyncRunnableBase stop()
        Description copied from interface: AsyncRunnable
        Stop (with further resumption capability)
        Specified by:
        stop in interface AsyncRunnable
        Returns:
        the same instance with state changed to STOPPED if call was successful
      • await

        public final AsyncRunnableBase await()
                                      throws java.lang.InterruptedException
        Description copied from interface: AsyncRunnable
        Wait while the state is STARTED
        Specified by:
        await in interface AsyncRunnable
        Returns:
        the same instance
        Throws:
        java.lang.InterruptedException
      • await

        public boolean await​(long timeout,
                             java.util.concurrent.TimeUnit timeUnit)
                      throws java.lang.InterruptedException
        Specified by:
        await in interface AsyncRunnable
        Throws:
        java.lang.InterruptedException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • doStart

        protected void doStart()
      • doShutdown

        protected void doShutdown()
      • doStop

        protected void doStop()
      • doClose

        protected void doClose()
                        throws java.io.IOException
        Throws:
        java.io.IOException