use of com.sun.enterprise.deployment.InterceptorDescriptor in project Payara by payara.
the class BeanCallbackInterceptor method getAroundTimeoutChain.
public InterceptorManager.InterceptorChain getAroundTimeoutChain(MethodDescriptor mDesc, Method beanMethod) {
ArrayList<AroundInvokeInterceptor> interceptors = new ArrayList<AroundInvokeInterceptor>();
for (InterceptorDescriptor interceptor : frameworkInterceptors) {
Set<LifecycleCallbackDescriptor> aroundTimeoutDescs = interceptor.getAroundTimeoutDescriptors();
if (aroundTimeoutDescs.isEmpty()) {
continue;
}
List<LifecycleCallbackDescriptor> orderedAIInterceptors = null;
Class interceptorClass = interceptor.getInterceptorClass();
ClassLoader classLoaderToUse = (interceptorClass != null) ? interceptorClass.getClassLoader() : loader;
try {
orderedAIInterceptors = interceptor.getOrderedAroundTimeoutDescriptors(classLoaderToUse);
} catch (Exception e) {
throw new IllegalStateException("No AroundTimeoutIntercetpors found " + " on class " + interceptor.getInterceptorClassName(), e);
}
addAroundInvokeInterceptors(interceptors, interceptor, orderedAIInterceptors, interceptor.getInterceptorClassName(), classLoaderToUse);
}
List<EjbInterceptor> list = (ejbDesc != null) ? ejbDesc.getAroundTimeoutInterceptors(mDesc) : new LinkedList<EjbInterceptor>();
for (EjbInterceptor interceptor : list) {
String className = interceptor.getInterceptorClassName();
Set<LifecycleCallbackDescriptor> aroundTimeoutDescs = interceptor.getAroundTimeoutDescriptors();
if (aroundTimeoutDescs.isEmpty()) {
continue;
}
List<LifecycleCallbackDescriptor> orderedATInterceptors;
try {
orderedATInterceptors = interceptor.getOrderedAroundTimeoutDescriptors(loader);
} catch (Exception e) {
throw new IllegalStateException("No AroundTimeoutIntercetpors found " + " on class " + className, e);
}
addAroundInvokeInterceptors(interceptors, interceptor, orderedATInterceptors, className, loader);
}
AroundInvokeInterceptor[] inter = interceptors.toArray(new AroundInvokeInterceptor[interceptors.size()]);
return new AroundInvokeChainImpl(inter);
}
use of com.sun.enterprise.deployment.InterceptorDescriptor in project Payara by payara.
the class BeanCallbackInterceptor method initCallbackIndices.
private void initCallbackIndices(List<InterceptorDescriptor> callbackList, CallbackType callbackType) throws Exception {
ArrayList<CallbackInterceptor> callbacks = new ArrayList<CallbackInterceptor>();
int index = callbackType.ordinal();
for (InterceptorDescriptor callback : frameworkInterceptors) {
if (callback.hasCallbackDescriptor(callbackType)) {
Class interceptorClass = callback.getInterceptorClass();
ClassLoader classLoaderToUse = (interceptorClass != null) ? interceptorClass.getClassLoader() : loader;
List<CallbackInterceptor> inters = createCallbackInterceptors(callbackType, callback, classLoaderToUse);
for (CallbackInterceptor inter : inters) {
callbacks.add(inter);
}
}
}
for (InterceptorDescriptor callback : callbackList) {
List<CallbackInterceptor> inters = createCallbackInterceptors(callbackType, callback);
for (CallbackInterceptor inter : inters) {
callbacks.add(inter);
}
}
// move above callbackChain = new CallbackChainImpl[size];
CallbackInterceptor[] interceptors = (CallbackInterceptor[]) callbacks.toArray(new CallbackInterceptor[callbacks.size()]);
callbackChain[index] = new CallbackChainImpl(interceptors);
}
Aggregations