Class AbstractLightyModule

    • Constructor Detail

      • AbstractLightyModule

        public AbstractLightyModule​(ExecutorService executorService)
      • AbstractLightyModule

        public AbstractLightyModule()
    • Method Detail

      • initProcedure

        protected abstract boolean initProcedure()
                                          throws InterruptedException
        This method is called in start() method. Implementation of this method should initialize everything necessary.
        Returns:
        success of initialization
        Throws:
        InterruptedException - if initialization was interrupted.
      • stopProcedure

        protected abstract boolean stopProcedure()
                                          throws InterruptedException
        This method is called in shutdown() method. Implementation of this method should do everything necessary to shutdown correctly (e.g. stop initialized beans, release resources, ...).
        Returns:
        success of stop.
        Throws:
        InterruptedException - if stopping was interrupted.
      • start

        public com.google.common.util.concurrent.ListenableFuture<Boolean> start()
        Description copied from interface: LightyModule
        Start in background and return immediately.
        Specified by:
        start in interface LightyModule
        Returns:
        true if module initialization was successful, false or exception otherwise.
      • startBlocking

        public void startBlocking​(Consumer<Boolean> initFinishCallback)
                           throws InterruptedException
        Start and block until shutdown is requested.
        Parameters:
        initFinishCallback - callback that will be called after start is completed.
        Throws:
        InterruptedException - thrown in case module initialization fails.
      • shutdown

        public com.google.common.util.concurrent.ListenableFuture<Boolean> shutdown()
        Description copied from interface: LightyModule
        Shutdown module.
        Specified by:
        shutdown in interface LightyModule
        Returns:
        true if module shutdown was successful, false or exception otherwise.