Search in sources :

Example 1 with SingletonComponent

use of org.jboss.as.ejb3.component.singleton.SingletonComponent in project wildfly by wildfly.

the class SingletonComponent method instantiateComponentInstance.

@Override
protected BasicComponentInstance instantiateComponentInstance(Interceptor preDestroyInterceptor, Map<Method, Interceptor> methodInterceptors, Map<Object, Object> context) {
    // synchronized from getComponentInstance
    assert Thread.holdsLock(creationLock);
    if (dependsOn != null) {
        for (ServiceName serviceName : dependsOn) {
            final ServiceController<Component> service = (ServiceController<Component>) currentServiceContainer().getRequiredService(serviceName);
            final Component component = service.getValue();
            if (component instanceof SingletonComponent) {
                ((SingletonComponent) component).getComponentInstance();
            }
        }
    }
    return new SingletonComponentInstance(this, preDestroyInterceptor, methodInterceptors);
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) ServiceController(org.jboss.msc.service.ServiceController) SessionBeanComponent(org.jboss.as.ejb3.component.session.SessionBeanComponent) LockableComponent(org.jboss.as.ejb3.concurrency.LockableComponent) Component(org.jboss.as.ee.component.Component)

Example 2 with SingletonComponent

use of org.jboss.as.ejb3.component.singleton.SingletonComponent 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

Component (org.jboss.as.ee.component.Component)2 Method (java.lang.reflect.Method)1 SessionBeanComponent (org.jboss.as.ejb3.component.session.SessionBeanComponent)1 SingletonComponent (org.jboss.as.ejb3.component.singleton.SingletonComponent)1 LockableComponent (org.jboss.as.ejb3.concurrency.LockableComponent)1 InterceptorContext (org.jboss.invocation.InterceptorContext)1 ServiceController (org.jboss.msc.service.ServiceController)1 ServiceName (org.jboss.msc.service.ServiceName)1