Java Code Examples for com.sun.corba.se.spi.ior.iiop.GIOPVersion#equals()

The following examples show how to use com.sun.corba.se.spi.ior.iiop.GIOPVersion#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageBase.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static ReplyMessage createReply(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        int reply_status, ServiceContexts service_contexts, IOR ior) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new ReplyMessage_1_0(orb, service_contexts, request_id,
                                    reply_status, ior);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new ReplyMessage_1_1(orb, service_contexts, request_id,
                                    reply_status, ior);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        ReplyMessage msg =
            new ReplyMessage_1_2(orb, request_id, reply_status,
                                 service_contexts, ior);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 2
Source File: MessageBase.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static Message createMessageError(GIOPVersion gv) {
    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new Message_1_0(Message.GIOPBigMagic, false,
                               Message.GIOPMessageError, 0);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_1,
                               FLAG_NO_FRAG_BIG_ENDIAN,
                               Message.GIOPMessageError, 0);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_2,
                               FLAG_NO_FRAG_BIG_ENDIAN,
                               Message.GIOPMessageError, 0);
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 3
Source File: MessageBase.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static LocateRequestMessage createLocateRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion,
        int request_id, byte[] object_key) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new LocateRequestMessage_1_0(orb, request_id, object_key);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new LocateRequestMessage_1_1(orb, request_id, object_key);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        TargetAddress target = new TargetAddress();
        target.object_key(object_key);
        LocateRequestMessage msg =
            new LocateRequestMessage_1_2(orb, request_id, target);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 4
Source File: MessageBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static LocateRequestMessage createLocateRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion,
        int request_id, byte[] object_key) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new LocateRequestMessage_1_0(orb, request_id, object_key);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new LocateRequestMessage_1_1(orb, request_id, object_key);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        TargetAddress target = new TargetAddress();
        target.object_key(object_key);
        LocateRequestMessage msg =
            new LocateRequestMessage_1_2(orb, request_id, target);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 5
Source File: MessageBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static ReplyMessage createReply(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        int reply_status, ServiceContexts service_contexts, IOR ior) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new ReplyMessage_1_0(orb, service_contexts, request_id,
                                    reply_status, ior);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new ReplyMessage_1_1(orb, service_contexts, request_id,
                                    reply_status, ior);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        ReplyMessage msg =
            new ReplyMessage_1_2(orb, request_id, reply_status,
                                 service_contexts, ior);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 6
Source File: MessageBase.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static Message createMessageError(GIOPVersion gv) {
    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new Message_1_0(Message.GIOPBigMagic, false,
                               Message.GIOPMessageError, 0);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_1,
                               FLAG_NO_FRAG_BIG_ENDIAN,
                               Message.GIOPMessageError, 0);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_2,
                               FLAG_NO_FRAG_BIG_ENDIAN,
                               Message.GIOPMessageError, 0);
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 7
Source File: MessageBase.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static LocateReplyMessage createLocateReply(
        ORB orb, GIOPVersion gv, byte encodingVersion,
        int request_id, int locate_status, IOR ior) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new LocateReplyMessage_1_0(orb, request_id,
                                          locate_status, ior);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new LocateReplyMessage_1_1(orb, request_id,
                                          locate_status, ior);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        LocateReplyMessage msg =
            new LocateReplyMessage_1_2(orb, request_id,
                                       locate_status, ior);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 8
Source File: MessageBase.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public static LocateRequestMessage createLocateRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion,
        int request_id, byte[] object_key) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new LocateRequestMessage_1_0(orb, request_id, object_key);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new LocateRequestMessage_1_1(orb, request_id, object_key);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        TargetAddress target = new TargetAddress();
        target.object_key(object_key);
        LocateRequestMessage msg =
            new LocateRequestMessage_1_2(orb, request_id, target);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 9
Source File: MessageBase.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public static LocateReplyMessage createLocateReply(
        ORB orb, GIOPVersion gv, byte encodingVersion,
        int request_id, int locate_status, IOR ior) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new LocateReplyMessage_1_0(orb, request_id,
                                          locate_status, ior);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new LocateReplyMessage_1_1(orb, request_id,
                                          locate_status, ior);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        LocateReplyMessage msg =
            new LocateReplyMessage_1_2(orb, request_id,
                                       locate_status, ior);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 10
