@Override protected boolean requiresInterceptors(final Method method, final ComponentConfiguration componentConfiguration) { if (super.requiresInterceptors(method, componentConfiguration)) { return true; } final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) componentConfiguration.getComponentDescription(); if ((ejbComponentDescription.getTimeoutMethod() != null && ejbComponentDescription.getTimeoutMethod().equals(method)) || ejbComponentDescription.getScheduleMethods().containsKey(method)) { return true; } return false; }
final TimerServiceImpl service = new TimerServiceImpl(ejbComponentDescription.getScheduleMethods(), serviceName, timerServiceRegistry); final ServiceBuilder<javax.ejb.TimerService> createBuilder = context.getServiceTarget().addService(serviceName, service); createBuilder.addDependency(TIMER_SERVICE_NAME, Timer.class, service.getTimerInjectedValue());
for (Method method : componentConfiguration.getDefinedComponentMethods()) { if ((ejbComponentDescription.getTimeoutMethod() != null && ejbComponentDescription.getTimeoutMethod().equals(method)) || ejbComponentDescription.getScheduleMethods().containsKey(method)) { final InterceptorFactory interceptorFactory = Interceptors.getChainedInterceptorFactory(componentConfiguration.getAroundTimeoutInterceptors(method)); timeoutInterceptors.put(method, interceptorFactory);
@Override protected boolean requiresInterceptors(final Method method, final ComponentConfiguration componentConfiguration) { if(super.requiresInterceptors(method, componentConfiguration)) { return true; } final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription)componentConfiguration.getComponentDescription(); if ((ejbComponentDescription.getTimeoutMethod() != null && ejbComponentDescription.getTimeoutMethod().equals(method)) || ejbComponentDescription.getScheduleMethods().containsKey(method)) { return true; } return false; }
@Override public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException { final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) description; final ServiceName invokerServiceName = ejbComponentDescription.getServiceName().append(TimedObjectInvokerImpl.SERVICE_NAME); final TimedObjectInvokerImpl invoker = new TimedObjectInvokerImpl(deploymentName, module); context.getServiceTarget().addService(invokerServiceName, invoker) .addDependency(component.getCreateServiceName(), EJBComponent.class, invoker.getEjbComponent()) .install(); //install the timer create service final ServiceName serviceName = component.getServiceName().append(TimerServiceImpl.SERVICE_NAME); final TimerServiceImpl service = new TimerServiceImpl(ejbComponentDescription.getScheduleMethods(), serviceName); final ServiceBuilder<javax.ejb.TimerService> createBuilder = context.getServiceTarget().addService(serviceName, service); createBuilder.addDependency(TIMER_SERVICE_NAME, Timer.class, service.getTimerInjectedValue()); createBuilder.addDependency(component.getCreateServiceName(), EJBComponent.class, service.getEjbComponentInjectedValue()); createBuilder.addDependency(timerServiceThreadPool, ExecutorService.class, service.getExecutorServiceInjectedValue()); createBuilder.addDependency(FileTimerPersistence.SERVICE_NAME, TimerPersistence.class, service.getTimerPersistence()); createBuilder.addDependency(invokerServiceName, TimedObjectInvoker.class, service.getTimedObjectInvoker()); createBuilder.install(); ejbComponentDescription.setTimerService(service); //inject the timer service directly into the start service configuration.getStartDependencies().add(new DependencyConfigurator<ComponentStartService>() { @Override public void configureDependency(final ServiceBuilder<?> serviceBuilder, final ComponentStartService service) throws DeploymentUnitProcessingException { serviceBuilder.addDependency(serviceName); } }); } });
for (Method method : componentConfiguration.getDefinedComponentMethods()) { if ((ejbComponentDescription.getTimeoutMethod() != null && ejbComponentDescription.getTimeoutMethod().equals(method)) || ejbComponentDescription.getScheduleMethods().containsKey(method)) { final InterceptorFactory interceptorFactory = Interceptors.getChainedInterceptorFactory(componentConfiguration.getAroundTimeoutInterceptors(method)); timeoutInterceptors.put(method, interceptorFactory);