geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject [10/51] [abbrv] geronimo-yoko git commit: Make request id unique to connection.
Date Sun, 19 Feb 2017 01:49:27 GMT
Make request id unique to connection.


Project: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/repo
Commit: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/commit/f8526248
Tree: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/tree/f8526248
Diff: http://git-wip-us.apache.org/repos/asf/geronimo-yoko/diff/f8526248

Branch: refs/heads/master
Commit: f85262480274ef7e07416a3e85fcff785bc68ec8
Parents: 4f815a0
Author: Joe Chacko <chackoj@uk.ibm.com>
Authored: Tue Nov 10 00:43:34 2015 +0000
Committer: Joe Chacko <chackoj@uk.ibm.com>
Committed: Tue Nov 10 00:45:52 2015 +0000

----------------------------------------------------------------------
 .../java/org/apache/yoko/orb/OB/Client.java     |    2 +
 .../apache/yoko/orb/OB/CollocatedServer.java    |    3 +-
 .../java/org/apache/yoko/orb/OB/Downcall.java   |   93 +-
 .../java/org/apache/yoko/orb/OB/GIOPClient.java |  239 ++---
 .../org/apache/yoko/orb/OB/GIOPConnection.java  | 1003 ++++++++----------
 .../java/org/apache/yoko/orb/OB/GIOPServer.java |    1 -
 .../org/apache/yoko/orb/OB/ORBInstance.java     |    2 +-
 .../main/java/org/apache/yoko/util/Cache.java   |    6 +
 .../util/concurrent/ReferenceCountedCache.java  |   12 +
 9 files changed, 590 insertions(+), 771 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f8526248/yoko-core/src/main/java/org/apache/yoko/orb/OB/Client.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/OB/Client.java b/yoko-core/src/main/java/org/apache/yoko/orb/OB/Client.java
