Search in sources :

Example 1 with CurrentInvocationContext

use of org.jboss.as.ejb3.context.CurrentInvocationContext in project wildfly by wildfly.

the class NonFunctionalTimerService method assertInvocationAllowed.

private void assertInvocationAllowed() {
    AllowedMethodsInformation.checkAllowed(MethodType.TIMER_SERVICE_METHOD);
    final InterceptorContext currentInvocationContext = CurrentInvocationContext.get();
    if (currentInvocationContext == null) {
        return;
    }
    // If the method in current invocation context is null,
    // then it represents a lifecycle callback invocation
    Method invokedMethod = currentInvocationContext.getMethod();
    if (invokedMethod == null) {
        // it's a lifecycle callback
        Component component = currentInvocationContext.getPrivateData(Component.class);
        if (!(component instanceof SingletonComponent)) {
            throw EjbLogger.EJB3_TIMER_LOGGER.failToInvokeTimerServiceDoLifecycle();
        }
    }
}
Also used : InterceptorContext(org.jboss.invocation.InterceptorContext) SingletonComponent(org.jboss.as.ejb3.component.singleton.SingletonComponent) Method(java.lang.reflect.Method) SingletonComponent(org.jboss.as.ejb3.component.singleton.SingletonComponent) Component(org.jboss.as.ee.component.Component)

Aggregations

Method (java.lang.reflect.Method)1 Component (org.jboss.as.ee.component.Component)1 SingletonComponent (org.jboss.as.ejb3.component.singleton.SingletonComponent)1 InterceptorContext (org.jboss.invocation.InterceptorContext)1