Class EJBSuspendHandlerService

  • All Implemented Interfaces:
    jakarta.transaction.Synchronization, org.jboss.as.server.suspend.ServerActivity, org.jboss.msc.Service, org.jboss.msc.service.Service<EJBSuspendHandlerService>, org.jboss.msc.value.Value<EJBSuspendHandlerService>, org.wildfly.transaction.client.CreationListener

    public class EJBSuspendHandlerService
    extends Object
    implements org.jboss.msc.service.Service<EJBSuspendHandlerService>, org.jboss.as.server.suspend.ServerActivity, org.wildfly.transaction.client.CreationListener, jakarta.transaction.Synchronization
    Controls shutdown indicating whether a remote request should be accepted or not.
    Author:
    Flavia Rainone
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.wildfly.transaction.client.CreationListener

        org.wildfly.transaction.client.CreationListener.CreatedBy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.jboss.msc.service.ServiceName SERVICE_NAME
      EJBSuspendHandlerService name
      • Fields inherited from interface org.jboss.msc.service.Service

        NULL
    • Constructor Summary

      Constructors 
      Constructor Description
      EJBSuspendHandlerService​(boolean gracefulTxnShutdown)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean acceptInvocation​(org.jboss.invocation.InterceptorContext context)
      Indicates if a invocation should be accepted: which will happen only if server is not suspended, or if the invocation involves a still active transaction.
      void afterCompletion​(int status)
      Notifies handler that an active transaction has completed.
      void beforeCompletion()
      Notifies handler that an active transaction is about to complete.
      void enableGracefulTxnShutdown​(boolean gracefulTxnShutdown)
      Sets a new value for gracefulTxnShutdown.
      org.jboss.msc.value.InjectedValue<DeploymentRepository> getDeploymentRepositoryInjectedValue()
      Returns deployment repository injected value.
      org.jboss.msc.value.InjectedValue<org.wildfly.transaction.client.LocalTransactionContext> getLocalTransactionContextInjectedValue()
      Returns local transaction context injected value.
      org.jboss.msc.value.InjectedValue<org.jboss.as.server.suspend.SuspendController> getSuspendControllerInjectedValue()
      Returns suspend controller injected value.
      EJBSuspendHandlerService getValue()
      Returns service value.
      void invocationComplete()
      Notifies handler that an active invocation is complete.
      boolean isSuspended()
      Indicates if Jakarta Enterprise Beans subsystem is suspended.
      void preSuspend​(org.jboss.as.server.suspend.ServerActivityCallback listener)
      Pre suspend.
      void resume()
      Notifies local transaction context that server is resumed, and restarts deployment controller.
      void start​(org.jboss.msc.service.StartContext context)
      Starts the service.
      void stop​(org.jboss.msc.service.StopContext context)
      Stops the service.
      void suspended​(org.jboss.as.server.suspend.ServerActivityCallback listener)
      Notifies local transaction context that server is suspended, and only completes suspension if there are no active invocations nor transactions.
      void transactionCreated​(org.wildfly.transaction.client.AbstractTransaction transaction, org.wildfly.transaction.client.CreationListener.CreatedBy createdBy)
      Notifies handler that a new transaction has been created.
    • Field Detail

      • SERVICE_NAME

        public static final org.jboss.msc.service.ServiceName SERVICE_NAME
        EJBSuspendHandlerService name
    • Constructor Detail

      • EJBSuspendHandlerService

        public EJBSuspendHandlerService​(boolean gracefulTxnShutdown)
        Constructor.
        Parameters:
        gracefulTxnShutdown - value of model attribute
    • Method Detail

      • enableGracefulTxnShutdown

        public void enableGracefulTxnShutdown​(boolean gracefulTxnShutdown)
        Sets a new value for gracefulTxnShutdown.
        Parameters:
        gracefulTxnShutdown - new value of the model attribute
      • getSuspendControllerInjectedValue

        public org.jboss.msc.value.InjectedValue<org.jboss.as.server.suspend.SuspendController> getSuspendControllerInjectedValue()
        Returns suspend controller injected value.
        Returns:
        suspend controller injected value
      • getLocalTransactionContextInjectedValue

        public org.jboss.msc.value.InjectedValue<org.wildfly.transaction.client.LocalTransactionContext> getLocalTransactionContextInjectedValue()
        Returns local transaction context injected value.
        Returns:
        local transaction context injected value
      • getDeploymentRepositoryInjectedValue

        public org.jboss.msc.value.InjectedValue<DeploymentRepository> getDeploymentRepositoryInjectedValue()
        Returns deployment repository injected value.
        Returns:
        local transaction context injected value
      • start

        public void start​(org.jboss.msc.service.StartContext context)
        Starts the service. Registers server activity, sets transaction listener on local transaction context, and creates and installs deployment controller service.
        Specified by:
        start in interface org.jboss.msc.Service
        Parameters:
        context - start context
      • stop

        public void stop​(org.jboss.msc.service.StopContext context)
        Stops the service. Unregisters service activity and clears transaction listener.
        Specified by:
        stop in interface org.jboss.msc.Service
        Parameters:
        context - stop context
      • preSuspend

        public void preSuspend​(org.jboss.as.server.suspend.ServerActivityCallback listener)
        Pre suspend. Do nothing.
        Specified by:
        preSuspend in interface org.jboss.as.server.suspend.ServerActivity
        Parameters:
        listener - callback listener
      • suspended

        public void suspended​(org.jboss.as.server.suspend.ServerActivityCallback listener)
        Notifies local transaction context that server is suspended, and only completes suspension if there are no active invocations nor transactions.
        Specified by:
        suspended in interface org.jboss.as.server.suspend.ServerActivity
        Parameters:
        listener - callback listener
      • resume

        public void resume()
        Notifies local transaction context that server is resumed, and restarts deployment controller.
        Specified by:
        resume in interface org.jboss.as.server.suspend.ServerActivity
      • acceptInvocation

        public boolean acceptInvocation​(org.jboss.invocation.InterceptorContext context)
                                 throws jakarta.transaction.SystemException
        Indicates if a invocation should be accepted: which will happen only if server is not suspended, or if the invocation involves a still active transaction.
        Parameters:
        context - interceptor context
        Returns:
        true if invocation can be accepted by invoking interceptor
        Throws:
        jakarta.transaction.SystemException
      • invocationComplete

        public void invocationComplete()
        Notifies handler that an active invocation is complete.
      • transactionCreated

        public void transactionCreated​(org.wildfly.transaction.client.AbstractTransaction transaction,
                                       org.wildfly.transaction.client.CreationListener.CreatedBy createdBy)
        Notifies handler that a new transaction has been created.
        Specified by:
        transactionCreated in interface org.wildfly.transaction.client.CreationListener
      • beforeCompletion

        public void beforeCompletion()
        Notifies handler that an active transaction is about to complete.
        Specified by:
        beforeCompletion in interface jakarta.transaction.Synchronization
      • afterCompletion

        public void afterCompletion​(int status)
        Notifies handler that an active transaction has completed.
        Specified by:
        afterCompletion in interface jakarta.transaction.Synchronization
      • isSuspended

        public boolean isSuspended()
        Indicates if Jakarta Enterprise Beans subsystem is suspended.
        Returns:
        true if Jakarta Enterprise Beans susbsystem suspension is started (regardless of whether it completed or not)