protected abstract Object remove(Class interfce, Method method, Object[] args, Object proxy) throws Throwable;
protected Object businessMethod(final Class<?> interfce, final Method method, final Object[] args, final Object proxy) throws Throwable {
final BeanContext beanContext = getBeanContext();
final AsynchronousPool asynchronousPool = beanContext.getModuleContext().getAppContext().getAsynchronousPool();
if (beanContext.isAsynchronous(method)) {
final SecurityService<?> securityService = SystemInstance.get().getComponent(SecurityService.class);
final Object state = securityService.currentState();
final ThreadContext currentCtx = ThreadContext.getThreadContext();
return asynchronousPool.invoke(new Callable<Object>() {
@Override
public Object call() throws Exception {
final ThreadContext oldCtx; // ensure context is the same as for the caller
if (currentCtx != null) {
oldCtx = ThreadContext.enter(new ThreadContext(currentCtx));