Search in sources :

Example 1 with Futureable

use of org.apache.deltaspike.core.api.future.Futureable in project deltaspike by apache.

the class DefaultFutureableStrategy method getOrCreatePool.

protected ExecutorService getOrCreatePool(final InvocationContext ic) {
    final Method method = ic.getMethod();
    ExecutorService executorService = configByMethod.get(method);
    if (executorService == null) {
        final AnnotatedType<?> annotatedType = beanManager.createAnnotatedType(method.getDeclaringClass());
        final AnnotatedMethod<?> annotatedMethod = AnnotatedMethods.findMethod(annotatedType, method);
        final Futureable methodConfig = annotatedMethod.getAnnotation(Futureable.class);
        final ExecutorService instance = manager.find((methodConfig == null ? annotatedType.getAnnotation(Futureable.class) : methodConfig).value());
        configByMethod.putIfAbsent(method, instance);
        executorService = instance;
    }
    return executorService;
}
Also used : ExecutorService(java.util.concurrent.ExecutorService) Method(java.lang.reflect.Method) AnnotatedMethod(javax.enterprise.inject.spi.AnnotatedMethod) Futureable(org.apache.deltaspike.core.api.future.Futureable)

Aggregations

Method (java.lang.reflect.Method)1 ExecutorService (java.util.concurrent.ExecutorService)1 AnnotatedMethod (javax.enterprise.inject.spi.AnnotatedMethod)1 Futureable (org.apache.deltaspike.core.api.future.Futureable)1