@ClientInterceptorPriority(RemotingEJBClientInterceptor.PRIORITY) public final class RemotingEJBClientInterceptor implements EJBClientInterceptor {
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); } };
classCompressRequest = classCompressResponse = false; } else { classCompressionLevel = classCompressionHint.compressionLevel() == -1 ? Deflater.DEFAULT_COMPRESSION : classCompressionHint.compressionLevel(); classCompressRequest = classCompressionHint.compressRequest(); classCompressResponse = classCompressionHint.compressResponse(); compressResponse = classCompressResponse; } else { compressionLevel = compressionHint.compressionLevel() == -1 ? Deflater.DEFAULT_COMPRESSION : compressionHint.compressionLevel(); compressRequest = compressionHint.compressRequest(); compressResponse = compressionHint.compressResponse(); transactionPolicy = transactionHint != null ? transactionHint.value() : clientAsync ? ClientTransactionPolicy.NOT_SUPPORTED : classTransactionHint != null ? classTransactionHint.value() : ClientTransactionPolicy.SUPPORTS;
public void handleInvocation(final EJBClientInvocationContext context) throws Exception { final ClientTransactionPolicy transactionPolicy = context.getTransactionPolicy(); AbstractTransaction transaction = context.getTransaction(); // Always prefer the context TX, as the caller TX might be wrong // (e.g. retries happen in worker thread, not caller thread) if (transaction == null) { transaction = transactionManager.getTransaction(); } setupStickinessIfRequired(context, transactionPolicy.propagate(), transaction); if (transactionPolicy.failIfTransactionAbsent()) { if (transaction == null) { throw Logs.TXN.txNotActiveForThread(); } } if (transactionPolicy.failIfTransactionPresent()) { if (transaction != null) { throw Logs.TXN.txAlreadyAssociatedWithThread(); } } if (transactionPolicy.propagate()) { context.setTransaction(transaction); } // Hide any caller TX from other interceptors Transaction old = transactionManager.suspend(); try { context.sendRequest(); } finally { transactionManager.resume(old); } }
if(compressionHint.compressResponse()) { responseCompressLevel = compressionHint.compressionLevel();
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; } }
@ClientInterceptorPriority(TransactionPostDiscoveryInterceptor.PRIORITY) public final class TransactionPostDiscoveryInterceptor implements EJBClientInterceptor { private static final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance();
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; } }
@ClientInterceptorPriority(NamingEJBClientInterceptor.PRIORITY) public final class NamingEJBClientInterceptor implements EJBClientInterceptor {
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; } }
@ClientInterceptorPriority(TransactionInterceptor.PRIORITY) public final class TransactionInterceptor implements EJBClientInterceptor { private static final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance();
@ClientInterceptorPriority(DiscoveryEJBClientInterceptor.PRIORITY) public final class DiscoveryEJBClientInterceptor implements EJBClientInterceptor { private static final Supplier<Discovery> DISCOVERY_SUPPLIER = doPrivileged((PrivilegedAction<Supplier<Discovery>>) Discovery.getContextManager()::getPrivilegedSupplier);
@ClientInterceptorPriority(RemotingEJBClientInterceptor.PRIORITY) public final class RemotingEJBClientInterceptor implements EJBClientInterceptor {
@ClientInterceptorPriority(RemotingEJBClientInterceptor.PRIORITY) public final class RemotingEJBClientInterceptor implements EJBClientInterceptor {
@ClientInterceptorPriority(TransactionPostDiscoveryInterceptor.PRIORITY) public final class TransactionPostDiscoveryInterceptor implements EJBClientInterceptor { private static final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance();
@ClientInterceptorPriority(TransactionPostDiscoveryInterceptor.PRIORITY) public final class TransactionPostDiscoveryInterceptor implements EJBClientInterceptor { private static final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance();
@ClientInterceptorPriority(TransactionInterceptor.PRIORITY) public final class TransactionInterceptor implements EJBClientInterceptor { private static final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance();
@ClientInterceptorPriority(NamingEJBClientInterceptor.PRIORITY) public final class NamingEJBClientInterceptor implements EJBClientInterceptor {