Search in sources :

Example 1 with ForwardRequest

use of org.omg.PortableInterceptor.ForwardRequest in project narayana by jbosstm.

the class ClientForwardInterceptor method send_request.

/**
 * Throws a ForwardRequest
 */
public void send_request(ClientRequestInfo ri) throws ForwardRequest {
    String objectIdString = null;
    try {
        RCobjectId = JavaIdlRCServiceInit._poa.reference_to_id(ri.effective_target());
        objectIdString = new String(RCobjectId);
        if (JavaIdlRCServiceInit.RC_ID.equals(objectIdString)) {
            Any indicator = ri.get_slot(IndicatorSlotId);
            if (indicator.type().kind().equals(TCKind.tk_null)) {
                ri.add_request_service_context(RCctx, false);
            }
        }
    } catch (Exception ex) {
        jtsLogger.i18NLogger.warn_orbspecific_jacorb_recoverycoordinators_ClientForwardInterceptor_4(ex);
    }
    if (!in_loop) {
        in_loop = true;
        if (JavaIdlRCServiceInit.RC_ID.equals(objectIdString)) {
            if (ri.effective_target()._is_a(RecoveryCoordinatorHelper.id())) {
                /*
			     * Extract the substring of the ObjectId that contains the Uid and 
			     * the Process Id and pass it to the data of the service context
			     */
                RCobjectId = extractObjectId(objectIdString).getBytes(StandardCharsets.UTF_8);
                RCctx = new ServiceContext(RecoveryContextId, RCobjectId);
                in_loop = false;
                throw new ForwardRequest(reco);
            } else {
                in_loop = false;
            }
        }
        in_loop = false;
    }
}
Also used : ForwardRequest(org.omg.PortableInterceptor.ForwardRequest) ServiceContext(org.omg.IOP.ServiceContext) Any(org.omg.CORBA.Any)

Example 2 with ForwardRequest

use of org.omg.PortableInterceptor.ForwardRequest in project narayana by jbosstm.

the class ClientForwardInterceptor method send_request.

/**
 * Throws a ForwardRequest
 */
public void send_request(ClientRequestInfo ri) throws ForwardRequest {
    String objectIdString = null;
    try {
        RCobjectId = JacOrbRCServiceInit._poa.reference_to_id(ri.effective_target());
        objectIdString = new String(RCobjectId);
        if (objectIdString.compareTo("RecoveryManager") == 0) {
            Any indicator = ri.get_slot(IndicatorSlotId);
            if (indicator.type().kind().equals(TCKind.tk_null)) {
                ri.add_request_service_context(RCctx, false);
            }
        }
    } catch (Exception ex) {
        jtsLogger.i18NLogger.warn_orbspecific_jacorb_recoverycoordinators_ClientForwardInterceptor_4(ex);
    }
    if (!in_loop) {
        in_loop = true;
        if (objectIdString.compareTo("RecoveryManager") != 0) {
            if (ri.effective_target()._is_a(RecoveryCoordinatorHelper.id())) {
                /*
			     * Extract the substring of the ObjectId that contains the Uid and 
			     * the Process Id and pass it to the data of the service context
			     */
                RCobjectId = extractObjectId(objectIdString).getBytes();
                RCctx = new ServiceContext(RecoveryContextId, RCobjectId);
                in_loop = false;
                throw new ForwardRequest(reco);
            } else {
                in_loop = false;
            }
        }
        in_loop = false;
    }
}
Also used : ForwardRequest(org.omg.PortableInterceptor.ForwardRequest) ServiceContext(org.omg.IOP.ServiceContext) Any(org.omg.CORBA.Any)

Example 3 with ForwardRequest

use of org.omg.PortableInterceptor.ForwardRequest in project narayana by jbosstm.

the class ClientForwardInterceptor method send_request.

/**
 * Throws a ForwardRequest
 */
public void send_request(ClientRequestInfo ri) throws ForwardRequest {
    String objectIdString = null;
    try {
        RCobjectId = JavaIdlRCServiceInit._poa.reference_to_id(ri.effective_target());
        objectIdString = new String(RCobjectId);
        if (JavaIdlRCServiceInit.RC_ID.equals(objectIdString)) {
            Any indicator = ri.get_slot(IndicatorSlotId);
            if (indicator.type().kind().equals(TCKind.tk_null)) {
                ri.add_request_service_context(RCctx, false);
            }
        }
    } catch (Exception ex) {
        jtsLogger.i18NLogger.warn_orbspecific_jacorb_recoverycoordinators_ClientForwardInterceptor_4(ex);
    }
    if (!in_loop) {
        in_loop = true;
        if (JavaIdlRCServiceInit.RC_ID.equals(objectIdString)) {
            if (ri.effective_target()._is_a(RecoveryCoordinatorHelper.id())) {
                /*
			     * Extract the substring of the ObjectId that contains the Uid and 
			     * the Process Id and pass it to the data of the service context
			     */
                RCobjectId = extractObjectId(objectIdString).getBytes();
                RCctx = new ServiceContext(RecoveryContextId, RCobjectId);
                in_loop = false;
                throw new ForwardRequest(reco);
            } else {
                in_loop = false;
            }
        }
        in_loop = false;
    }
}
Also used : ForwardRequest(org.omg.PortableInterceptor.ForwardRequest) ServiceContext(org.omg.IOP.ServiceContext) Any(org.omg.CORBA.Any)

Example 4 with ForwardRequest

use of org.omg.PortableInterceptor.ForwardRequest in project Payara by payara.

the class OpenTracingIiopServerInterceptor method receive_request.

@Override
public void receive_request(ServerRequestInfo serverRequestInfo) throws ForwardRequest {
    // Double check we have a tracer
    if (!tracerAvailable()) {
        return;
    }
    ServiceContext serviceContext = serverRequestInfo.get_request_service_context(OPENTRACING_IIOP_ID);
    if (serviceContext == null) {
        return;
    }
    OpenTracingIiopTextMap openTracingIiopTextMap = null;
    try (ByteArrayInputStream bis = new ByteArrayInputStream(serviceContext.context_data);
        ObjectInput in = new OpenTracingIiopObjectInputStream(bis)) {
        openTracingIiopTextMap = (OpenTracingIiopTextMap) in.readObject();
    } catch (IOException | ClassNotFoundException exception) {
        throw new ForwardRequest(exception.getMessage(), serverRequestInfo);
    }
    Tracer.SpanBuilder spanBuilder = tracer.buildSpan("rmi").withTag(Tags.COMPONENT.getKey(), "ejb");
    if (openTracingIiopTextMap != null) {
        SpanContext spanContext = tracer.extract(Format.Builtin.TEXT_MAP, openTracingIiopTextMap);
        // Add the propagated span as a parent
        spanBuilder.asChildOf(spanContext);
    }
    // Start the span and mark it as active
    tracer.activateSpan(spanBuilder.start());
}
Also used : ForwardRequest(org.omg.PortableInterceptor.ForwardRequest) SpanContext(io.opentracing.SpanContext) ByteArrayInputStream(java.io.ByteArrayInputStream) ServiceContext(org.omg.IOP.ServiceContext) Tracer(io.opentracing.Tracer) ObjectInput(java.io.ObjectInput) IOException(java.io.IOException)

Aggregations

ServiceContext (org.omg.IOP.ServiceContext)4 ForwardRequest (org.omg.PortableInterceptor.ForwardRequest)4 Any (org.omg.CORBA.Any)3 SpanContext (io.opentracing.SpanContext)1 Tracer (io.opentracing.Tracer)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 ObjectInput (java.io.ObjectInput)1