public void afterDeploymentValidation( final @Observes AfterDeploymentValidation event, final BeanManager manager) { // Force execution of Bootstrap bean's @PostConstruct methods first runPostConstruct(manager, startupBootstrapBeans); }
/** * Dedicated <code>WorkItemHandlerProducer</code> to register <code>AsyncWorkItemHandler</code> * in CDI environment when using deployment services (jbpm-kie-services). * */ @Activate(whenAvailable="org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl") @ApplicationScoped public class AsyncHandlerProducer implements WorkItemHandlerProducer { @Override public Map<String, WorkItemHandler> getWorkItemHandlers(String identifier, Map<String, Object> params) { Map<String, WorkItemHandler> handlers = new HashMap<String, WorkItemHandler>(); ExecutorService executorService = (ExecutorService) params.get("executorService"); if (executorService != null) { handlers.put("async",new AsyncWorkItemHandler(executorService, PrintOutCommand.class.getName())); } return handlers; } }
protected boolean isAvailable(String classname, boolean expected) { ClassLoader cl = this.getClass().getClassLoader(); boolean result = isAvailable(classname, cl); if (result != expected) { result = isAvailable(classname, Thread.currentThread().getContextClassLoader()); } return result; }
<X> void processAnnotatedType(@Observes final @WithAnnotations(Activate.class) ProcessAnnotatedType<X> pat) { final AnnotatedType<X> annotatedType = pat.getAnnotatedType(); final Class<X> javaClass = annotatedType.getJavaClass(); Activate veto = javaClass.getAnnotation(Activate.class); String whenAvailable = veto.whenAvailable(); String whenNotAvailable = veto.whenNotAvailable(); if (isNotEmpty(whenAvailable) && !isAvailable(whenAvailable, true)) { // veto bean in case whenAvailable is not present pat.veto(); } if (isNotEmpty(whenNotAvailable) && isAvailable(whenNotAvailable, false)) { // veto bean in case whenNotAvailable is present pat.veto(); } }
@Named("ExecutorServiceLifeCycleController-startable") @BootOnLoad @ApplicationScoped public class ExecutorServiceLifeCycleController { @Inject private ExecutorService executorService; @PostConstruct public void init() { executorService.init(); } @PreDestroy public void destroy() { executorService.destroy(); } }
@Named("DeploymentSyncManager-startable") @BootOnLoad @ApplicationScoped public class DeploymentSyncManager {
@Named("QueryServiceCDIImpl-startable") @BootOnLoad @ApplicationScoped public class QueryServiceCDIImpl extends QueryServiceImpl {