Source File: MessageBase.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public static CancelRequestMessage createCancelRequest(
        GIOPVersion gv, int request_id) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new CancelRequestMessage_1_0(request_id);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new CancelRequestMessage_1_1(request_id);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        return new CancelRequestMessage_1_2(request_id);
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 11
Source File: MessageBase.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static CancelRequestMessage createCancelRequest(
        GIOPVersion gv, int request_id) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new CancelRequestMessage_1_0(request_id);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new CancelRequestMessage_1_1(request_id);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        return new CancelRequestMessage_1_2(request_id);
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 12
Source File: ORBDataParserImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public int getGIOPBuffMgrStrategy(GIOPVersion gv)
{
    if(gv!=null){
        if (gv.equals(GIOPVersion.V1_0)) return 0; //Always grow for 1.0
        if (gv.equals(GIOPVersion.V1_1)) return giop11BuffMgr;
        if (gv.equals(GIOPVersion.V1_2)) return giop12BuffMgr;
    }
    //If a "faulty" GIOPVersion is passed, it's going to return 0;
    return 0;
}
 
Example 13
Source File: MessageBase.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static CancelRequestMessage createCancelRequest(
        GIOPVersion gv, int request_id) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new CancelRequestMessage_1_0(request_id);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new CancelRequestMessage_1_1(request_id);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        return new CancelRequestMessage_1_2(request_id);
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 14
Source File: MessageBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static CancelRequestMessage createCancelRequest(
        GIOPVersion gv, int request_id) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new CancelRequestMessage_1_0(request_id);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new CancelRequestMessage_1_1(request_id);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        return new CancelRequestMessage_1_2(request_id);
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 15
Source File: MessageBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, byte[] object_key, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    if (gv.equals(GIOPVersion.V1_0)) { // 1.0
        return new RequestMessage_1_0(orb, service_contexts, request_id,
                                     response_expected, object_key,
                                     operation, requesting_principal);
    } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
        return new RequestMessage_1_1(orb, service_contexts, request_id,
            response_expected, new byte[] { 0x00, 0x00, 0x00 },
            object_key, operation, requesting_principal);
    } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }
        /*
        // REVISIT The following is the correct way to do it. This gives
        // more flexibility.
        if ((DII::INV_NO_RESPONSE == false) && response_expected) {
            response_flags = 0x03; // regular two-way
        } else if ((DII::INV_NO_RESPONSE == false) && !response_expected) {
            // this condition is not possible
        } else if ((DII::INV_NO_RESPONSE == true) && response_expected) {
            // oneway, but we need response for LocationForwards or
            // SystemExceptions.
            response_flags = 0x01;
        } else if ((DII::INV_NO_RESPONSE == true) && !response_expected) {
            // oneway, no response required
            response_flags = 0x00;
        }
        */
        TargetAddress target = new TargetAddress();
        target.object_key(object_key);
        RequestMessage msg =
            new RequestMessage_1_2(orb, request_id, response_flags,
                                   new byte[] { 0x00, 0x00, 0x00 },
                                   target, operation, service_contexts);
        msg.setEncodingVersion(encodingVersion);
        return msg;
    } else {
        throw wrapper.giopVersionError(
            CompletionStatus.COMPLETED_MAYBE);
    }
}
 
Example 16
Source File: MessageBase.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public static RequestMessage createRequest(
        ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
        boolean response_expected, IOR ior,
        short addrDisp, String operation,
        ServiceContexts service_contexts, Principal requesting_principal) {

    RequestMessage requestMessage = null;
    IIOPProfile profile = ior.getProfile();

    if (addrDisp == KeyAddr.value) {
        // object key will be used for target addressing
        profile = ior.getProfile();
        ObjectKey objKey = profile.getObjectKey();
        byte[] object_key = objKey.getBytes(orb);
        requestMessage =
               createRequest(orb, gv, encodingVersion, request_id,
                             response_expected, object_key,
                             operation, service_contexts,
                             requesting_principal);
    } else {

        if (!(gv.equals(GIOPVersion.V1_2))) {
            // only object_key based target addressing is allowed for
            // GIOP 1.0 & 1.1
            throw wrapper.giopVersionError(
                CompletionStatus.COMPLETED_MAYBE);
        }

        // Note: Currently we use response_expected flag to decide if the
        // call is oneway or not. Ideally, it is possible to expect a
        // response on a oneway call too, but we do not support it now.
        byte response_flags = 0x03;
        if (response_expected) {
            response_flags = 0x03;
        } else {
            response_flags = 0x00;
        }

        TargetAddress target = new TargetAddress();
        if (addrDisp == ProfileAddr.value) { // iop profile will be used
            profile = ior.getProfile();
            target.profile(profile.getIOPProfile());
        } else if (addrDisp == ReferenceAddr.value) {  // ior will be used
            IORAddressingInfo iorInfo =
                new IORAddressingInfo( 0, // profile index
                    ior.getIOPIOR());
            target.ior(iorInfo);
        } else {
            // invalid target addressing disposition value
            throw wrapper.illegalTargetAddressDisposition(
                CompletionStatus.COMPLETED_NO);
        }

        requestMessage =
               new RequestMessage_1_2(orb, request_id, response_flags,
                              new byte[] { 0x00, 0x00, 0x00 }, target,
                              operation, service_contexts);
        requestMessage.setEncodingVersion(encodingVersion);
    }

    if (gv.supportsIORIIOPProfileComponents()) {
        // add request partitioning thread pool to use info
        int poolToUse = 0; // default pool
        IIOPProfileTemplate temp =
            (IIOPProfileTemplate)profile.getTaggedProfileTemplate();
        Iterator iter =
            temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID);
        if (iter.hasNext()) {
            poolToUse =
                ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId();
        }

        if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID ||
            poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) {
            throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
                  new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
        }
        requestMessage.setThreadPoolToUse(poolToUse);
    }

    return requestMessage;
}
 
