javax.enterprise.concurrent.ManagedExecutorService Java Examples
The following examples show how to use
javax.enterprise.concurrent.ManagedExecutorService.
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: CustomInjectionTest.java From tomee with Apache License 2.0 | 6 votes |
private static void doCheck(final ManagedExecutorService es, final ManagedScheduledExecutorService ses, final ManagedThreadFactory tf) { assertNotNull(es); assertNotNull(ses); assertNotNull(tf); assertThat(es, instanceOf(ManagedExecutorServiceImpl.class)); assertEquals(2, pool(es).getCorePoolSize()); assertEquals(10, pool(es).getMaximumPoolSize()); assertEquals(4, pool(es).getKeepAliveTime(TimeUnit.MINUTES)); assertThat(ses, instanceOf(ManagedScheduledExecutorServiceImpl.class)); assertEquals(12, pool(ses).getCorePoolSize()); assertThat(tf, instanceOf(ManagedThreadFactoryImpl.class)); assertEquals("custom-", Reflections.get(tf, "prefix")); }
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)); }
Example #3
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 #4
Source File: ManagedTaskListenerTask.java From tomee with Apache License 2.0 | 5 votes |
@Override public void taskSubmitted(final Future<?> future, final ManagedExecutorService executor, final Object task) { this.future = future; this.executor = executor; if (listener != null) { listener.taskSubmitted(future, executor, task); } }
Example #5
Source File: ManagedTaskListenerTask.java From tomee with Apache License 2.0 | 5 votes |
@Override public void taskAborted(final Future<?> future, final ManagedExecutorService executor, final Object task, final Throwable exception) { if (listener != null) { // use saved values since called with null excepted for the exception listener.taskAborted(this.future, this.executor, this.delegate, exception); } }
Example #6
Source File: AsyncTask.java From javaee8-cookbook with Apache License 2.0 | 4 votes |
@Override public void taskAborted(Future<?> future, ManagedExecutorService mes, Object o, Throwable thrwbl) { long mili = new Date().getTime(); LOG.log(Level.INFO, "taskAborted: {0} - Miliseconds since instantiation: {1}", new Object[]{future, mili - instantiationMili}); }
Example #7
Source File: CustomInjectionTest.java From tomee with Apache License 2.0 | 4 votes |
private static ThreadPoolExecutor pool(final ManagedExecutorService es) { return ThreadPoolExecutor.class.cast(ManagedExecutorServiceImpl.class.cast(es).getDelegate()); }
Example #8
Source File: ManagedTaskListenerTask.java From tomee with Apache License 2.0 | 4 votes |
@Override public void taskStarting(final Future<?> future, final ManagedExecutorService executor, final Object task) { // no-op }
Example #9
Source File: ManagedTaskListenerTask.java From tomee with Apache License 2.0 | 4 votes |
@Override public void taskDone(final Future<?> future, final ManagedExecutorService executor, final Object task, final Throwable exception) { // no-op }
Example #10
Source File: ManagedTaskListenerTask.java From tomee with Apache License 2.0 | 4 votes |
@Override public void taskAborted(final Future<?> future, final ManagedExecutorService executor, final Object task, final Throwable exception) { // no-op }
Example #11
Source File: ManagedTaskListenerTask.java From tomee with Apache License 2.0 | 4 votes |
@Override public void taskSubmitted(final Future<?> future, final ManagedExecutorService executor, final Object task) { // no-op }
Example #12
Source File: ManagedTaskListenerTask.java From tomee with Apache License 2.0 | 4 votes |
@Override public void taskStarting(final Future<?> future, final ManagedExecutorService executor, final Object task) { if (listener != null) { listener.taskStarting(future, executor, task); } }
Example #13
Source File: ManagedTaskListenerTask.java From tomee with Apache License 2.0 | 4 votes |
@Override public void taskDone(final Future<?> future, final ManagedExecutorService executor, final Object task, final Throwable exception) { if (listener != null) { listener.taskDone(future, executor, task, exception); } }
Example #14
Source File: TaskListener.java From packt-java-ee-7-code-samples with GNU General Public License v2.0 | 4 votes |
@Override public void taskStarting(Future<?> future, ManagedExecutorService executor, Object task) { logger.info("Starting " + task); }
Example #15
Source File: TaskListener.java From packt-java-ee-7-code-samples with GNU General Public License v2.0 | 4 votes |
@Override public void taskDone(Future<?> future, ManagedExecutorService executor, Object task, Throwable exception) { logger.info("Finished task " + task); }
Example #16
Source File: TaskListener.java From packt-java-ee-7-code-samples with GNU General Public License v2.0 | 4 votes |
@Override public void taskAborted(Future<?> future, ManagedExecutorService executor, Object task, Throwable exception) { logger.log(Level.WARNING, "Aborted", exception); }
Example #17
Source File: TaskListener.java From packt-java-ee-7-code-samples with GNU General Public License v2.0 | 4 votes |
@Override public void taskSubmitted(Future<?> future, ManagedExecutorService executor, Object task) { logger.info("Submitted " + task); }
Example #18
Source File: ServiceClient.java From thorntail with Apache License 2.0 | 4 votes |
default ManagedExecutorService executorService() throws Exception { InitialContext ctx = new InitialContext(); return (ManagedExecutorService) ctx.lookup("java:jboss/ee/concurrency/executor/default"); }
Example #19
Source File: AsyncTask.java From javaee8-cookbook with Apache License 2.0 | 4 votes |
@Override public void taskStarting(Future<?> future, ManagedExecutorService mes, Object o) { long mili = new Date().getTime(); LOG.log(Level.INFO, "taskStarting: {0} - Miliseconds since instantiation: {1}", new Object[]{future, mili - instantiationMili}); }
Example #20
Source File: AsyncTask.java From javaee8-cookbook with Apache License 2.0 | 4 votes |
@Override public void taskDone(Future<?> future, ManagedExecutorService mes, Object o, Throwable thrwbl) { long mili = new Date().getTime(); LOG.log(Level.INFO, "taskDone: {0} - Miliseconds since instantiation: {1}", new Object[]{future, mili - instantiationMili}); }
Example #21
Source File: AsyncTask.java From javaee8-cookbook with Apache License 2.0 | 4 votes |
@Override public void taskSubmitted(Future<?> future, ManagedExecutorService mes, Object o) { long mili = new Date().getTime(); LOG.log(Level.INFO, "taskSubmitted: {0} - Miliseconds since instantiation: {1}", new Object[]{future, mili - instantiationMili}); }
Example #22
Source File: ManagedJobExecutor.java From camunda-bpm-platform with Apache License 2.0 | 2 votes |
/** * Constructs a new ManagedJobExecutor with the provided * {@link ManagedExecutorService} */ public ManagedJobExecutor(final ManagedExecutorService managedExecutorService) { this.managedExecutorService = managedExecutorService; }