/** * send client context with the request. The sendingRequest method of the * JPortableInterceptors is called prior to marshalling arguments and * contexts * @param JClientRequestInfo jri the jrmp client info * @exception IOException if an exception occur with the ObjectOutput */ public void sendRequest(final JClientRequestInfo jri) throws IOException { // Gets Current object (always existing in JOnAS Server) SecurityCurrent current = SecurityCurrent.getCurrent(); if (current != null) { // Get the Security Context SecurityContext ctx = current.getSecurityContext(); SecurityServiceContext ssc = new SecurityServiceContext(SEC_CTX_ID, ctx); jri.addRequestServiceContext(ssc); } }
/** * send client context with the request. The sendingRequest method of the JPortableInterceptors * is called prior to marshalling arguments and contexts * @param jri JClientRequestInfo the jrmp client info * @exception IOException if an exception occur with the ObjectOutput */ public void sendRequest(JClientRequestInfo jri) throws IOException { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAClientTransactionInterceptor.sendRequest"); } try { if (current == null) { current = Current.getCurrent(); } if (current != null) { // get the Transaction Context (null if there is no transaction) TransactionContext txCtx = current.getPropagationContext(true); if (txCtx != null) { JTATransactionServiceContext jtasc = new JTATransactionServiceContext(); jtasc.setContext(txCtx, false); jri.addRequestServiceContext(jtasc); } } } catch (Exception e) { e.printStackTrace(); } }
public void receive(final byte code, final ObjectInput in) throws IOException, ClassNotFoundException { JClientRequestInfo info = new JRMPClientRequestInfoImpl(); int len = in.readShort(); for (int i = 0; i < len; i++) { info.addRequestServiceContext((JServiceContext) in.readObject()); } for (JClientRequestInterceptor ci : cis) { switch (code) { case METHOD_RESULT: ci.receiveReply(info); break; case METHOD_ERROR: case SYSTEM_ERROR: ci.receiveException(info); break; } } }
jrc.addRequestServiceContext((JServiceContext) in.readObject());
/** * Constructs the HAContext with the required replication information on * the client side */ public void sendRequest(final JClientRequestInfo jri) throws IOException { // Get the current HA Context info associated to the thread HACurrent current = HACurrent.getHACurrent(); // Fill the "req_id" field to propagate through the interceptor if the // nextReq has been included in the HA current context (held in the // thread-local variable) by the stub HAContext newHACtx = new HAContext(); Stack<RequestId> requests = current.getRequests(); newHACtx.setRequests(requests); newHACtx.setOnFailover(current.isOnFailover()); logger.debug("Propagating requests chain: " + newHACtx); // Create the new HAContext to propagate between interceptors HAServiceContext haServiceContext = new HAServiceContext(newHACtx); // Finally, include the new HAContext created to be propagated through // the interceptor jri.addRequestServiceContext(haServiceContext); }