static EJBClientInterceptorInformation forInstance(final EJBClientInterceptor interceptor) { final EJBClientInterceptorInformation classInfo = CLASS_VALUE.get(interceptor.getClass()); try { if (classInfo.getInterceptorInstance() == interceptor) { return classInfo; } } catch (Exception ignored) {} return new EJBClientInterceptorInformation(interceptor, classInfo.priority); }
public Builder addInterceptor(Class<? extends EJBClientInterceptor> interceptorClass) { Assert.checkNotNullParam("interceptorClass", interceptorClass); if (globalInterceptors == null) { globalInterceptors = new ArrayList<>(); } globalInterceptors.add(EJBClientInterceptorInformation.forClass(interceptorClass)); return this; }
public Builder addInterceptor(EJBClientInterceptor interceptor) { Assert.checkNotNullParam("interceptor", interceptor); if (globalInterceptors == null) { globalInterceptors = new ArrayList<>(); } globalInterceptors.add(EJBClientInterceptorInformation.forInstance(interceptor)); return this; }
private EJBClientContext.InterceptorList getInterceptorsFromAnnotation(final ClientInterceptors classClientInterceptors) { if (classClientInterceptors != null) { final Class<?>[] interceptorClasses = classClientInterceptors.value(); final int length = interceptorClasses.length; if (length == 0) { return EJBClientContext.InterceptorList.EMPTY; } else if (length == 1) { return EJBClientInterceptorInformation.forClass(interceptorClasses[0]).getSingletonList(); } else { final EJBClientInterceptorInformation[] interceptors = new EJBClientInterceptorInformation[length]; for (int i = 0; i < length; i++) { interceptors[i] = EJBClientInterceptorInformation.forClass(interceptorClasses[i]); } return new EJBClientContext.InterceptorList(interceptors); } } else { return EJBClientContext.InterceptorList.EMPTY; } }
result = resultProducer.getResult(); } else { result = chain[idx].getInterceptorInstance().handleInvocationResult(this);
private static InterceptorList ofList(final ArrayList<EJBClientInterceptorInformation> value) { if (value.isEmpty()) { return EMPTY; } else if (value.size() == 1) { return value.get(0).getSingletonList(); } else { return new InterceptorList(value.toArray(EJBClientInterceptorInformation.NO_INTERCEPTORS)); } }
protected EJBClientInterceptorInformation computeValue(final Class<?> type) { final Class<? extends EJBClientInterceptor> subclass = type.asSubclass(EJBClientInterceptor.class); final ClientInterceptorPriority annotation = ENABLE_SCANNING ? subclass.getAnnotation(ClientInterceptorPriority.class) : null; final int priority = annotation != null ? annotation.value() : 0; return new EJBClientInterceptorInformation(subclass, priority); } };
private EJBClientContext.InterceptorList getInterceptorsFromAnnotation(final ClientInterceptors classClientInterceptors) { if (classClientInterceptors != null) { final Class<?>[] interceptorClasses = classClientInterceptors.value(); final int length = interceptorClasses.length; if (length == 0) { return EJBClientContext.InterceptorList.EMPTY; } else if (length == 1) { return EJBClientInterceptorInformation.forClass(interceptorClasses[0]).getSingletonList(); } else { final EJBClientInterceptorInformation[] interceptors = new EJBClientInterceptorInformation[length]; for (int i = 0; i < length; i++) { interceptors[i] = EJBClientInterceptorInformation.forClass(interceptorClasses[i]); } return new EJBClientContext.InterceptorList(interceptors); } } else { return EJBClientContext.InterceptorList.EMPTY; } }
/** * Proceed with the next interceptor in the chain, calling the resolved receiver in the end. * * @return the session ID (not {@code null}) * @throws Exception if the EJB session creation failed for some reason */ public SessionID proceed() throws Exception { final int idx = interceptorChainIndex++; try { final EJBClientInterceptorInformation[] chain = interceptorList.getInformation(); if (idx > chain.length) { throw Assert.unreachableCode(); } if (chain.length == idx) { final URI destination = getDestination(); final EJBReceiver receiver = getClientContext().resolveReceiver(destination, getLocator()); setReceiver(receiver); final SessionID sessionID = receiver.createSession(new EJBReceiverSessionCreationContext(this, authenticationContext)); if (sessionID == null) { throw Logs.INVOCATION.nullSessionID(receiver, getLocator().asStateless()); } retry = false; return sessionID; } else { return chain[idx].getInterceptorInstance().handleSessionCreation(this); } } finally { interceptorChainIndex --; } }
this.globalInterceptors = first.getSingletonList();
protected EJBClientInterceptorInformation computeValue(final Class<?> type) { final Class<? extends EJBClientInterceptor> subclass = type.asSubclass(EJBClientInterceptor.class); final ClientInterceptorPriority annotation = ENABLE_SCANNING ? subclass.getAnnotation(ClientInterceptorPriority.class) : null; final int priority = annotation != null ? annotation.value() : 0; return new EJBClientInterceptorInformation(subclass, priority); } };
static EJBClientInterceptorInformation forInstance(final EJBClientInterceptor interceptor) { final EJBClientInterceptorInformation classInfo = CLASS_VALUE.get(interceptor.getClass()); try { if (classInfo.getInterceptorInstance() == interceptor) { return classInfo; } } catch (Exception ignored) {} return new EJBClientInterceptorInformation(interceptor, classInfo.priority); }
private InterceptorList registeredInterceptors() { final EJBClientInterceptor.Registration[] currentRegistrations = this.registrations.clone(); ArrayList<EJBClientInterceptorInformation> al = new ArrayList<>(); for (EJBClientInterceptor.Registration r: currentRegistrations) { al.add(EJBClientInterceptorInformation.forInstance(r.getInterceptor())); } return InterceptorList.ofList(al); }
public Builder addClassInterceptor(String className, Class<? extends EJBClientInterceptor> interceptorClass) { Assert.checkNotNullParam("className", className); Assert.checkNotNullParam("interceptorClass", interceptorClass); if (classInterceptors == null) { classInterceptors = new ArrayList<>(); } classInterceptors.add(new ClassInterceptor(className, EJBClientInterceptorInformation.forClass(interceptorClass))); return this; }
private EJBClientContext.InterceptorList getInterceptorsFromAnnotation(final ClientInterceptors classClientInterceptors) { if (classClientInterceptors != null) { final Class<?>[] interceptorClasses = classClientInterceptors.value(); final int length = interceptorClasses.length; if (length == 0) { return EJBClientContext.InterceptorList.EMPTY; } else if (length == 1) { return EJBClientInterceptorInformation.forClass(interceptorClasses[0]).getSingletonList(); } else { final EJBClientInterceptorInformation[] interceptors = new EJBClientInterceptorInformation[length]; for (int i = 0; i < length; i++) { interceptors[i] = EJBClientInterceptorInformation.forClass(interceptorClasses[i]); } return new EJBClientContext.InterceptorList(interceptors); } } else { return EJBClientContext.InterceptorList.EMPTY; } }
chain[idx].getInterceptorInstance().handleInvocation(this); } catch (Throwable t) { synchronized (lock) {
private static InterceptorList ofList(final ArrayList<EJBClientInterceptorInformation> value) { if (value.isEmpty()) { return EMPTY; } else if (value.size() == 1) { return value.get(0).getSingletonList(); } else { return new InterceptorList(value.toArray(EJBClientInterceptorInformation.NO_INTERCEPTORS)); } }
protected EJBClientInterceptorInformation computeValue(final Class<?> type) { final Class<? extends EJBClientInterceptor> subclass = type.asSubclass(EJBClientInterceptor.class); final ClientInterceptorPriority annotation = ENABLE_SCANNING ? subclass.getAnnotation(ClientInterceptorPriority.class) : null; final int priority = annotation != null ? annotation.value() : 0; return new EJBClientInterceptorInformation(subclass, priority); } };
static EJBClientInterceptorInformation forInstance(final EJBClientInterceptor interceptor) { final EJBClientInterceptorInformation classInfo = CLASS_VALUE.get(interceptor.getClass()); try { if (classInfo.getInterceptorInstance() == interceptor) { return classInfo; } } catch (Exception ignored) {} return new EJBClientInterceptorInformation(interceptor, classInfo.priority); }
public Builder addClassInterceptor(String className, EJBClientInterceptor interceptor) { Assert.checkNotNullParam("className", className); Assert.checkNotNullParam("interceptor", interceptor); if (classInterceptors == null) { classInterceptors = new ArrayList<>(); } classInterceptors.add(new ClassInterceptor(className, EJBClientInterceptorInformation.forInstance(interceptor))); return this; }