public void receive(final byte code, final ObjectInput in) throws IOException, ClassNotFoundException { JServerRequestInfo info = new JRMPServerRequestInfoImpl(); int len = in.readShort(); for (int i = 0; i < len; i++) { info.addReplyServiceContext((JServiceContext) in.readObject()); } for (JServerRequestInterceptor si : sis) { si.receiveRequest(info); } }
/** * Receive request * @param jri JServerRequestInfo the jrmp server request information * @exception IOException if an exception occur with the ObjectOutput */ public void receiveRequest(JServerRequestInfo jri) throws IOException { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAServerTransactionInterceptor.receive_request"); } // log.trace("--> receive request"); if (current == null) { current = Current.getCurrent(); } if (current != null) { JTATransactionServiceContext jtasc = (JTATransactionServiceContext) jri.getRequestServiceContext( TX_CTX_ID); if (jtasc != null) { // put into the the Current object (true for client side context current.setPropagationContext( jtasc.getTransactionContext(), false); } } }
int sz = in.readInt(); for (int i = 0; i < sz; i++) { jsr.addReplyServiceContext((JServiceContext) in.readObject()); TraceCarol.debugRmiCarol("JServerInterceptorHelper receive remote contexts"); for (JServiceContext jsc : jsr.getAllReplyServiceContext()) { TraceCarol.debugRmiCarol("ctx:" + jsc); jsr.addAllReplyServiceContext((Collection<JServiceContext>) JContextStore.getObject(id)); for (JServiceContext jsc : jsr.getAllReplyServiceContext()) { TraceCarol.debugRmiCarol("ctx:" + jsc);
if (!ri.hasContexts()) { if (TraceCarol.isDebugRmiCarol()) { TraceCarol.debugRmiCarol("JServerInterceptorHelper send without contexts"); } else if (locRef) { Object ctx = ri.getAllReplyServiceContext(); int k = JContextStore.storeObject(ctx); out.writeInt(LOCAL_CTX); Collection<JServiceContext> allCtx = ri.getAllReplyServiceContext(); out.writeInt(allCtx.size()); for (JServiceContext jsc : allCtx) {
public void send(final byte code, final ObjectOutput out) throws IOException { JServerRequestInfo info = new JRMPServerRequestInfoImpl(); for (JServerRequestInterceptor si : sis) { switch (code) { case METHOD_RESULT: si.sendReply(info); break; case METHOD_ERROR: case SYSTEM_ERROR: si.sendException(info); break; } } Collection<JServiceContext> c = info.getAllReplyServiceContext(); out.writeShort(c.size()); for (JServiceContext jServiceContext : c) { out.writeObject(jServiceContext); } }
public void sendException(JServerRequestInfo jri) throws IOException { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAServerTransactionInterceptor.sendException"); } if (current == null) { current = Current.getCurrent(); } if (current != null) { // get the Transaction Context (null if there is no transaction) TransactionContext txCtx = current.getPropagationContext(false); if (txCtx != null) { JTATransactionServiceContext jtasc = new JTATransactionServiceContext(); jtasc.setContext(txCtx, true); jri.addReplyServiceContext(jtasc); current.setPropagationContext(null, false); } } }
/** * Receive request * @param JServerRequestInfo the jrmp server request information * @exception IOException if an exception occurs with the ObjectOutput */ public void receiveRequest(final JServerRequestInfo jri) throws IOException { // Gets SecurityCurrent object (always existing in JOnAS Server) SecurityCurrent current = SecurityCurrent.getCurrent(); if (current != null) { SecurityServiceContext sctx = (SecurityServiceContext) jri.getRequestServiceContext(SEC_CTX_ID); if (sctx != null) { // put into the the Current object (true for client side context current.setSecurityContext(sctx.getSecurityContext()); } } }
public void sendOther(JServerRequestInfo jri) throws IOException { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAServerTransactionInterceptor.sendOther"); } if (current == null) { current = Current.getCurrent(); } if (current != null) { // get the Transaction Context (null if there is no transaction) TransactionContext txCtx = current.getPropagationContext(false); if (txCtx != null) { JTATransactionServiceContext jtasc = new JTATransactionServiceContext(); jtasc.setContext(txCtx, true); jri.addReplyServiceContext(jtasc); current.setPropagationContext(null, false); } } // log.trace("<-- sent other"); } }
/** * Analyzes the HAContext received and constructs the required * context on the HA current context (the thread associated class) on * the server side. */ public void receiveRequest(final JServerRequestInfo jri) throws IOException { // Get the HAContext from the received info HAServiceContext receivedCtx = (HAServiceContext) jri.getRequestServiceContext(HAServiceContext.HA_CTX_ID); if(receivedCtx == null) { return; } logger.debug(receivedCtx.toString()); // Get the current Thread/HAContext association class HACurrent current = HACurrent.getHACurrent(); HAContext haContext = (HAContext) receivedCtx.getContextData(); Stack<RequestId> requests = haContext.getRequests(); current.setRequests(requests); boolean onFailover = haContext.isOnFailover(); current.setOnFailover(onFailover); logger.debug("HACtx asocciated to Thread"); }
/** * send reply with context * @param jri JServerRequestInfo the jrmp server request information * @exception IOException if an exception occur with the ObjectOutput */ public void sendReply(JServerRequestInfo jri) throws IOException { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAServerTransactionInterceptor.send_reply"); } if (current == null) { current = Current.getCurrent(); } if (current != null) { // get the Transaction Context (null if there is no transaction) TransactionContext txCtx = current.getPropagationContext(false); if (txCtx != null) { JTATransactionServiceContext jtasc = new JTATransactionServiceContext(); jtasc.setContext(txCtx, true); jri.addReplyServiceContext(jtasc); current.setPropagationContext(null, false); } } }
private void putHAContext(final JServerRequestInfo jri) { // Get the current HA Context info associated to the thread HACurrent current = HACurrent.getHACurrent(); HAContext haContext = new HAContext(); Stack<RequestId> requests = current.getRequests(); haContext.setRequests(requests); logger.debug("newHACtx: " + haContext); // Create the new HAContext to propagate between interceptors HAServiceContext haServiceContext = new HAServiceContext(haContext); // Finally, include the new HAContext created to be propagated through // the interceptor jri.addReplyServiceContext(haServiceContext); } }