private void marshalEJBRequest(ByteOutput byteOutput, EJBClientInvocationContext clientInvocationContext, HttpTargetContext targetContext) throws IOException, RollbackException, SystemException { MarshallingConfiguration config = createMarshallingConfig(targetContext.getUri()); Marshaller marshaller = targetContext.createMarshaller(config); marshaller.start(byteOutput); writeTransaction(clientInvocationContext.getTransaction(), marshaller, targetContext.getUri()); Object[] methodParams = clientInvocationContext.getParameters(); if (methodParams != null && methodParams.length > 0) { for (final Object methodParam : methodParams) { marshaller.writeObject(methodParam); } } // write out the context data final Map<String, Object> contextData = clientInvocationContext.getContextData(); // no private or public data to write out if (contextData == null) { marshaller.writeByte(0); } else { final int totalAttachments = contextData.size(); PackedInteger.writePackedInteger(marshaller, totalAttachments); // write out public (application specific) context data for (Map.Entry<String, Object> invocationContextData : contextData.entrySet()) { marshaller.writeObject(invocationContextData.getKey()); marshaller.writeObject(invocationContextData.getValue()); } } // finish marshalling marshaller.finish(); }
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); } }
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); } }
interceptorContext.setParameters(parameters); interceptorContext.setMethod(method); interceptorContext.setTransaction(invocation.getTransaction()); interceptorContext.setTarget(invocation.getInvokedProxy());
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); } }
invocation.setOutflowHandle(writeTransaction(invocationContext.getTransaction(), marshaller)); final Transaction transaction = invocationContext.getTransaction();
private void marshalEJBRequest(ByteOutput byteOutput, EJBClientInvocationContext clientInvocationContext, HttpTargetContext targetContext) throws IOException, RollbackException, SystemException { MarshallingConfiguration config = createMarshallingConfig(targetContext.getUri()); Marshaller marshaller = targetContext.createMarshaller(config); marshaller.start(byteOutput); writeTransaction(clientInvocationContext.getTransaction(), marshaller, targetContext.getUri()); Object[] methodParams = clientInvocationContext.getParameters(); if (methodParams != null && methodParams.length > 0) { for (final Object methodParam : methodParams) { marshaller.writeObject(methodParam); } } // write out the context data final Map<String, Object> contextData = clientInvocationContext.getContextData(); // no private or public data to write out if (contextData == null) { marshaller.writeByte(0); } else { final int totalAttachments = contextData.size(); PackedInteger.writePackedInteger(marshaller, totalAttachments); // write out public (application specific) context data for (Map.Entry<String, Object> invocationContextData : contextData.entrySet()) { marshaller.writeObject(invocationContextData.getKey()); marshaller.writeObject(invocationContextData.getValue()); } } // finish marshalling marshaller.finish(); }
private void marshalEJBRequest(ByteOutput byteOutput, EJBClientInvocationContext clientInvocationContext, HttpTargetContext targetContext) throws IOException, RollbackException, SystemException { MarshallingConfiguration config = createMarshallingConfig(targetContext.getUri()); Marshaller marshaller = targetContext.createMarshaller(config); marshaller.start(byteOutput); writeTransaction(clientInvocationContext.getTransaction(), marshaller, targetContext.getUri()); Object[] methodParams = clientInvocationContext.getParameters(); if (methodParams != null && methodParams.length > 0) { for (final Object methodParam : methodParams) { marshaller.writeObject(methodParam); } } // write out the context data final Map<String, Object> contextData = clientInvocationContext.getContextData(); // no private or public data to write out if (contextData == null) { marshaller.writeByte(0); } else { final int totalAttachments = contextData.size(); PackedInteger.writePackedInteger(marshaller, totalAttachments); // write out public (application specific) context data for (Map.Entry<String, Object> invocationContextData : contextData.entrySet()) { marshaller.writeObject(invocationContextData.getKey()); marshaller.writeObject(invocationContextData.getValue()); } } // finish marshalling marshaller.finish(); }
invocation.setOutflowHandle(writeTransaction(invocationContext.getTransaction(), marshaller)); final Transaction transaction = invocationContext.getTransaction();
invocation.setOutflowHandle(writeTransaction(invocationContext.getTransaction(), marshaller)); final Transaction transaction = invocationContext.getTransaction();