Interface ServerActivity


  • public interface ServerActivity
    A server activity that may have to finish before the server can shut down gracefully.
    Author:
    Stuart Douglas
    • Method Detail

      • getExecutionGroup

        default int getExecutionGroup()
        Returns a value that indicates to which set of ServerActivity instances registered with the SuspendController this activity should belong. All ServerActivity instances with the same execution group value have their preSuspend, suspended and resume methods invoked separately from activities with different execution group values.

        The order in which execution groups will be processed depends on the method being invoked:

        • For preSuspend and suspended, groups with a lower value are processed before those with a higher value.
        • For resume, groups with a higher value are processed before those with a lower value.

        There is no guarantee of any ordering of method invocation between activities in the same execution group, and they may even be processed concurrently.

        Note that preSuspend is invoked for all activity instances before the overall suspend process proceeds to calls to suspended. The unit of grouping is the individual method invocations, not the overall preSuspend/suspended process.

        The default implementation of this method returns DEFAULT_EXECUTION_GROUP.

        Returns:
        a value between LOWEST_EXECUTION_GROUP and HIGHEST_EXECUTION_GROUP, inclusive.
      • preSuspend

        void preSuspend​(ServerActivityCallback listener)
        Invoked before the server is paused. This is the place where pause notifications should be sent to external systems such as load balancers to tell them this node is about to go away.
        Parameters:
        listener - The listener to invoker when the pre-pause phase is done
      • suspended

        void suspended​(ServerActivityCallback listener)
        Invoked once the suspend process has started. One this has been invoked no new requests should be allowed to proceeed
        Parameters:
        listener - The listener to invoke when suspend is done.
      • resume

        void resume()
        Invoked if the suspend or pre-suspend is cancelled or if a suspended server is resumed.