index c97df61..5f85853 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/OB/Client.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/OB/Client.java
@@ -130,4 +130,6 @@ public abstract class Client {
     // Determines whether this client supports twoway invocations
     //
     public abstract boolean twoway();
+
+    public void prepareForDowncall(RefCountPolicyList policies) {}
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f8526248/yoko-core/src/main/java/org/apache/yoko/orb/OB/CollocatedServer.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/OB/CollocatedServer.java b/yoko-core/src/main/java/org/apache/yoko/orb/OB/CollocatedServer.java
index 78c0e74..9bbcdbc 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/OB/CollocatedServer.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/OB/CollocatedServer.java
@@ -344,8 +344,7 @@ final public class CollocatedServer extends Server implements UpcallReturn
{
 
         if (replySCL.length > 0) {
             synchronized (this) {
-                Downcall down = (Downcall) callMap_.get(new Integer(upcall
-                        .requestId()));
+                Downcall down = (Downcall) callMap_.get(new Integer(upcall.requestId()));
 
                 //
                 // Might be null if the request timed out or destroyed

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f8526248/yoko-core/src/main/java/org/apache/yoko/orb/OB/Downcall.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/OB/Downcall.java b/yoko-core/src/main/java/org/apache/yoko/orb/OB/Downcall.java
index 5ae2c2c..427c6fd 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/OB/Downcall.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/OB/Downcall.java
@@ -26,71 +26,50 @@ import org.apache.yoko.orb.util.AutoLock;
 import org.apache.yoko.orb.util.AutoReadWriteLock;
 import org.omg.CORBA.CompletionStatus;
 import org.omg.CORBA.NO_RESPONSE;
+import org.omg.IOP.IOR;
 import org.omg.IOP.ServiceContext;
 
 public class Downcall {
-    //
-    // The ORBInstance object
-    //
-    protected ORBInstance orbInstance_;
-    
-    protected Logger logger_;   // the orbInstance_ logger object 
+    /** The ORBInstance object */
+    protected final ORBInstance orbInstance_;
 
-    //
-    // The client
-    //
-    protected Client client_;
+    private final Logger logger_;   // the orbInstance_ logger object
 
-    //
-    // The downcall emitter
-    //
-    protected DowncallEmitter emitter_;
+    /** The client */
+    private final Client client_;
 
-    //
-    // Information about the IOR profile
-    //
+    /** The downcall emitter */
+    private DowncallEmitter emitter_;
+
+    /** Information about the IOR profile */
     protected org.apache.yoko.orb.OCI.ProfileInfo profileInfo_;
 
-    //
-    // The list of policies
-    //
+    /** The list of policies */
     protected RefCountPolicyList policies_;
 
-    //
-    // The unique request ID
-    //
-    protected int reqId_;
+    /** The unique request ID */
+    private final int reqId_;
 
-    //
-    // The name of the operation
-    //
-    protected String op_;
+    /** The name of the operation */
+    protected final String op_;
 
-    //
-    // Whether a response is expected
-    //
-    protected boolean responseExpected_;
+    /** Whether a response is expected */
+    protected final boolean responseExpected_;
 
-    //
-    // The marshalled headers and parameters
-    //
-    protected org.apache.yoko.orb.CORBA.OutputStream out_;
+    /** The marshalled headers and parameters */
+    private org.apache.yoko.orb.CORBA.OutputStream out_;
 
-    //
-    // Holds the results of the operation
-    //
-    protected org.apache.yoko.orb.CORBA.InputStream in_;
+    /** Holds the results of the operation */
+    private org.apache.yoko.orb.CORBA.InputStream in_;
 
-    //
-    // The state of this invocation
-    //
+    /** The state of this invocation */
     protected enum State { UNSENT, PENDING, NO_EXCEPTION, USER_EXCEPTION, SYSTEM_EXCEPTION,
FAILURE_EXCEPTION, FORWARD, FORWARD_PERM }
     
     protected final AutoReadWriteLock stateLock = new AutoReadWriteLock();
     
     protected State state = State.UNSENT;
-    
-    protected Condition stateWaitCondition;
+
+    private Condition stateWaitCondition;
 
     //
     // Holds the exception if state_ is DowncallStateUserException,
@@ -102,19 +81,15 @@ public class Downcall {
     // Holds the exception ID if state_ is DowncallStateUserException,
     // DowncallStateSystemException, or DowncallStateFailureException
     //
-    // In Java, we need this member in Downcall, rather than in PIDowncall
-    //
     protected String exId_;
 
     //
     // Holds the forward IOR if state_ is DowncallStateLocationForward
     // or DowncallLocationForwardPerm
     //
-    protected org.omg.IOP.IOR forwardIOR_;
+    protected IOR forwardIOR_;
 
-    //
-    // The request and reply service contexts
-    //
+    /** The request and reply service contexts */
     protected Vector<ServiceContext> requestSCL_ = new Vector<>();
 
     protected Vector<ServiceContext> replySCL_ = new Vector<>();
@@ -123,9 +98,7 @@ public class Downcall {
     // Downcall private and protected member implementations
     // ----------------------------------------------------------------------
 
-    //
-    // Raise an exception if necessary
-    //
+    /** Raise an exception if necessary */
     void checkForException() throws LocationForward, FailureException {
         try (AutoLock readLock = stateLock.getReadLock()) {
             switch (state) {
@@ -162,13 +135,8 @@ public class Downcall {
         }
     }
 
-    //
-    // Java only
-    //
-    // Required for use by subclasses
-    //
-    protected final org.apache.yoko.orb.CORBA.OutputStream preMarshalBase()
-            throws LocationForward, FailureException {
+    /** Required for use by subclasses */
+    protected final org.apache.yoko.orb.CORBA.OutputStream preMarshalBase() throws LocationForward,
FailureException {
         org.apache.yoko.orb.CORBA.OutputStreamHolder out = new org.apache.yoko.orb.CORBA.OutputStreamHolder();
         emitter_ = client_.startDowncall(this, out);
         out_ = out.value;
@@ -199,6 +167,7 @@ public class Downcall {
         //
         // Get the next request ID
         //
+        client.prepareForDowncall(policies);
         reqId_ = client_.requestId();
         
         logger_.debug("Downcall created for operation " + op + " with id " + reqId_); 
@@ -530,7 +499,7 @@ public class Downcall {
         }
     }
 
-    public final void setLocationForward(org.omg.IOP.IOR ior, boolean perm) {
+    public final void setLocationForward(IOR ior, boolean perm) {
         try (AutoLock lock = stateLock.getWriteLock()) {
             Assert._OB_assert(responseExpected_);
             Assert._OB_assert(forwardIOR_ == null);

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f8526248/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPClient.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPClient.java b/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPClient.java
index 2d58692..91d9ce2 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPClient.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/OB/GIOPClient.java
@@ -17,69 +17,68 @@
 
 package org.apache.yoko.orb.OB;
 
+import org.apache.yoko.orb.CORBA.OutputStream;
+import org.apache.yoko.orb.CORBA.OutputStreamHolder;
 import org.apache.yoko.orb.OBPortableServer.POAManager_impl;
+import org.apache.yoko.orb.OCI.Buffer;
+import org.apache.yoko.orb.OCI.Connector;
 import org.apache.yoko.orb.OCI.ConnectorInfo;
 import org.apache.yoko.orb.OCI.GiopVersion;
+import org.apache.yoko.orb.OCI.ProfileInfo;
+import org.apache.yoko.orb.OCI.Transport;
 import org.apache.yoko.util.Cache;
 import org.apache.yoko.util.Factory;
 import org.apache.yoko.util.Reference;
+import org.omg.CONV_FRAME.CodeSetContext;
+import org.omg.CONV_FRAME.CodeSetContextHelper;
+import org.omg.CORBA.CompletionStatus;
 import org.omg.CORBA.INITIALIZE;
+import org.omg.CORBA.NO_RESPONSE;
+import org.omg.CORBA.Policy;
+import org.omg.IOP.CodeSets;
+import org.omg.IOP.IOR;
+import org.omg.IOP.ServiceContext;
 import org.omg.PortableServer.POAManager;
+import org.omg.SendingContext.CodeBase;
 import org.omg.SendingContext.CodeBaseHelper;
 
+import javax.rmi.CORBA.ValueHandler;
+import java.util.ArrayList;
+import java.util.List;
+
+import static javax.rmi.CORBA.Util.*;
 import static org.apache.yoko.orb.OB.MinorCodes.*;
-import static org.omg.CORBA.CompletionStatus.*;
 
 final class GIOPClient extends Client {
     protected ORBInstance orbInstance_; // The ORB instance
 
-    protected int nextRequestId_; // The next request ID
-
-    protected java.lang.Object nextRequestIdMutex_ = new java.lang.Object(); // The
-                                                                                // next
-                                                                                // request
-                                                                                // ID
-                                                                                // mutex
+    protected Connector connector_; // The connector
 
-    protected org.apache.yoko.orb.OCI.Connector connector_; // The connector
+    private GIOPConnection connection_;
+    private Reference<GIOPConnection> connectionRef;
 
-    protected GIOPConnection connection_;
+    /** Codesets SC */
+    protected ServiceContext codeSetSC_;
 
-    //
-    // Codesets SC
-    // 
-    protected org.omg.IOP.ServiceContext codeSetSC_;
-
-    protected org.omg.IOP.ServiceContext codeBaseSC_;
+    protected ServiceContext codeBaseSC_;
 
     protected boolean bidirWorker_; // is the worker bidir?
 
     protected volatile boolean destroy_; // True if destroy() was called
-    private Reference<GIOPConnection> connectionRef;
 
     // ----------------------------------------------------------------------
     // GIOPClient private and protected member implementations
     // ----------------------------------------------------------------------
 
-    protected void finalize() throws Throwable {
-        Assert._OB_assert(destroy_);
-        Assert._OB_assert(connection_ == null);
-
-        super.finalize();
-    }
-
-    // 
     // uses the prepopulated connector_ (not connected) to do a lookup,
     // checking if a bidir connection alias exists... it returns it if
     // it does and returns null otherwise
-    //
     protected GIOPConnection find_bidir_worker() {
         try {
             for (POAManager poaManager : orbInstance_.getPOAManagerFactory().list()) {
                 for (Server aServSeq : ((POAManager_impl) poaManager)._OB_getServerManager().getServers())
{
-                    GIOPConnection gw = ((GIOPServer) aServSeq)._OB_getGIOPServerStarter().getMatchingConnection(connectorInfo());
-                    if (gw != null)
-                        return gw;
+                    GIOPConnection conn = ((GIOPServer) aServSeq)._OB_getGIOPServerStarter().getMatchingConnection(connectorInfo());
+                    if (conn != null) return conn;
                 }
             }
         } catch (ClassCastException ignored) {}
@@ -93,7 +92,7 @@ final class GIOPClient extends Client {
     //
     protected synchronized GIOPConnection getWorker(boolean create, final int timeout) {
         if (destroy_)
-            throw new INITIALIZE(describeInitialize(MinorORBDestroyed), MinorORBDestroyed,
COMPLETED_NO);
+            throw new INITIALIZE(describeInitialize(MinorORBDestroyed), MinorORBDestroyed,
CompletionStatus.COMPLETED_NO);
 
         if (connection_ == null)
             reuseInboundConnection();
@@ -121,7 +120,10 @@ final class GIOPClient extends Client {
         Cache<ConnectorInfo, GIOPConnection> connCache = orbInstance_.getOutboundConnectionCache();
         if (create) {
             connectionRef = connCache.getOrCreate(connector_.get_info(), new Factory<GIOPConnection>()
{
-                @Override public GIOPConnection create() {return createOutboundConnection(timeout);}
+                @Override
+                public GIOPConnection create() {
+                    return createOutboundConnection(timeout);
+                }
             });
         } else {
             connectionRef = connCache.get(connector_.get_info());
@@ -146,12 +148,7 @@ final class GIOPClient extends Client {
 
         if (connection_ == null) return;
 
-        //
-        // adjust the requestID to match the spec (even for
-        // clients, odd for servers)
-        //
-        nextRequestId_ |= 1;
-        connection_.activateClientSide(this);
+        connection_.activateClientSide();
 
         //
         // log the reusing of the connection
@@ -188,7 +185,7 @@ final class GIOPClient extends Client {
         // connect() in the backgound? Just an idea...
         //
 
-        org.apache.yoko.orb.OCI.Transport transport;
+        Transport transport;
 
         if (t >= 0) {
             transport = connector_.connect_timeout(t);
@@ -197,8 +194,7 @@ final class GIOPClient extends Client {
             // Was there a timeout?
             //
             if (transport == null)
-                throw new org.omg.CORBA.NO_RESPONSE("Connection timeout",
-                        0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
+                throw new NO_RESPONSE("Connection timeout", 0, CompletionStatus.COMPLETED_NO);
         } else {
             transport = connector_.connect();
             Assert._OB_assert(transport != null);
@@ -211,14 +207,10 @@ final class GIOPClient extends Client {
         return new GIOPConnectionThreaded(orbInstance_, transport, this);
     }
 
-    //
     // initialize internal service contexts
     private void initServiceContexts() {
         if (codeSetSC_ == null) {
-            //
-            // Create CONV_FRAME::CodeSetContext
-            //
-            org.omg.CONV_FRAME.CodeSetContext ctx = new org.omg.CONV_FRAME.CodeSetContext();
+            CodeSetContext ctx = new CodeSetContext();
             CodeConverters conv = codeConverters();
 
             if (conv.outputCharConverter != null)
@@ -231,21 +223,16 @@ final class GIOPClient extends Client {
             else
                 ctx.wchar_data = orbInstance_.getNativeWcs();
 
-            //
             // Create encapsulation for CONV_FRAME::CodeSetContext
-            //
-            org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
-            org.apache.yoko.orb.CORBA.OutputStream outCSC = new org.apache.yoko.orb.CORBA.OutputStream(
-                    buf);
+            Buffer buf = new Buffer();
+            OutputStream outCSC = new OutputStream(buf);
             outCSC._OB_writeEndian();
-            org.omg.CONV_FRAME.CodeSetContextHelper.write(outCSC, ctx);
+            CodeSetContextHelper.write(outCSC, ctx);
 
-            //
             // Create service context containing the
             // CONV_FRAME::CodeSetContext encapsulation
-            //
-            codeSetSC_ = new org.omg.IOP.ServiceContext();
-            codeSetSC_.context_id = org.omg.IOP.CodeSets.value;
+            codeSetSC_ = new ServiceContext();
+            codeSetSC_.context_id = CodeSets.value;
 
             int len = buf.length();
             byte[] data = buf.data();
@@ -254,17 +241,16 @@ final class GIOPClient extends Client {
         }
         if (codeBaseSC_ == null) {
 
-            javax.rmi.CORBA.ValueHandler valueHandler = javax.rmi.CORBA.Util.createValueHandler();
-            org.omg.SendingContext.CodeBase codeBase = CodeBaseHelper.narrow(valueHandler.getRunTimeCodeBase());
+            ValueHandler valueHandler = createValueHandler();
+            CodeBase codeBase = CodeBaseHelper.narrow(valueHandler.getRunTimeCodeBase());
 
 
-            org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
-            org.apache.yoko.orb.CORBA.OutputStream outCBC = new org.apache.yoko.orb.CORBA.OutputStream(
-                    buf);
+            Buffer buf = new Buffer();
+            OutputStream outCBC = new OutputStream(buf);
             outCBC._OB_writeEndian();
-            org.omg.SendingContext.CodeBaseHelper.write(outCBC, codeBase);
+            CodeBaseHelper.write(outCBC, codeBase);
 
-            codeBaseSC_ = new org.omg.IOP.ServiceContext();
+            codeBaseSC_ = new ServiceContext();
             codeBaseSC_.context_id = org.omg.IOP.SendingContextRunTime.value;
 
             int len = buf.length();
@@ -285,11 +271,10 @@ final class GIOPClient extends Client {
     // ----------------------------------------------------------------------
 
     GIOPClient(ORBInstance orbInstance,
-            org.apache.yoko.orb.OCI.Connector connector, int concModel,
-            CodeConverters conv, boolean bidirEnable) {
+               Connector connector, int concModel,
+               CodeConverters conv, boolean bidirEnable) {
         super(concModel, conv);
         orbInstance_ = orbInstance;
-        nextRequestId_ = 0;
         connector_ = connector;
         connection_ = null;
         destroy_ = false;
@@ -300,9 +285,7 @@ final class GIOPClient extends Client {
     // GIOPClient public member implementations
     // ----------------------------------------------------------------------
 
-    //
-    // Destroy the client
-    //
+    /** Destroy the client */
     public synchronized void destroy() {
         if (destroy_) return;
         destroy_ = true;
@@ -311,40 +294,22 @@ final class GIOPClient extends Client {
         if (connectionRef != null) connectionRef.close();
     }
 
-    public synchronized void removeConnection(GIOPConnection connection) {
-        if (connection != connection_) return;
-        connection_ = null;
-        // purge the reference from the cache if this is an outbound connection
-        if (connectionRef != null)
-            orbInstance_.getOutboundConnectionCache().remove(connectionRef);
-    }
-
-    //
-    // Get a new request ID
-    //
+    /** Get a new request ID */
     public int requestId() {
-        synchronized (nextRequestIdMutex_) {
-            //
-            // In the case of BiDir connections, the client should use
-            // even numbered requestIds and the server should use odd
-            // numbered requestIds... the += 2 keeps this pattern intact
-            // assuming its correct at startup
-            // 
-            return nextRequestId_ += 2;
-        }
+        return connection_.getNextRequestId();
     }
 
     //
     // get a list of ServiceContexts that have to be sent on an AMI router
     // request
     //
-    public org.omg.IOP.ServiceContext[] getAMIRouterSCL() {
+    public ServiceContext[] getAMIRouterSCL() {
         //
         // initialize the service contexts if they haven't already been
         //
         initServiceContexts();
 
-        org.omg.IOP.ServiceContext[] scl = new org.omg.IOP.ServiceContext[1];
+        ServiceContext[] scl = new ServiceContext[1];
         scl[0] = codeSetSC_;
 
         //
@@ -353,44 +318,24 @@ final class GIOPClient extends Client {
         return scl;
     }
 
-    //
-    // Get all profiles that are usable with this client
-    //
-    public org.apache.yoko.orb.OCI.ProfileInfo[] getUsableProfiles(
-            org.omg.IOP.IOR ior, org.omg.CORBA.Policy[] policies) {
-        //
+    /** Get all profiles that are usable with this client */
+    public ProfileInfo[] getUsableProfiles(IOR ior, Policy[] policies) {
         // Get all profiles usable for the connector
-        //
-        org.apache.yoko.orb.OCI.ProfileInfo[] all = connector_
-                .get_usable_profiles(ior, policies);
-
-        //
-        // Filter out profiles which would require a different code converter
-        //
-        java.util.Vector vec = new java.util.Vector();
-        for (int i = 0; i < all.length; i++) {
-            CodeConverters conv = CodeSetUtil.getCodeConverters(orbInstance_,
-                    all[i]);
-            if (codeConverters().equals(conv))
-                vec.addElement(all[i]);
+        List<ProfileInfo> profileInfos = new ArrayList<>();
+        for (ProfileInfo anAll : connector_.get_usable_profiles(ior, policies)) {
+            CodeConverters conv = CodeSetUtil.getCodeConverters(orbInstance_, anAll);
+            // Filter out profiles which would require a different code converter
+            if (codeConverters().equals(conv)) profileInfos.add(anAll);
         }
-
-        org.apache.yoko.orb.OCI.ProfileInfo[] result = new org.apache.yoko.orb.OCI.ProfileInfo[vec
-                .size()];
-        vec.copyInto(result);
-        return result;
+        return profileInfos.toArray(new ProfileInfo[profileInfos.size()]);
     }
 
-    //
-    // Get the OCI Connector info
-    //
+    /** Get the OCI Connector info */
     public org.apache.yoko.orb.OCI.ConnectorInfo connectorInfo() {
         return connector_.get_info();
     }
 
-    //
-    // Get the OCI Transport info
-    //
+    /** Get the OCI Transport info */
     public org.apache.yoko.orb.OCI.TransportInfo transportInfo() {
         //
         // Get the connection, but do not create a new one if there is none
@@ -401,7 +346,7 @@ final class GIOPClient extends Client {
         if (connection == null)
             return null;
 
-        org.apache.yoko.orb.OCI.Transport transport = connection.transport();
+        Transport transport = connection.transport();
         return transport.get_info();
     }
 
@@ -409,9 +354,8 @@ final class GIOPClient extends Client {
     // Start a downcall, returning a downcall emitter and an
     // OutputStream for marshalling a request
     //
-    public DowncallEmitter startDowncall(Downcall down,
-            org.apache.yoko.orb.CORBA.OutputStreamHolder out) {
-        GIOPConnection connection = null;
+    public DowncallEmitter startDowncall(Downcall down, OutputStreamHolder out) {
+        GIOPConnection connection;
         try {
             //
             // Get the worker, creating a new one if there is none
@@ -420,7 +364,7 @@ final class GIOPClient extends Client {
             connection = getWorker(true, down.policies().connectTimeout);
         } catch (org.omg.CORBA.SystemException ex) {
             Assert
-                    ._OB_assert(ex.completed == org.omg.CORBA.CompletionStatus.COMPLETED_NO);
+                    ._OB_assert(ex.completed == CompletionStatus.COMPLETED_NO);
             down.setFailureException(ex);
             return null;
         }
@@ -440,12 +384,11 @@ final class GIOPClient extends Client {
                     CodeConverters conv = codeConverters();
                     String msg = "sending transmission code sets";
                     msg += "\nchar code set: ";
-                    if (conv.outputCharConverter != null)
+                    if (conv.outputCharConverter != null) {
                         msg += conv.outputCharConverter.getTo().description;
-                    else {
-                        CodeSetInfo info = CodeSetDatabase.instance()
-                                .getCodeSetInfo(orbInstance_.getNativeCs());
-                        msg += info.description;
+                    } else {
+                        CodeSetInfo info = CodeSetDatabase.instance().getCodeSetInfo(orbInstance_.getNativeCs());
+                        msg += info != null ? info.description : null;
                     }
                     msg += "\nwchar code set: ";
                     if (conv.outputWcharConverter != null)
@@ -453,7 +396,7 @@ final class GIOPClient extends Client {
                     else {
                         CodeSetInfo info = CodeSetDatabase.instance()
                                 .getCodeSetInfo(orbInstance_.getNativeWcs());
-                        msg += info.description;
+                        msg += info != null ? info.description : null;
                     }
                     orbInstance_.getLogger().trace("outgoing", msg);
                 }
@@ -476,20 +419,19 @@ final class GIOPClient extends Client {
 
             if (validGIOPVersion
                     && (down.policies().biDirMode == org.omg.BiDirPolicy.BOTH.value))
{
-                org.apache.yoko.orb.OCI.Transport t = connection.transport();
+                Transport t = connection.transport();
 
-                org.omg.IOP.ServiceContext contexts[] = t.get_info()
+                ServiceContext contexts[] = t.get_info()
                         .get_service_contexts(down.policies().value);
-                for (int i = 0; i < contexts.length; i++)
-                    down.addToRequestSCL(contexts[i]);
+                for (ServiceContext context : contexts) down.addToRequestSCL(context);
             }
 
-            org.apache.yoko.orb.OCI.ProfileInfo profileInfo = down
+            ProfileInfo profileInfo = down
                     .profileInfo();
-            org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
+            Buffer buf = new Buffer(
                     12);
             buf.pos(12);
-            out.value = new org.apache.yoko.orb.CORBA.OutputStream(buf,
+            out.value = new OutputStream(buf,
                     codeConverters(), GiopVersion.get(profileInfo.major, profileInfo.minor));
 
             //
@@ -511,15 +453,13 @@ final class GIOPClient extends Client {
             return connection.emitterInterface();
         } catch (org.omg.CORBA.SystemException ex) {
             Assert
-                    ._OB_assert(ex.completed == org.omg.CORBA.CompletionStatus.COMPLETED_NO);
+                    ._OB_assert(ex.completed == CompletionStatus.COMPLETED_NO);
             down.setFailureException(ex);
             return null;
         }
     }
 
-    //
-    // Checks whether this client is equal to another client
-    //
+    /** Checks whether this client is equal to another client */
     public boolean matches(Client other) {
         if (!!!(other instanceof GIOPClient)) return false;
         GIOPClient that = (GIOPClient) other;
@@ -527,9 +467,7 @@ final class GIOPClient extends Client {
         return this.connector_.equal(that.connector_) && this.codeConverters().equals(that.codeConverters());
     }
 
-    //
-    // Force connection establishment
-    //
+    /** Force connection establishment */
     public void bind(int connectTimeout) {
         //
         // Get the connection, creating a new one if there is none
@@ -538,16 +476,19 @@ final class GIOPClient extends Client {
         getWorker(true, connectTimeout);
     }
 
-    //
-    // Determines whether this client supports twoway invocations
-    //
+    /** Determines whether this client supports twoway invocations */
     public boolean twoway() {
         //
         // Get the connection
         //
         GIOPConnection connection = getWorker(false, -1);
         Assert._OB_assert(connection != null);
-        org.apache.yoko.orb.OCI.Transport transport = connection.transport();
+        Transport transport = connection.transport();
         return transport.mode() == org.apache.yoko.orb.OCI.SendReceiveMode.SendReceive;
     }
+
+    @Override
+    public void prepareForDowncall(RefCountPolicyList policies) {
+        getWorker(true, policies.connectTimeout);
+    }
 }


Mime
View raw message