Package org.jboss.as.ejb3.suspend
Class EJBSuspendHandlerService
- java.lang.Object
-
- org.jboss.as.ejb3.suspend.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
-
-
Field Summary
Fields Modifier and Type Field Description static org.jboss.msc.service.ServiceNameSERVICE_NAMEEJBSuspendHandlerService name
-
Constructor Summary
Constructors Constructor Description EJBSuspendHandlerService(boolean gracefulTxnShutdown)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptInvocation(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.voidafterCompletion(int status)Notifies handler that an active transaction has completed.voidbeforeCompletion()Notifies handler that an active transaction is about to complete.voidenableGracefulTxnShutdown(boolean gracefulTxnShutdown)Sets a new value forgracefulTxnShutdown.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.EJBSuspendHandlerServicegetValue()Returns service value.voidinvocationComplete()Notifies handler that an active invocation is complete.booleanisSuspended()Indicates if Jakarta Enterprise Beans subsystem is suspended.voidpreSuspend(org.jboss.as.server.suspend.ServerActivityCallback listener)Pre suspend.voidresume()Notifies local transaction context that server is resumed, and restarts deployment controller.voidstart(org.jboss.msc.service.StartContext context)Starts the service.voidstop(org.jboss.msc.service.StopContext context)Stops the service.voidsuspended(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.voidtransactionCreated(org.wildfly.transaction.client.AbstractTransaction transaction, org.wildfly.transaction.client.CreationListener.CreatedBy createdBy)Notifies handler that a new transaction has been created.
-
-
-
Method Detail
-
enableGracefulTxnShutdown
public void enableGracefulTxnShutdown(boolean gracefulTxnShutdown)
Sets a new value forgracefulTxnShutdown.- 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
-
getValue
public EJBSuspendHandlerService getValue()
Returns service value.- Specified by:
getValuein interfaceorg.jboss.msc.value.Value<EJBSuspendHandlerService>
-
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:
startin interfaceorg.jboss.msc.Service- Specified by:
startin interfaceorg.jboss.msc.service.Service<EJBSuspendHandlerService>- 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:
stopin interfaceorg.jboss.msc.Service- Specified by:
stopin interfaceorg.jboss.msc.service.Service<EJBSuspendHandlerService>- Parameters:
context- stop context
-
preSuspend
public void preSuspend(org.jboss.as.server.suspend.ServerActivityCallback listener)
Pre suspend. Do nothing.- Specified by:
preSuspendin interfaceorg.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:
suspendedin interfaceorg.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:
resumein interfaceorg.jboss.as.server.suspend.ServerActivity
-
acceptInvocation
public boolean acceptInvocation(org.jboss.invocation.InterceptorContext context) throws jakarta.transaction.SystemExceptionIndicates 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:
trueif 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:
transactionCreatedin interfaceorg.wildfly.transaction.client.CreationListener
-
beforeCompletion
public void beforeCompletion()
Notifies handler that an active transaction is about to complete.- Specified by:
beforeCompletionin interfacejakarta.transaction.Synchronization
-
afterCompletion
public void afterCompletion(int status)
Notifies handler that an active transaction has completed.- Specified by:
afterCompletionin interfacejakarta.transaction.Synchronization
-
isSuspended
public boolean isSuspended()
Indicates if Jakarta Enterprise Beans subsystem is suspended.- Returns:
trueif Jakarta Enterprise Beans susbsystem suspension is started (regardless of whether it completed or not)
-
-