Example 17
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected void performCodeSetNegotiation(CorbaMessageMediator messageMediator)
{
    CorbaConnection conn =
        (CorbaConnection) messageMediator.getConnection();
    IOR ior =
        ((CorbaContactInfo)messageMediator.getContactInfo())
        .getEffectiveTargetIOR();
    GIOPVersion giopVersion = messageMediator.getGIOPVersion();

    // XXX This seems to be a broken double checked locking idiom: FIX IT!

    // conn.getCodeSetContext() is null when no other requests have
    // been made on this connection to trigger code set negotation.
    if (conn != null &&
        conn.getCodeSetContext() == null &&
        !giopVersion.equals(GIOPVersion.V1_0)) {

        synchronized(conn) {
            // Double checking.  Don't let any other
            // threads use this connection until the
            // code sets are straight.
            if (conn.getCodeSetContext() != null)
                return;

            // This only looks at the first code set component.  If
            // there can be multiple locations with multiple code sets,
            // this requires more work.
            IIOPProfileTemplate temp =
                (IIOPProfileTemplate)ior.getProfile().
                getTaggedProfileTemplate();
            Iterator iter = temp.iteratorById(TAG_CODE_SETS.value);
            if (!iter.hasNext()) {
                // Didn't have a code set component.  The default will
                // be to use ISO8859-1 for char data and throw an
                // exception if wchar data is used.
                return;
            }

            // Get the native and conversion code sets the
            // server specified in its IOR
            CodeSetComponentInfo serverCodeSets
                = ((CodeSetsComponent)iter.next()).getCodeSetComponentInfo();

            // Perform the negotiation between this ORB's code sets and
            // the ones from the IOR
            CodeSetComponentInfo.CodeSetContext result
                = CodeSetConversion.impl().negotiate(
                      conn.getBroker().getORBData().getCodeSetComponentInfo(),
                      serverCodeSets);

            conn.setCodeSetContext(result);
        }
    }
}
 
Example 18
Source File: CorbaClientRequestDispatcherImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected void addCodeSetServiceContext(CorbaConnection conn,
                                      ServiceContexts ctxs,
                                      GIOPVersion giopVersion) {

    // REVISIT.  OMG issue 3318 concerning sending the code set
    // service context more than once was deemed too much for the
    // RTF.  Here's our strategy for the moment:
    //
    // Send it on every request (necessary in cases of fragmentation
    // with multithreaded clients or when the first thing on a
    // connection is a LocateRequest).  Provide an ORB property
    // to disable multiple sends.
    //
    // Note that the connection is null in the local case and no
    // service context is included.  We use the ORB provided
    // encapsulation streams.
    //
    // Also, there will be no negotiation or service context
    // in GIOP 1.0.  ISO8859-1 is used for char/string, and
    // wchar/wstring are illegal.
    //
    if (giopVersion.equals(GIOPVersion.V1_0) || conn == null)
        return;

    CodeSetComponentInfo.CodeSetContext codeSetCtx = null;

    if (conn.getBroker().getORBData().alwaysSendCodeSetServiceContext() ||
        !conn.isPostInitialContexts()) {

        // Get the negotiated code sets (if any) out of the connection
        codeSetCtx = conn.getCodeSetContext();
    }

    // Either we shouldn't send the code set service context, or
    // for some reason, the connection doesn't have its code sets.
    // Perhaps the server didn't include them in the IOR.  Uses
    // ISO8859-1 for char and makes wchar/wstring illegal.
    if (codeSetCtx == null)
        return;

    CodeSetServiceContext cssc = new CodeSetServiceContext(codeSetCtx);
    ctxs.put(cssc);
}
 
