javax.enterprise.concurrent.ContextService Java Examples
The following examples show how to use
javax.enterprise.concurrent.ContextService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BuiltInEnvironmentEntries.java From tomee with Apache License 2.0 | 5 votes |
private void add(final JndiConsumer jndi, final DeploymentModule module, final DeploymentModule app, final boolean defaults) { // Standard names add(jndi.getEnvEntryMap(), new EnvEntry().name("java:module/ModuleName").value(module.getModuleId()).type(String.class)); add(jndi.getEnvEntryMap(), new EnvEntry().name("java:app/AppName").value(app.getModuleId()).type(String.class)); // Standard References to built-in objects add(jndi.getResourceEnvRefMap(), new ResourceEnvRef().name("java:comp/BeanManager").type(BeanManager.class)); add(jndi.getResourceEnvRefMap(), new ResourceEnvRef().name("java:comp/Validator").type(Validator.class)); add(jndi.getResourceEnvRefMap(), new ResourceEnvRef().name("java:comp/ValidatorFactory").type(ValidatorFactory.class)); add(jndi.getResourceEnvRefMap(), new ResourceEnvRef().name("java:comp/TransactionManager").type(TransactionManager.class)); add(jndi.getResourceEnvRefMap(), new ResourceEnvRef().name("java:comp/TransactionSynchronizationRegistry").type(TransactionSynchronizationRegistry.class)); if (defaults) { add(jndi.getResourceEnvRefMap(), new ResourceEnvRef().name("java:comp/DefaultManagedExecutorService").type(ManagedExecutorService.class)); add(jndi.getResourceEnvRefMap(), new ResourceEnvRef().name("java:comp/DefaultManagedScheduledExecutorService").type(ManagedScheduledExecutorService.class)); add(jndi.getResourceEnvRefMap(), new ResourceEnvRef().name("java:comp/DefaultManagedThreadFactory").type(ManagedThreadFactory.class)); add(jndi.getResourceEnvRefMap(), new ResourceEnvRef().name("java:comp/DefaultContextService").type(ContextService.class)); try { final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); contextClassLoader.loadClass("org.apache.activemq.ActiveMQSslConnectionFactory"); final ResourceEnvRef ref = new ResourceEnvRef().name("java:comp/DefaultJMSConnectionFactory") .type(contextClassLoader.loadClass("javax.jms.ConnectionFactory")); add(jndi.getResourceEnvRefMap(), ref); } catch (final ClassNotFoundException | NoClassDefFoundError notThere) { // no-op } } // OpenEJB specific feature add(jndi.getEnvEntryMap(), new EnvEntry().name("java:comp/ComponentName").value(jndi.getJndiConsumerName()).type(String.class)); }
Example #2
Source File: InjectionTest.java From tomee with Apache License 2.0 | 5 votes |
private static void doCheck(final ManagedExecutorService es, final ManagedScheduledExecutorService ses, final ContextService ces, final ManagedThreadFactory tf) { assertNotNull(es); assertNotNull(ses); assertNotNull(ces); assertNotNull(tf); assertThat(es, instanceOf(ManagedExecutorServiceImpl.class)); assertThat(ses, instanceOf(ManagedScheduledExecutorServiceImpl.class)); assertThat(ces, instanceOf(ContextServiceImpl.class)); assertThat(tf, instanceOf(ManagedThreadFactoryImpl.class)); }