Search in sources :

Example 1 with CUCallable

use of org.apache.openejb.threads.task.CUCallable in project tomee by apache.

the class EjbHomeProxyHandler method homeMethod.

/*-------------------------------------------------*/
/*  Home interface methods                         */
/*-------------------------------------------------*/
protected Object homeMethod(final Class interfce, final Method method, final Object[] args, final Object proxy) throws Throwable {
    checkAuthorization(method);
    final BeanContext beanContext = getBeanContext();
    if (beanContext.isAsynchronous(method)) {
        return beanContext.getModuleContext().getAppContext().getAsynchronousPool().invoke(new CUCallable<Object>(new Callable<Object>() {

            @Override
            public Object call() throws Exception {
                try {
                    return homeMethodInvoke(interfce, method, args);
                } catch (final ApplicationException ae) {
                    logger.error("EjbHomeProxyHandler: Asynchronous call to '" + interfce.getSimpleName() + "' on '" + method.getName() + "' failed", ae);
                    throw ae;
                }
            }
        }), method.getReturnType() == Void.TYPE);
    } else {
        return homeMethodInvoke(interfce, method, args);
    }
}
Also used : BeanContext(org.apache.openejb.BeanContext) ApplicationException(org.apache.openejb.ApplicationException) Callable(java.util.concurrent.Callable) CUCallable(org.apache.openejb.threads.task.CUCallable)

Aggregations

Callable (java.util.concurrent.Callable)1 ApplicationException (org.apache.openejb.ApplicationException)1 BeanContext (org.apache.openejb.BeanContext)1 CUCallable (org.apache.openejb.threads.task.CUCallable)1