Example 19
Source File: CorbaClientRequestDispatcherImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
protected void performCodeSetNegotiation(CorbaMessageMediator messageMediator)
{
    CorbaConnection conn =
        (CorbaConnection) messageMediator.getConnection();
    IOR ior =
        ((CorbaContactInfo)messageMediator.getContactInfo())
        .getEffectiveTargetIOR();
    GIOPVersion giopVersion = messageMediator.getGIOPVersion();

    // XXX This seems to be a broken double checked locking idiom: FIX IT!

    // conn.getCodeSetContext() is null when no other requests have
    // been made on this connection to trigger code set negotation.
    if (conn != null &&
        conn.getCodeSetContext() == null &&
        !giopVersion.equals(GIOPVersion.V1_0)) {

        synchronized(conn) {
            // Double checking.  Don't let any other
            // threads use this connection until the
            // code sets are straight.
            if (conn.getCodeSetContext() != null)
                return;

            // This only looks at the first code set component.  If
            // there can be multiple locations with multiple code sets,
            // this requires more work.
            IIOPProfileTemplate temp =
                (IIOPProfileTemplate)ior.getProfile().
                getTaggedProfileTemplate();
            Iterator iter = temp.iteratorById(TAG_CODE_SETS.value);
            if (!iter.hasNext()) {
                // Didn't have a code set component.  The default will
                // be to use ISO8859-1 for char data and throw an
                // exception if wchar data is used.
                return;
            }

            // Get the native and conversion code sets the
            // server specified in its IOR
            CodeSetComponentInfo serverCodeSets
                = ((CodeSetsComponent)iter.next()).getCodeSetComponentInfo();

            // Perform the negotiation between this ORB's code sets and
            // the ones from the IOR
            CodeSetComponentInfo.CodeSetContext result
                = CodeSetConversion.impl().negotiate(
                      conn.getBroker().getORBData().getCodeSetComponentInfo(),
                      serverCodeSets);

            conn.setCodeSetContext(result);
        }
    }
}
 
Example 20
Source File: CorbaClientRequestDispatcherImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected void performCodeSetNegotiation(CorbaMessageMediator messageMediator)
{
    CorbaConnection conn =
        (CorbaConnection) messageMediator.getConnection();
    IOR ior =
        ((CorbaContactInfo)messageMediator.getContactInfo())
        .getEffectiveTargetIOR();
    GIOPVersion giopVersion = messageMediator.getGIOPVersion();

    // XXX This seems to be a broken double checked locking idiom: FIX IT!

    // conn.getCodeSetContext() is null when no other requests have
    // been made on this connection to trigger code set negotation.
    if (conn != null &&
        conn.getCodeSetContext() == null &&
        !giopVersion.equals(GIOPVersion.V1_0)) {

        synchronized(conn) {
            // Double checking.  Don't let any other
            // threads use this connection until the
            // code sets are straight.
            if (conn.getCodeSetContext() != null)
                return;

            // This only looks at the first code set component.  If
            // there can be multiple locations with multiple code sets,
            // this requires more work.
            IIOPProfileTemplate temp =
                (IIOPProfileTemplate)ior.getProfile().
                getTaggedProfileTemplate();
            Iterator iter = temp.iteratorById(TAG_CODE_SETS.value);
            if (!iter.hasNext()) {
                // Didn't have a code set component.  The default will
                // be to use ISO8859-1 for char data and throw an
                // exception if wchar data is used.
                return;
            }

            // Get the native and conversion code sets the
            // server specified in its IOR
            CodeSetComponentInfo serverCodeSets
                = ((CodeSetsComponent)iter.next()).getCodeSetComponentInfo();

            // Perform the negotiation between this ORB's code sets and
            // the ones from the IOR
            CodeSetComponentInfo.CodeSetContext result
                = CodeSetConversion.impl().negotiate(
                      conn.getBroker().getORBData().getCodeSetComponentInfo(),
                      serverCodeSets);

            conn.setCodeSetContext(result);
        }
    }
}