geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject [04/51] [abbrv] geronimo-yoko git commit: Cache outbound connections with reference counting.
Date Sun, 19 Feb 2017 01:49:21 GMT
http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Connector_impl.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Connector_impl.java b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Connector_impl.java
index a886a35..e2a737e 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Connector_impl.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Connector_impl.java
@@ -17,10 +17,14 @@
 
 package org.apache.yoko.orb.OCI.IIOP;
 
+import static org.apache.yoko.orb.OCI.IIOP.Exceptions.*;
+
 import java.util.Arrays;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.yoko.orb.OCI.ConnectCB;
+import org.apache.yoko.orb.OCI.Connector;
 import org.apache.yoko.orb.OCI.ProfileInfo;
 import org.apache.yoko.orb.OCI.ProfileInfoHolder;
 import org.omg.CORBA.Policy;
@@ -29,25 +33,18 @@ import org.omg.IOP.Codec;
 import org.omg.IOP.IOR;
 import org.omg.IOP.TaggedComponent;
 
-final class Connector_impl extends org.omg.CORBA.LocalObject implements
-        org.apache.yoko.orb.OCI.Connector {
+final class Connector_impl extends org.omg.CORBA.LocalObject implements Connector {
 
     // the real logger backing instance.  We use the interface class as the locator
-    static final Logger logger = Logger.getLogger(org.apache.yoko.orb.OCI.Connector.class.getName());
+    static final Logger logger = Logger.getLogger(Connector.class.getName());
 
     private final IOR ior_;    // the target IOR we're connecting with
 
     private final Policy[] policies_;    // the policies used for the connection.
 
-    // Some data member must not be private because the info object
-    // must be able to access them
-    public String host_; // The host
-
-    public int port_; // The port
-
     private boolean keepAlive_; // The keepalive flag
 
-    private ConnectorInfo_impl info_; // Connector information
+    private final ConnectorInfo_impl info_; // Connector information
 
     private java.net.Socket socket_; // The socket
 
@@ -67,11 +64,7 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
     // ------------------------------------------------------------------
 
     private void close() {
-        logger.fine("Closing connection to host=" + host_ + ", port=" + port_);
-        //
-        // Destroy the info object
-        //
-        info_._OB_destroy();
+        logger.fine("Closing connection to host=" + this.info_.getHost() + ", port=" + this.info_.getPort());
 
         //
         // Close the socket
@@ -105,15 +98,10 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
         //
         java.net.InetAddress address;
         try {
-            address = java.net.InetAddress.getByName(host_);
+            address = java.net.InetAddress.getByName(this.info_.getHost());
         } catch (java.net.UnknownHostException ex) {
             logger.log(Level.FINE, "Host resolution error", ex);
-            throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                    org.apache.yoko.orb.OB.MinorCodes
-                            .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorGethostbyname)
-                            + ": " + ex.getMessage(),
-                    org.apache.yoko.orb.OB.MinorCodes.MinorGethostbyname,
-                    org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
+            throw asCommFailure(ex);
         }
 
 
@@ -121,27 +109,27 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
         // Create socket and connect
         //
         try {
-            logger.fine("Connecting to host=" + address + ", port=" + port_);
+            logger.fine("Connecting to host=" + address + ", port=" + this.info_.getPort());
             if (connectionHelper_ != null) {
-                socket_ = connectionHelper_.createSocket(ior_, policies_, address, port_);
+                socket_ = connectionHelper_.createSocket(ior_, policies_, address, this.info_.getPort());
             } else {
-                socket_ = extendedConnectionHelper_.createSocket(ior_, policies_, address, port_);
+                socket_ = extendedConnectionHelper_.createSocket(ior_, policies_, address, this.info_.getPort());
             }
-            logger.fine("Connection created with socket " + socket_); 
+            logger.fine("Connection created with socket " + socket_);
         } catch (java.net.ConnectException ex) {
-            logger.log(Level.FINE, "Error connecting to host=" + address + ", port=" + port_, ex);
+            logger.log(Level.FINE, "Error connecting to host=" + address + ", port=" + this.info_.getPort(), ex);
             throw new org.omg.CORBA.TRANSIENT(
                     org.apache.yoko.orb.OB.MinorCodes
                             .describeTransient(org.apache.yoko.orb.OB.MinorCodes.MinorConnectFailed)
-                            + "Error connecting to host=" + address + ", port=" + port_+ ": " + ex.getMessage(),
+                            + "Error connecting to host=" + address + ", port=" + this.info_.getPort() + ": " + ex.getMessage(),
                     org.apache.yoko.orb.OB.MinorCodes.MinorConnectFailed,
                     org.omg.CORBA.CompletionStatus.COMPLETED_NO);
         } catch (java.io.IOException ex) {
-            logger.log(Level.FINE, "Error connecting to host=" + address + ", port=" + port_, ex);
+            logger.log(Level.FINE, "Error connecting to host=" + address + ", port=" + this.info_.getPort(), ex);
             throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
                     org.apache.yoko.orb.OB.MinorCodes
                             .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSocket)
-                            + "Error connecting to host=" + address + ", port=" + port_ + ": " + ex.getMessage(),
+                            + "Error connecting to host=" + address + ", port=" + this.info_.getPort() + ": " + ex.getMessage(),
                     org.apache.yoko.orb.OB.MinorCodes.MinorSocket,
                     org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
         }
@@ -160,12 +148,7 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
                 socket_.close();
             } catch (java.io.IOException e) {
             }
-            throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                    org.apache.yoko.orb.OB.MinorCodes
-                            .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSetsockopt)
-                            + ": " + ex.getMessage(),
-                    org.apache.yoko.orb.OB.MinorCodes.MinorSetsockopt,
-                    org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
+            throw Exceptions.asCommFailure(ex);
         }
 
         //
@@ -173,7 +156,7 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
         //
         org.apache.yoko.orb.OCI.Transport tr = null;
         try {
-            tr = new Transport_impl(this, socket_, listenMap_);
+            tr = new Transport_impl(socket_, listenMap_);
             socket_ = null;
         } catch (org.omg.CORBA.SystemException ex) {
             logger.log(Level.FINE, "Transport creation error", ex);
@@ -223,9 +206,9 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
         public void run() {
             try {
                 if (connectionHelper_ != null) {
-                    so_ = connectionHelper_.createSocket(ior_, policies_, address_, port_);
+                    so_ = connectionHelper_.createSocket(ior_, policies_, address_, Connector_impl.this.info_.getPort());
                 } else {
-                    so_ = extendedConnectionHelper_.createSocket(ior_, policies_, address_, port_);
+                    so_ = extendedConnectionHelper_.createSocket(ior_, policies_, address_, Connector_impl.this.info_.getPort());
                 }
             } catch (java.io.IOException ex) {
                 logger.log(Level.FINE, "Socket creation error", ex);
@@ -284,15 +267,10 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
         //
         java.net.InetAddress address = null;
         try {
-            address = java.net.InetAddress.getByName(host_);
+            address = java.net.InetAddress.getByName(this.info_.getHost());
         } catch (java.net.UnknownHostException ex) {
             logger.log(Level.FINE, "Host resolution error", ex);
-            throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                    org.apache.yoko.orb.OB.MinorCodes
-                            .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorGethostbyname)
-                            + ": " + ex.getMessage(),
-                    org.apache.yoko.orb.OB.MinorCodes.MinorGethostbyname,
-                    org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
+            throw asCommFailure(ex);
         }
 
         //
@@ -338,12 +316,7 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
                 socket_.close();
             } catch (java.io.IOException e) {
             }
-            throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                    org.apache.yoko.orb.OB.MinorCodes
-                            .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSetsockopt)
-                            + ": " + ex.getMessage(),
-                    org.apache.yoko.orb.OB.MinorCodes.MinorSetsockopt,
-                    org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
+            throw Exceptions.asCommFailure(ex);
         }
 
         //
@@ -351,7 +324,7 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
         //
         org.apache.yoko.orb.OCI.Transport tr = null;
         try {
-            tr = new Transport_impl(this, socket_, listenMap_);
+            tr = new Transport_impl(socket_, listenMap_);
             socket_ = null;
         } catch (org.omg.CORBA.SystemException ex) {
             logger.log(Level.FINE, "Transport setup error", ex);
@@ -396,7 +369,7 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
 
         org.apache.yoko.orb.OCI.ProfileInfoSeqHolder profileInfoSeq = new org.apache.yoko.orb.OCI.ProfileInfoSeqHolder();
         profileInfoSeq.value = new org.apache.yoko.orb.OCI.ProfileInfo[0];
-        Util.extractAllProfileInfos(ior, profileInfoSeq, true, host_, port_,
+        Util.extractAllProfileInfos(ior, profileInfoSeq, true, this.info_.getHost(), this.info_.getPort(),
                 false, codec_);
 
         //check that the transport info matches ours.
@@ -429,23 +402,23 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
         //
         // Compare ports
         //
-        if (port_ != impl.port_)
+        if (this.info_.getPort() != impl.info_.getPort())
             return false;
 
         //
         // Direct host name comparison
         //
-        if (!host_.equals(impl.host_)) {
+        if (!this.info_.getHost().equals(impl.info_.getHost())) {
             //
             // Direct host name comparision failed - must look up
             // addresses to be really sure if the hosts differ
             //
             try {
                 java.net.InetAddress addr1 = java.net.InetAddress
-                        .getByName(host_);
+                        .getByName(this.info_.getHost());
 
                 java.net.InetAddress addr2 = java.net.InetAddress
-                        .getByName(impl.host_);
+                        .getByName(impl.info_.getHost());
 
                 if (!addr1.equals(addr2))
                     return false;
@@ -458,11 +431,6 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
         }
 
         return Arrays.equals(transportInfo, impl.transportInfo);
-
-        //
-        // OK, connectors are the same
-        //
-//        return true;
     }
 
     byte[] extractTransportInfo(IOR ior) {
@@ -490,40 +458,27 @@ final class Connector_impl extends org.omg.CORBA.LocalObject implements
     // Application programs must not use these functions directly
     // ------------------------------------------------------------------
 
-    public Connector_impl(org.omg.IOP.IOR ior, org.omg.CORBA.Policy[] policies, String host, int port, boolean keepAlive,
-            org.apache.yoko.orb.OCI.ConnectCB[] cb, ListenerMap lm, ConnectionHelper helper, Codec codec) {
-        // System.out.println("Connector_impl");
+    private Connector_impl(IOR ior, Policy[] policies, String host, int port, boolean keepAlive, ConnectCB[] cb, ListenerMap lm, ConnectionHelper helper, ExtendedConnectionHelper xhelper, Codec codec) {
         ior_ = ior;
         policies_ = policies;
-        host_ = host;
-        port_ = port;
         keepAlive_ = keepAlive;
-        info_ = new ConnectorInfo_impl(this, cb);
+        info_ = new ConnectorInfo_impl(host, port, cb);
         listenMap_ = lm;
         connectionHelper_ = helper;
-        extendedConnectionHelper_ = null;
+        extendedConnectionHelper_ = xhelper;
         codec_ = codec;
         transportInfo = extractTransportInfo(ior);
     }
 
-    public Connector_impl(org.omg.IOP.IOR ior, org.omg.CORBA.Policy[] policies, String host, int port, boolean keepAlive,
-            org.apache.yoko.orb.OCI.ConnectCB[] cb, ListenerMap lm, ExtendedConnectionHelper helper, Codec codec) {
-        // System.out.println("Connector_impl");
-        ior_ = ior;
-        policies_ = policies;
-        host_ = host;
-        port_ = port;
-        keepAlive_ = keepAlive;
-        info_ = new ConnectorInfo_impl(this, cb);
-        listenMap_ = lm;
-        connectionHelper_ = null;
-        extendedConnectionHelper_ = helper;
-        codec_ = codec;
-        transportInfo = extractTransportInfo(ior);
+    public Connector_impl(IOR ior, Policy[] policies, String host, int port, boolean keepAlive, ConnectCB[] cb, ListenerMap lm, ConnectionHelper helper, Codec codec) {
+        this(ior, policies, host, port, keepAlive, cb, lm, helper, null, codec);
+    }
+
+    public Connector_impl(IOR ior, Policy[] policies, String host, int port, boolean keepAlive, ConnectCB[] cb, ListenerMap lm, ExtendedConnectionHelper helper, Codec codec) {
+        this(ior, policies, host, port, keepAlive, cb, lm, null, helper, codec);
     }
 
     public void finalize() throws Throwable {
-        // System.out.println("~Connector_impl");
         if (socket_ != null)
             close();
 

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Exceptions.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Exceptions.java b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Exceptions.java
new file mode 100644
index 0000000..16b7d46
--- /dev/null
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Exceptions.java
@@ -0,0 +1,35 @@
+package org.apache.yoko.orb.OCI.IIOP;
+
+import static org.apache.yoko.orb.OB.MinorCodes.*;
+
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.TRANSIENT;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+
+import static org.apache.yoko.orb.OB.MinorCodes.MinorSetsockopt;
+import static org.apache.yoko.orb.OB.MinorCodes.describeCommFailure;
+import static org.omg.CORBA.CompletionStatus.COMPLETED_NO;
+
+enum Exceptions {;
+    static COMM_FAILURE asCommFailure(SocketException e) {return asCommFailure(e, MinorSetsockopt);}
+    static COMM_FAILURE asCommFailure(UnknownHostException e) {return asCommFailure(e, MinorGethostbyname);}
+
+    static COMM_FAILURE asCommFailure(IOException e, int minor) {
+        String msg = String.format("%s: %s", describeCommFailure(minor), e.getMessage());
+        return (COMM_FAILURE) new COMM_FAILURE(msg, minor, COMPLETED_NO).initCause(e);
+    }
+
+    static COMM_FAILURE asCommFailure(Exception e, int minor, String message) {
+        String msg = String.format("%s: %s: %s", describeCommFailure(minor), message, e.getMessage());
+        return (COMM_FAILURE) new COMM_FAILURE(msg, minor, COMPLETED_NO).initCause(e);
+    }
+
+    static TRANSIENT asTransient(Exception e, int minor) {
+        String msg = String.format("%s: %s", describeTransient(minor), e.getMessage());
+        return (TRANSIENT) new TRANSIENT(msg, minor, COMPLETED_NO);
+    }
+}

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/TransportInfo_impl.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/TransportInfo_impl.java b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/TransportInfo_impl.java
index 54ce73e..353de16 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/TransportInfo_impl.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/TransportInfo_impl.java
@@ -18,27 +18,32 @@
 package org.apache.yoko.orb.OCI.IIOP;
 
 import java.net.Socket;
+import java.util.Objects;
+
+import org.apache.yoko.orb.CORBA.InputStream;
+import org.apache.yoko.orb.OB.Net;
+import org.apache.yoko.orb.OCI.*;
+import org.omg.BiDirPolicy.BIDIRECTIONAL_POLICY_TYPE;
+import org.omg.BiDirPolicy.BOTH;
+import org.omg.BiDirPolicy.BidirectionalPolicy;
+import org.omg.BiDirPolicy.BidirectionalPolicyHelper;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.NO_RESOURCES;
+import org.omg.CORBA.Policy;
+import org.omg.IIOP.BiDirIIOPServiceContext;
+import org.omg.IIOP.BiDirIIOPServiceContextHelper;
+import org.omg.IIOP.ListenPoint;
+import org.omg.IOP.BI_DIR_IIOP;
+import org.omg.IOP.ServiceContext;
+import org.omg.IOP.TAG_INTERNET_IOP;
+
+public final class TransportInfo_impl extends LocalObject implements TransportInfo {
+    private enum Origin{CLIENT(CLIENT_SIDE.value), SERVER(SERVER_SIDE.value); final short value; Origin(int v) {value = (short)v;}}
+    private final Socket socket;
+    private final Origin origin;
+    private final ListenerMap listenMap_;
+    private volatile ListenPoint[] listenPoints_ = null;
 
-import org.apache.yoko.orb.OCI.IIOP.PLUGIN_ID;
-import org.apache.yoko.orb.OCI.IIOP.TransportInfo;
-
-public final class TransportInfo_impl extends org.omg.CORBA.LocalObject
-        implements TransportInfo {
-    private org.apache.yoko.orb.OCI.ConnectorInfo connectorInfo_; // connector
-                                                                    // info
-
-    private org.apache.yoko.orb.OCI.AcceptorInfo acceptorInfo_; // acceptor info
-
-    private Transport_impl transport_; // associated transport
-
-    private org.omg.IIOP.ListenPoint[] listenPoints_ = null;
-
-    private ListenerMap listenMap_;
-
-    //
-    // All close callback objects
-    //
-    private java.util.Vector closeCBVec_ = new java.util.Vector();
 
     // ------------------------------------------------------------------
     // Standard IDL to Java Mapping
@@ -49,14 +54,11 @@ public final class TransportInfo_impl extends org.omg.CORBA.LocalObject
     }
 
     public int tag() {
-        return org.omg.IOP.TAG_INTERNET_IOP.value;
+        return TAG_INTERNET_IOP.value;
     }
 
     public short origin() {
-        if (acceptorInfo_ == null)
-            return org.apache.yoko.orb.OCI.CLIENT_SIDE.value;
-        else
-            return org.apache.yoko.orb.OCI.SERVER_SIDE.value;
+        return origin.value;
     }
 
     public synchronized String describe() {
@@ -79,94 +81,32 @@ public final class TransportInfo_impl extends org.omg.CORBA.LocalObject
         return desc;
     }
 
-    public synchronized org.apache.yoko.orb.OCI.ConnectorInfo connector_info() {
-        return connectorInfo_;
-    }
-
-    public synchronized org.apache.yoko.orb.OCI.AcceptorInfo acceptor_info() {
-        return acceptorInfo_;
-    }
-
-    public synchronized void add_close_cb(org.apache.yoko.orb.OCI.CloseCB cb) {
-        int length = closeCBVec_.size();
-        for (int i = 0; i < length; i++)
-            if (closeCBVec_.elementAt(i) == cb)
-                return; // Already registered
-        closeCBVec_.addElement(cb);
-    }
-
-    public synchronized void remove_close_cb(org.apache.yoko.orb.OCI.CloseCB cb) {
-        int length = closeCBVec_.size();
-        for (int i = 0; i < length; i++)
-            if (closeCBVec_.elementAt(i) == cb) {
-                closeCBVec_.removeElementAt(i);
-                return;
-            }
-    }
-
-    public synchronized java.net.Socket socket() {
-        if (transport_ == null)
-            throw new org.omg.CORBA.NO_RESOURCES();
-
-        return transport_.socket_;
-    }
-
+    public Socket getSocket() {return socket;}
 
-    public synchronized String addr() {
-        if (transport_ == null)
-            throw new org.omg.CORBA.NO_RESOURCES();
+    public String addr() {return socket.getLocalAddress().getHostAddress();}
 
-        return transport_.socket_.getLocalAddress().getHostAddress();
-    }
-
-    public synchronized short port() {
-        if (transport_ == null)
-            throw new org.omg.CORBA.NO_RESOURCES();
-
-        int port = transport_.socket_.getLocalPort();
-
-        if (port >= 0x8000)
-            return (short) (port - 0xffff - 1);
-        else
-            return (short) port;
-    }
-
-    public synchronized String remote_addr() {
-        if (transport_ == null)
-            throw new org.omg.CORBA.NO_RESOURCES();
-
-        return transport_.socket_.getInetAddress().getHostAddress();
-    }
-
-    public synchronized short remote_port() {
-        if (transport_ == null)
-            throw new org.omg.CORBA.NO_RESOURCES();
+    public short port() {return (short)socket.getLocalPort();}
 
-        int port = transport_.socket_.getPort();
+    public String remote_addr() {return socket.getInetAddress().getHostAddress();}
 
-        if (port >= 0x8000)
-            return (short) (port - 0xffff - 1);
-        else
-            return (short) port;
-    }
+    public short remote_port() {return (short)socket.getPort();}
 
-    public org.omg.IOP.ServiceContext[] get_service_contexts(
-            org.omg.CORBA.Policy[] policies) {
-        org.omg.IOP.ServiceContext[] scl;
+    public ServiceContext[] get_service_contexts(Policy[] policies) {
+        ServiceContext[] scl;
         boolean bHaveBidir = false;
 
-        for (int i = 0; i < policies.length; i++) {
-            if (policies[i].policy_type() == org.omg.BiDirPolicy.BIDIRECTIONAL_POLICY_TYPE.value) {
-                org.omg.BiDirPolicy.BidirectionalPolicy p = org.omg.BiDirPolicy.BidirectionalPolicyHelper
-                        .narrow(policies[i]);
-                if (p.value() == org.omg.BiDirPolicy.BOTH.value)
+        for (Policy policy : policies) {
+            if (policy.policy_type() == BIDIRECTIONAL_POLICY_TYPE.value) {
+                BidirectionalPolicy p = BidirectionalPolicyHelper
+                        .narrow(policy);
+                if (p.value() == BOTH.value)
                     bHaveBidir = true;
                 break;
             }
         }
 
         if (bHaveBidir) {
-            org.omg.IIOP.BiDirIIOPServiceContext biDirCtxt = new org.omg.IIOP.BiDirIIOPServiceContext();
+            BiDirIIOPServiceContext biDirCtxt = new BiDirIIOPServiceContext();
             biDirCtxt.listen_points = listenMap_.getListenPoints();
 
             org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer();
@@ -200,22 +140,19 @@ public final class TransportInfo_impl extends org.omg.CORBA.LocalObject
     }
 
     public void handle_service_contexts(org.omg.IOP.ServiceContext[] contexts) {
-        for (int i = 0; i < contexts.length; i++) {
-            if (contexts[i].context_id == org.omg.IOP.BI_DIR_IIOP.value) {
-                byte[] pOct = contexts[i].context_data;
-                int len = contexts[i].context_data.length;
-
-                org.apache.yoko.orb.OCI.Buffer buf = new org.apache.yoko.orb.OCI.Buffer(
-                        pOct, len);
-                org.apache.yoko.orb.CORBA.InputStream in = new org.apache.yoko.orb.CORBA.InputStream(
-                        buf, 0, false);
+        for (ServiceContext context : contexts) {
+            if (context.context_id == BI_DIR_IIOP.value) {
+                byte[] pOct = context.context_data;
+                int len = context.context_data.length;
+
+                Buffer buf = new Buffer(pOct, len);
+                InputStream in = new InputStream(buf, 0, false);
                 in._OB_readEndian();
 
                 //
                 // unmarshal the octets back to the bidir format
                 //
-                org.omg.IIOP.BiDirIIOPServiceContext biDirCtxt = org.omg.IIOP.BiDirIIOPServiceContextHelper
-                        .read(in);
+                BiDirIIOPServiceContext biDirCtxt = BiDirIIOPServiceContextHelper.read(in);
 
                 //
                 // save the listening points in the transport
@@ -228,14 +165,10 @@ public final class TransportInfo_impl extends org.omg.CORBA.LocalObject
     }
 
     public synchronized boolean received_bidir_SCL() {
-        if (listenPoints_ == null)
-            return false;
-
-        return (listenPoints_.length > 0);
+        return listenPoints_ != null && (listenPoints_.length > 0);
     }
 
-    public synchronized boolean endpoint_alias_match(
-            org.apache.yoko.orb.OCI.ConnectorInfo connInfo) {
+    public synchronized boolean endpoint_alias_match(org.apache.yoko.orb.OCI.ConnectorInfo connInfo) {
         //
         // we only deal with Connectors that are of our specific type,
         // namely IIOP connectors (and ConnectorInfos)
@@ -257,10 +190,10 @@ public final class TransportInfo_impl extends org.omg.CORBA.LocalObject
         short port = infoImpl.remote_port();
         String host = infoImpl.remote_addr();
 
-        for (int i = 0; i < listenPoints_.length; i++) {
-            if ((listenPoints_[i].port == port)
-                    && org.apache.yoko.orb.OB.Net.CompareHosts(
-                            listenPoints_[i].host, host))
+        for (ListenPoint aListenPoints_ : listenPoints_) {
+            if ((aListenPoints_.port == port)
+                    && Net.CompareHosts(
+                    aListenPoints_.host, host))
                 return true;
         }
 
@@ -279,31 +212,20 @@ public final class TransportInfo_impl extends org.omg.CORBA.LocalObject
     // Yoko internal functions
     // Application programs must not use these functions directly
     // ------------------------------------------------------------------
-
-    TransportInfo_impl(Transport_impl transport,
-            org.apache.yoko.orb.OCI.Connector connector, ListenerMap lm) {
-        transport_ = transport;
-        connectorInfo_ = connector.get_info();
+    private TransportInfo_impl(Socket socket, Origin origin, ListenerMap lm) {
+        this.socket = socket;
+        this.origin = origin;
         listenMap_ = lm;
     }
 
-    TransportInfo_impl(Transport_impl transport,
-            org.apache.yoko.orb.OCI.Acceptor acceptor, ListenerMap lm) {
-        transport_ = transport;
-        acceptorInfo_ = acceptor.get_info();
-        listenMap_ = lm;
-    }
 
-    synchronized void _OB_callCloseCB(org.apache.yoko.orb.OCI.TransportInfo info) {
-        int length = closeCBVec_.size();
-        for (int i = 0; i < length; i++) {
-            org.apache.yoko.orb.OCI.CloseCB cb = (org.apache.yoko.orb.OCI.CloseCB) closeCBVec_
-                    .elementAt(i);
-            cb.close_cb(info);
-        }
+    // client-side constructor
+    TransportInfo_impl(Transport_impl transport, ListenerMap lm) {
+        this(transport.socket_, Origin.CLIENT, lm);
     }
 
-    synchronized void _OB_destroy() {
-        transport_ = null;
+    //server-side constructor
+    TransportInfo_impl(Transport_impl transport, Acceptor acceptor, ListenerMap lm) {
+        this(transport.socket_, Origin.SERVER, lm);
     }
 }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Transport_impl.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Transport_impl.java b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Transport_impl.java
index ec24f27..e986502 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Transport_impl.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/IIOP/Transport_impl.java
@@ -17,16 +17,29 @@
 
 package org.apache.yoko.orb.OCI.IIOP;
 
+import static org.apache.yoko.orb.OCI.IIOP.Exceptions.*;
+import static org.apache.yoko.orb.OB.MinorCodes.*;
+
+import org.apache.yoko.orb.OB.MinorCodes;
+import org.apache.yoko.orb.OCI.Acceptor;
+import org.apache.yoko.orb.OCI.SendReceiveMode;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.NO_IMPLEMENT;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.net.Socket;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.yoko.orb.OCI.IIOP.PLUGIN_ID;
+import static org.apache.yoko.orb.OCI.SendReceiveMode.*;
 
 final public class Transport_impl extends org.omg.CORBA.LocalObject implements
         org.apache.yoko.orb.OCI.Transport {
     // This data member must not be private because the info object
     // must be able to access it
-    public java.net.Socket socket_; // The socket
+    public final java.net.Socket socket_; // The socket
 
     private java.io.InputStream in_; // The socket's input stream
 
@@ -54,7 +67,7 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
             } catch (java.net.SocketException ex) {
                 logger.log(Level.FINE, "Socket setup error", ex); 
                 
-                throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
+                throw (COMM_FAILURE)new COMM_FAILURE(
                         org.apache.yoko.orb.OB.MinorCodes
                                 .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSetSoTimeout)
                                 + ": socket error during setSoTimeout: "
@@ -63,7 +76,7 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
                         org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
             } catch (java.lang.NullPointerException ex) {
                 logger.log(Level.FINE, "Socket setup error", ex); 
-                throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
+                throw (COMM_FAILURE)new COMM_FAILURE(
                         org.apache.yoko.orb.OB.MinorCodes
                                 .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSetSoTimeout)
                                 + ": NullPointerException error during setSoTimeout: "
@@ -86,41 +99,27 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
     // shutdown the receiving side. If how == 1, shutdown the sending
     // side. If how == 2, shutdown both.
     //
-    private static void shutdownSocket(java.net.Socket socket, int how) {
-        if (socket == null) // Socket already closed
-            return;
-
-        if (how == 2) {
-            shutdownSocket(socket, 0);
-            shutdownSocket(socket, 1);
-            return;
-        }
-
+    private void shutdownSocket() {
         try {
-            if (how == 0) {
                 try {
-                    socket.shutdownInput();
+                    socket_.shutdownInput();
                 } catch (UnsupportedOperationException e) {
                 // if we're using an SSL connection, this is an unsupported operation.
                 // just ignore the error and proceed to the close.
                 }
-            } else if (how == 1) {
                 try {
-                    socket.shutdownOutput();
+                    socket_.shutdownOutput();
                 } catch (UnsupportedOperationException e) {
                 // if we're using an SSL connection, this is an unsupported operation.
                 // just ignore the error and proceed to the close.
                 }
-            } else {
-                throw new InternalError();
-            }
         } catch (java.net.SocketException ex) {
             //
             // Some VMs (namely JRockit) raise a SocketException if
             // the socket has already been closed.
             // This exception can be ignored.
             //
-        } catch (java.io.IOException ex) {
+        } catch (IOException ex) {
             logger.log(Level.FINE, "Socket shutdown error", ex); 
             throw (InternalError)new InternalError().initCause(ex);
         }
@@ -138,28 +137,15 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
         return org.omg.IOP.TAG_INTERNET_IOP.value;
     }
 
-    public org.apache.yoko.orb.OCI.SendReceiveMode mode() {
-        return org.apache.yoko.orb.OCI.SendReceiveMode.SendReceive;
+    public SendReceiveMode mode() {
+        return SendReceive;
     }
 
     public int handle() {
-        throw new org.omg.CORBA.NO_IMPLEMENT();
+        throw new NO_IMPLEMENT();
     }
 
     public void close() {
-        if (socket_ == null) // shutdown() may call close()
-            return;
-
-        //
-        // Call callbacks
-        //
-        info_._OB_callCloseCB(info_);
-
-        //
-        // Destroy the info object
-        //
-        info_._OB_destroy();
-
         //
         // I must set socket_ to null *before* the close or the code
         // below, to avoid a race condition with send/receive
@@ -168,26 +154,22 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
         //
         // Close the socket
         //
-        java.net.Socket saveSocket = socket_;
-        socket_ = null; // Must be set to null before the shutdown/close
-        shutdownSocket(saveSocket, 2); // This helps to unblock threads
+        shutdownSocket(); // This helps to unblock threads
         // blocking in recv()
         try {
-            saveSocket.close();
-        } catch (java.io.IOException ex) {
+            socket_.close();
+        } catch (IOException ex) {
         }
     }
 
     public void shutdown() {
         logger.info("shutdown: " + this); 
         shutdown_ = true;
-        shutdownSocket(socket_, 2); // Shutdown send side only
-        if (socket_ != null) {
-            // blocking in recv()
-            try {
-                socket_.close();
-            } catch (java.io.IOException ex) {
-            }
+        shutdownSocket(); // Shutdown send side only
+        // blocking in recv()
+        try {
+            socket_.close();
+        } catch (IOException ex) {
         }
     }
 
@@ -199,47 +181,28 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
             try {
                 int result = in_.read(buf.data(), buf.pos(), buf.rest_length());
                 if (result <= 0) {
-                    throw new org.omg.CORBA.COMM_FAILURE(
-                            org.apache.yoko.orb.OB.MinorCodes
-                                    .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorRecvZero),
-                            org.apache.yoko.orb.OB.MinorCodes.MinorRecvZero,
-                            org.omg.CORBA.CompletionStatus.COMPLETED_NO);
+                    throw new COMM_FAILURE(describeCommFailure(MinorRecvZero), MinorRecvZero, CompletionStatus.COMPLETED_NO);
                 }
                 buf.advance(result);
-            } catch (java.io.InterruptedIOException ex) {
+            } catch (InterruptedIOException ex) {
                 logger.log(Level.FINE, "Received interrupted exception", ex); 
                 buf.advance(ex.bytesTransferred);
 
                 if (!block)
                     return;
                 if (shutdown_)
-                    throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                            org.apache.yoko.orb.OB.MinorCodes
-                                    .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorRecv)
-                                    + ": IOInterrupted exception during shutdown: " + ex.getMessage(), 
-                            org.apache.yoko.orb.OB.MinorCodes.MinorRecv,
-                            org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex); 
-                    
+                    throw asCommFailure(ex, MinorCodes.MinorRecv, "Interrupted I/O exception during shutdown");
             } catch (java.io.IOException ex) {
                 logger.log(Level.FINE, "Socket read error", ex); 
-                throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                        org.apache.yoko.orb.OB.MinorCodes
-                                .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorRecv)
-                                + ": I/O error during read: " + ex.getMessage(), 
-                        org.apache.yoko.orb.OB.MinorCodes.MinorRecv,
-                        org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex); 
+                throw asCommFailure(ex, MinorCodes.MinorRecv, "I/O error during read");
             } catch (java.lang.NullPointerException ex) {
-                logger.log(Level.FINE, "Socket read error", ex); 
-                throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                        org.apache.yoko.orb.OB.MinorCodes
-                                .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorRecv)
-                                + ": NullPointerException during read",
-                        org.apache.yoko.orb.OB.MinorCodes.MinorRecv,
-                        org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
+                logger.log(Level.FINE, "Socket read error", ex);
+                throw asCommFailure(ex, MinorCodes.MinorRecv, "NullPointerException during read");
             }
         }
     }
 
+
     public boolean receive_detect(org.apache.yoko.orb.OCI.Buffer buf,
             boolean block) {
         setBlock(block);
@@ -280,11 +243,7 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
             try {
                 int result = in_.read(buf.data(), buf.pos(), buf.rest_length());
                 if (result <= 0) {
-                    throw new org.omg.CORBA.COMM_FAILURE(
-                            org.apache.yoko.orb.OB.MinorCodes
-                                    .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorRecvZero),
-                            org.apache.yoko.orb.OB.MinorCodes.MinorRecvZero,
-                            org.omg.CORBA.CompletionStatus.COMPLETED_NO);
+                    throw new COMM_FAILURE(describeCommFailure(MinorRecvZero), MinorRecvZero, CompletionStatus.COMPLETED_NO);
                 }
                 buf.advance(result);
             } catch (java.io.InterruptedIOException ex) {
@@ -292,20 +251,10 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
                 return;
             } catch (java.io.IOException ex) {
                 logger.log(Level.FINE, "Socket read error", ex); 
-                throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                        org.apache.yoko.orb.OB.MinorCodes
-                                .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorRecv)
-                                + ": I/O error during read: " + ex.getMessage(), 
-                        org.apache.yoko.orb.OB.MinorCodes.MinorRecv,
-                        org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex); 
+                throw asCommFailure(ex, MinorRecv, "I/O error during read");
             } catch (java.lang.NullPointerException ex) {
                 logger.log(Level.FINE, "Socket read error", ex); 
-                throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                        org.apache.yoko.orb.OB.MinorCodes
-                                .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorRecv)
-                                + ": NullPointerException during read",
-                        org.apache.yoko.orb.OB.MinorCodes.MinorRecv,
-                        org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex); 
+                throw asCommFailure(ex, MinorRecv, "NullPointerException during read");
             }
         }
     }
@@ -355,21 +304,11 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
                 if (!block)
                     return;
             } catch (java.io.IOException ex) {
-                logger.log(Level.FINE, "Socket write error", ex); 
-                throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                        org.apache.yoko.orb.OB.MinorCodes
-                                .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSend)
-                                + ": I/O error during write: " + ex.getMessage(),
-                        org.apache.yoko.orb.OB.MinorCodes.MinorSend,
-                        org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
+                logger.log(Level.FINE, "Socket write error", ex);
+                throw asCommFailure(ex, MinorSend, "I/O error during write");
             } catch (java.lang.NullPointerException ex) {
-                logger.log(Level.FINE, "Socket write error", ex); 
-                throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                        org.apache.yoko.orb.OB.MinorCodes
-                                .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSend)
-                                + ": NullPointerException during write",
-                        org.apache.yoko.orb.OB.MinorCodes.MinorSend,
-                        org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
+                logger.log(Level.FINE, "Socket write error", ex);
+                throw asCommFailure(ex, MinorSend, "NullPointerException during write");
             }
         }
     }
@@ -417,21 +356,11 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
                 buf.advance(ex.bytesTransferred);
                 return;
             } catch (java.io.IOException ex) {
-                logger.log(Level.FINE,  "Socket write error", ex); 
-                throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                        org.apache.yoko.orb.OB.MinorCodes
-                                .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSend)
-                                + ": I/O error during write: " + ex.getMessage(),
-                        org.apache.yoko.orb.OB.MinorCodes.MinorSend,
-                        org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
+                logger.log(Level.FINE,  "Socket write error", ex);
+                throw asCommFailure(ex, MinorSend, "I/O error during write");
             } catch (java.lang.NullPointerException ex) {
-                logger.log(Level.FINE, "Socket write error", ex); 
-                throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                        org.apache.yoko.orb.OB.MinorCodes
-                                .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSend)
-                                + ": NullPointerException during write",
-                        org.apache.yoko.orb.OB.MinorCodes.MinorSend,
-                        org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
+                logger.log(Level.FINE, "Socket write error", ex);
+                throw asCommFailure(ex, MinorSend, "NullPointerException during write");
             }
         }
     }
@@ -472,8 +401,7 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
     // Application programs must not use these functions directly
     // ------------------------------------------------------------------
 
-    public Transport_impl(org.apache.yoko.orb.OCI.Connector connector,
-            java.net.Socket socket, ListenerMap lm) {
+    public Transport_impl(java.net.Socket socket, ListenerMap lm) {
         socket_ = socket;
         shutdown_ = false;
 
@@ -485,25 +413,18 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
             in_ = socket_.getInputStream();
             out_ = socket_.getOutputStream();
         } catch (java.io.IOException ex) {
-            logger.log(Level.FINE, "Socket setup error", ex); 
-            throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                    org.apache.yoko.orb.OB.MinorCodes
-                            .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSocket)
-                            + ": unable to obtain socket InputStream: "
-                            + ex.getMessage(),
-                    org.apache.yoko.orb.OB.MinorCodes.MinorSocket,
-                    org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
+            logger.log(Level.FINE, "Socket setup error", ex);
+            throw asCommFailure(ex, MinorSocket, "unable to obtain socket InputStream");
         }
 
         //
         // Since the Constructor of TransportInfo uses this object create
         // it after all members are initialized
         //
-        info_ = new TransportInfo_impl(this, connector, lm);
+        info_ = new TransportInfo_impl(this, lm);
     }
 
-    public Transport_impl(org.apache.yoko.orb.OCI.Acceptor acceptor,
-            java.net.Socket socket, ListenerMap lm) {
+    public Transport_impl(Acceptor acceptor, Socket socket, ListenerMap lm) {
         socket_ = socket;
         shutdown_ = false;
         
@@ -517,14 +438,8 @@ final public class Transport_impl extends org.omg.CORBA.LocalObject implements
             in_ = socket_.getInputStream();
             out_ = socket_.getOutputStream();
         } catch (java.io.IOException ex) {
-            logger.log(Level.FINE, "Socket setup error", ex); 
-            throw (org.omg.CORBA.COMM_FAILURE)new org.omg.CORBA.COMM_FAILURE(
-                    org.apache.yoko.orb.OB.MinorCodes
-                            .describeCommFailure(org.apache.yoko.orb.OB.MinorCodes.MinorSocket)
-                            + ": unable to obtain socket InputStream: "
-                            + ex.getMessage(),
-                    org.apache.yoko.orb.OB.MinorCodes.MinorSocket,
-                    org.omg.CORBA.CompletionStatus.COMPLETED_NO).initCause(ex);
+            logger.log(Level.FINE, "Socket setup error", ex);
+            throw asCommFailure(ex, MinorSocket, "unable to obtain socket InputStream");
         }
 
         //

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/main/java/org/apache/yoko/orb/OCI/TransportInfoOperations.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/TransportInfoOperations.java b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/TransportInfoOperations.java
index c2f423a..5f26fda 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/TransportInfoOperations.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/TransportInfoOperations.java
@@ -53,32 +53,10 @@ public interface TransportInfoOperations
     //
     // IDL:orb.yoko.apache.org/OCI/TransportInfo/connector_info:1.0
     //
-    /**
-     *
-     * The ConnectorInfo object for the Connector that created the
-     * Transport object that this TransportInfo object belongs to.
-     * If the Transport for this TransportInfo was not created by a
-     * Connector, this attribute is set to the nil object reference.
-     *
-     **/
-
-    ConnectorInfo
-    connector_info();
 
     //
     // IDL:orb.yoko.apache.org/OCI/TransportInfo/acceptor_info:1.0
     //
-    /**
-     *
-     * The AcceptorInfo object for the Acceptor that created the
-     * Transport object that this TransportInfo object belongs to.
-     * If the Transport for this TransportInfo was not created by an
-     * Acceptor, this attribute is set to the nil object reference.
-     *
-     **/
-
-    AcceptorInfo
-    acceptor_info();
 
     //
     // IDL:orb.yoko.apache.org/OCI/TransportInfo/origin:1.0
@@ -118,33 +96,10 @@ public interface TransportInfoOperations
     //
     // IDL:orb.yoko.apache.org/OCI/TransportInfo/add_close_cb:1.0
     //
-    /**
-     *
-     * Add a callback that is called before a connection is closed. If
-     * the callback has already been registered, this method has no
-     * effect.
-     *
-     * @param cb The callback to add.
-     *
-     **/
-
-    void
-    add_close_cb(CloseCB cb);
 
     //
     // IDL:orb.yoko.apache.org/OCI/TransportInfo/remove_close_cb:1.0
     //
-    /**
-     *
-     * Remove a close callback. If the callback was not registered,
-     * this method has no effect.
-     *
-     * @param cb The callback to remove.
-     *
-     **/
-
-    void
-    remove_close_cb(CloseCB cb);
 
     //
     // IDL:orb.yoko.apache.org/OCI/TransportInfo/get_service_contexts:1.0

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/main/java/org/apache/yoko/orb/OCI/iiop.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/iiop.java b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/iiop.java
index aacf2cd..2f43cc7 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/OCI/iiop.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/OCI/iiop.java
@@ -17,14 +17,12 @@
 
 package org.apache.yoko.orb.OCI;
 
-import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.yoko.orb.OB.Assert;
 import org.apache.yoko.orb.OB.AssertionFailed;
 import org.apache.yoko.orb.OCI.IIOP.ConnectionHelper;
 import org.apache.yoko.orb.OCI.IIOP.ExtendedConnectionHelper;
-import org.apache.yoko.util.osgi.ProviderLocator;
+import org.apache.yoko.osgi.ProviderLocator;
 
 public class iiop implements PluginInit {
     static final Logger logger = Logger.getLogger(iiop.class.getName());

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/main/java/org/apache/yoko/orb/activator/Activator.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/activator/Activator.java b/yoko-core/src/main/java/org/apache/yoko/orb/activator/Activator.java
index a80bc65..a6a2d0d 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/activator/Activator.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/activator/Activator.java
@@ -1,6 +1,6 @@
 package org.apache.yoko.orb.activator;
 
-import org.apache.yoko.util.osgi.locator.activator.AbstractBundleActivator;
+import org.apache.yoko.osgi.locator.activator.AbstractBundleActivator;
 
 public class Activator extends AbstractBundleActivator {
 

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/main/java/org/apache/yoko/orb/csi/SecurityContext.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/main/java/org/apache/yoko/orb/csi/SecurityContext.java b/yoko-core/src/main/java/org/apache/yoko/orb/csi/SecurityContext.java
index 5c7a2ac..d501f28 100644
--- a/yoko-core/src/main/java/org/apache/yoko/orb/csi/SecurityContext.java
+++ b/yoko-core/src/main/java/org/apache/yoko/orb/csi/SecurityContext.java
@@ -23,7 +23,7 @@ import javax.security.auth.login.LoginException;
 import java.security.AccessController;
 
 import org.apache.yoko.orb.util.GetSystemPropertyAction;
-import org.apache.yoko.util.osgi.ProviderLocator;
+import org.apache.yoko.osgi.ProviderLocator;
 
 public abstract class SecurityContext {
 

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/test/java/org/apache/yoko/ConnectionCachingTest.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/test/java/org/apache/yoko/ConnectionCachingTest.java b/yoko-core/src/test/java/org/apache/yoko/ConnectionCachingTest.java
new file mode 100644
index 0000000..230c4e4
--- /dev/null
+++ b/yoko-core/src/test/java/org/apache/yoko/ConnectionCachingTest.java
@@ -0,0 +1,203 @@
+package org.apache.yoko;
+
+import org.apache.yoko.orb.OBPortableServer.POA;
+import org.apache.yoko.orb.OBPortableServer.POAHelper;
+import org.apache.yoko.orb.OBPortableServer.POAManager;
+import org.apache.yoko.orb.OBPortableServer.POAManagerHelper;
+import org.apache.yoko.orb.OCI.Acceptor;
+import org.apache.yoko.orb.OCI.IIOP.AcceptorInfo;
+import org.apache.yoko.orb.OCI.IIOP.AcceptorInfoHelper;
+import org.apache.yoko.orb.spi.naming.NameServiceInitializer;
+import org.apache.yoko.orb.spi.naming.RemoteAccess;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CosNaming.*;
+import org.omg.PortableInterceptor.*;
+import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
+import test.util.Skellington;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.Properties;
+
+import static javax.rmi.PortableRemoteObject.narrow;
+
+public class ConnectionCachingTest {
+    private static final NameComponent[] OBJECT_NAME = { new NameComponent("object", "")};
+    ORB serverORB;
+    ORB clientORB;
+
+    @Before
+    public void setup() throws Exception {
+        serverORB = Util.createServerOrb();
+        clientORB = Util.createClientORB(serverORB);
+        // make a GIOP 1.0 call first
+        NamingContext ctx = NamingContextHelper.narrow(clientORB.string_to_object(Util.getNameServerUrl(serverORB)));
+        ctx.new_context();
+    }
+
+    @Test
+    public void testSingleNull() throws Exception {
+        Assert.assertEquals(null, newRemoteImpl(clientORB).bounce(null));
+    }
+
+    @Test
+    public void testSingleNullSameOrb() throws Exception {
+        Assert.assertEquals(null, newRemoteImpl(serverORB).bounce(null));
+    }
+
+    @Test
+    public void testSingleEmptyString() throws Exception {
+        Assert.assertEquals("", newRemoteImpl(clientORB).bounce(""));
+    }
+
+    @Test
+    public void testSingleEmptyStringSameOrb() throws Exception {
+        Assert.assertEquals("", newRemoteImpl(serverORB).bounce(""));
+    }
+
+    @Test
+    public void testSingleNonEmptyString() throws Exception {
+        Assert.assertEquals("hello", newRemoteImpl(clientORB).bounce("hello"));
+    }
+
+    @Test
+    public void testSingleNonEmptyStringSameOrb() throws Exception {
+        Assert.assertEquals("hello", newRemoteImpl(serverORB).bounce("hello"));
+    }
+
+    @Test
+    public void testLotsOfInvocations() throws Exception {
+        Assert.assertEquals(null, newRemoteImpl(clientORB).bounce(null));
+        Assert.assertEquals("", newRemoteImpl(clientORB).bounce(""));
+        Assert.assertEquals("a", newRemoteImpl(clientORB).bounce("a"));
+        Assert.assertEquals("ab", newRemoteImpl(clientORB).bounce("ab"));
+        Assert.assertEquals("abc", newRemoteImpl(clientORB).bounce("abc"));
+        Assert.assertEquals("abcd", newRemoteImpl(clientORB).bounce("abcd"));
+        Assert.assertEquals("abcde", newRemoteImpl(clientORB).bounce("abcde"));
+    }
+
+    @Test
+    public void testLotsOfInvocationsSameOrb() throws Exception {
+        Assert.assertEquals(null, newRemoteImpl(serverORB).bounce(null));
+        Assert.assertEquals("", newRemoteImpl(serverORB).bounce(""));
+        Assert.assertEquals("a", newRemoteImpl(serverORB).bounce("a"));
+        Assert.assertEquals("ab", newRemoteImpl(serverORB).bounce("ab"));
+        Assert.assertEquals("abc", newRemoteImpl(serverORB).bounce("abc"));
+        Assert.assertEquals("abcd", newRemoteImpl(serverORB).bounce("abcd"));
+        Assert.assertEquals("abcde", newRemoteImpl(serverORB).bounce("abcde"));
+    }
+
+    private TheInterface newRemoteImpl(ORB callerOrb) throws Exception {
+        TheImpl theImpl = new TheImpl();
+        theImpl.publish(serverORB);
+        // bind it into the naming context
+        Util.getNameService(serverORB).rebind(OBJECT_NAME, theImpl.thisObject());
+        // look it up from the caller orb
+        Object stub = Util.getNameService(callerOrb).resolve(OBJECT_NAME);
+        return (TheInterface)narrow(stub, TheInterface.class);
+    }
+
+    public interface TheInterface extends Remote {
+        String bounce(String text) throws RemoteException;
+    }
+
+    private static class TheImpl extends Skellington implements TheInterface {
+        @Override
+        protected OutputStream dispatch(String method, InputStream in, ResponseHandler reply) throws RemoteException {
+            switch (method) {
+                case "bounce":
+                    String result = bounce((String) in.read_value(String.class));
+                    OutputStream out = reply.createReply();
+                    ((org.omg.CORBA_2_3.portable.OutputStream) out).write_value(result, String.class);
+                    return out;
+                default:
+                    throw new BAD_OPERATION();
+            }
+        }
+
+        @Override
+        public String bounce(String s) {return s;}
+    }
+
+    public static class DummyInterceptor extends LocalObject implements ORBInitializer, ServerRequestInterceptor {
+
+        @Override
+        public String name() {
+            return "DummyInterceptor";
+        }
+
+        @Override
+        public void destroy() {}
+
+        @Override
+        public void pre_init(ORBInitInfo info) {}
+
+        @Override
+        public void post_init(ORBInitInfo info) {
+            try {
+                info.add_server_request_interceptor(this);
+            } catch (DuplicateName duplicateName) {
+                throw new Error(duplicateName);
+            }
+        }
+
+        @Override
+        public void receive_request_service_contexts(ServerRequestInfo ri) throws ForwardRequest {}
+
+        @Override
+        public void receive_request(ServerRequestInfo ri) throws ForwardRequest {}
+
+        @Override
+        public void send_reply(ServerRequestInfo ri) {}
+
+        @Override
+        public void send_exception(ServerRequestInfo ri) throws ForwardRequest {}
+
+        @Override
+        public void send_other(ServerRequestInfo ri) throws ForwardRequest {}
+    }
+
+
+    private static class Util {
+
+        private static int getPort(ORB orb) throws Exception {
+            POA rootPoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
+            POAManager poaMgr = POAManagerHelper.narrow(rootPoa.the_POAManager());
+            for (Acceptor acceptor : poaMgr.get_acceptors()) {
+                AcceptorInfo info = AcceptorInfoHelper.narrow(acceptor.get_info());
+                if (info != null) return (char) info.port();
+            }
+            throw new Error("No IIOP Acceptor found");
+        }
+
+        private static String getNameServerUrl(ORB orb) throws Exception {
+            return "corbaname::localhost:" + getPort(orb);
+        }
+
+        private static ORB createServerOrb() throws Exception {
+            Properties serverProps = new Properties();
+            serverProps.put(NameServiceInitializer.NS_ORB_INIT_PROP, "");
+            serverProps.put(NameServiceInitializer.NS_REMOTE_ACCESS_ARG, RemoteAccess.readWrite.toString());
+            serverProps.put(ORBInitializer.class.getName() + "Class." + DummyInterceptor.class.getName(), "");
+            ORB orb =  ORB.init((String[])null, serverProps);
+            POAHelper.narrow(orb.resolve_initial_references("RootPOA")).the_POAManager().activate();
+            return orb;
+        }
+
+        private static ORB createClientORB(ORB targetORB) throws Exception {
+            return ORB.init(new String[]{"-ORBInitRef", "NameService=" + getNameServerUrl(targetORB)}, null);
+        }
+
+        private static NamingContextExt getNameService(ORB orb) throws Exception {
+            return NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/test/java/org/apache/yoko/ConnectionCleanupTest.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/test/java/org/apache/yoko/ConnectionCleanupTest.java b/yoko-core/src/test/java/org/apache/yoko/ConnectionCleanupTest.java
new file mode 100644
index 0000000..564abfc
--- /dev/null
+++ b/yoko-core/src/test/java/org/apache/yoko/ConnectionCleanupTest.java
@@ -0,0 +1,150 @@
+package org.apache.yoko;
+
+import static javax.rmi.PortableRemoteObject.narrow;
+
+import org.apache.yoko.orb.OBPortableServer.POAHelper;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAManagerPackage.AdapterInactive;
+import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
+import org.omg.PortableServer.POAPackage.WrongPolicy;
+import test.util.MultiException;
+import test.util.Skellington;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.*;
+import java.util.concurrent.*;
+
+public class ConnectionCleanupTest {
+    ORB serverORB;
+    ORB clientORB;
+
+    @Before
+    public void setup() throws Exception {
+        serverORB = ORB.init((String[])null, null);
+        clientORB = ORB.init((String[])null, null);
+    }
+
+    @Test
+    public void testOneClient() throws Exception {
+        newRemoteImpl().gcAndSleep(1000);
+    }
+
+    private TheInterface newRemoteImpl() {
+        try {
+            return (TheInterface)narrow(clientORB.string_to_object(new TheImpl().publish(serverORB)), TheInterface.class);
+        } catch (InvalidName | AdapterInactive | WrongPolicy | ServantAlreadyActive e) {
+            e.printStackTrace();
+            throw new AssertionError(e);
+        }
+    }
+
+    @Test
+    public void testRecursiveClient() throws Exception {
+        newRemoteImpl().gcAndSleepRecursive(10000, 100);
+    }
+
+    //@Test
+    public void doNotTestOneHundredClients() throws Throwable {
+        // To avoid multiple threads initializing the singleton at once
+        // during the first call to PRO.narrow() force it to be called
+        // once before the other threads start.
+        testOneClient();
+        // OK - now do a hundred threads.
+        List<Future<Throwable>> futures = new ArrayList<>();
+        ExecutorService xs = Executors.newFixedThreadPool(100);
+        final CyclicBarrier cb = new CyclicBarrier(101);
+        for (int i = 0; i < 100; i++) {
+            futures.add(xs.submit(new Callable<Throwable>() {
+                @Override
+                public Throwable call() throws Exception {
+                    try {
+                        cb.await();
+                        recurse(10); // use recursion so stack trace tells us how far in we failed
+                        return null;
+                    } catch (Throwable t) {
+                        return t;
+                    }
+                }
+                private void recurse(int times) throws Exception {
+                    testOneClient();
+                    if (times > 0) recurse(times - 1);
+                }
+            }));
+        }
+        cb.await();
+
+        MultiException me = new MultiException(futures);
+        if (me.isEmpty()) return;
+        throw me;
+    }
+
+
+    public interface TheInterface extends Remote {
+        void gcAndSleep(long millis) throws RemoteException;
+        void gcAndSleepRecursive(long millis, int depth) throws RemoteException;
+    }
+
+    private class TheImpl extends Skellington implements TheInterface {
+        @Override
+        public void gcAndSleep(long millis) {
+            //forceGarbageCollection();
+            try {
+                Thread.sleep(millis);
+            } catch (InterruptedException ignored) {}
+        }
+
+        @Override
+        public void gcAndSleepRecursive(long millis, int depth) throws RemoteException  {
+            if (depth == 1)
+                newRemoteImpl().gcAndSleep(millis);
+            else
+                newRemoteImpl().gcAndSleepRecursive(millis, depth - 1);
+        }
+
+        @Override
+        protected OutputStream dispatch(String method, InputStream in, ResponseHandler reply) throws RemoteException {
+            switch (method) {
+                case "gcAndSleep":
+                    gcAndSleep(in.read_longlong());
+                    return reply.createReply();
+                case "gcAndSleepRecursive":
+                    gcAndSleepRecursive(in.read_longlong(), in.read_long());
+                    return reply.createReply();
+                default:
+                    throw new BAD_OPERATION();
+            }
+        }
+    }
+
+    private static long forceGarbageCollection() {
+        List<byte[]> extents = new ArrayList<>();
+        long tally = 0;
+        // allocate as much as possible, halve the size and try again
+        for (int i = 30; i >= 0; i--) {
+            try {
+                do {
+                    int alloc = 1 << i;
+                    extents.add(new byte[alloc]);
+                    tally += alloc;
+                } while (true);
+            } catch (OutOfMemoryError oom) {}
+        }
+        // now the heap should be full so even the smallest allocation should fail
+        try {
+            for (int i = 0; i < 1024; i++) extents.add(new byte[128]);
+            Assert.fail("this allocation should have failed");
+        } catch (OutOfMemoryError e) {}
+        System.gc();
+        return tally;
+    }
+}

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/test/java/org/apache/yoko/processmanager/internal/ProcessAgentImpl.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/test/java/org/apache/yoko/processmanager/internal/ProcessAgentImpl.java b/yoko-core/src/test/java/org/apache/yoko/processmanager/internal/ProcessAgentImpl.java
index a9e9bd4..b9faca1 100755
--- a/yoko-core/src/test/java/org/apache/yoko/processmanager/internal/ProcessAgentImpl.java
+++ b/yoko-core/src/test/java/org/apache/yoko/processmanager/internal/ProcessAgentImpl.java
@@ -27,7 +27,7 @@ import java.rmi.server.UnicastRemoteObject;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.yoko.util.osgi.ProviderLocator;
+import org.apache.yoko.osgi.ProviderLocator;
 
 public class ProcessAgentImpl extends UnicastRemoteObject implements ProcessAgent {
     private static final long serialVersionUID = 1L;

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/test/java/test/iiopplugin/ClientPlugin.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/test/java/test/iiopplugin/ClientPlugin.java b/yoko-core/src/test/java/test/iiopplugin/ClientPlugin.java
index 95a29a7..6745f05 100644
--- a/yoko-core/src/test/java/test/iiopplugin/ClientPlugin.java
+++ b/yoko-core/src/test/java/test/iiopplugin/ClientPlugin.java
@@ -30,7 +30,6 @@ import java.net.ServerSocket;
 import java.net.Socket;
 
 import org.apache.yoko.orb.OCI.IIOP.ConnectionHelper;
-import org.omg.CORBA.DynAnyPackage.Invalid;
 import org.omg.CORBA.ORB;
 import org.omg.CORBA.Policy;
 import org.omg.IOP.IOR;

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/test/java/test/iiopplugin/ServerPlugin.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/test/java/test/iiopplugin/ServerPlugin.java b/yoko-core/src/test/java/test/iiopplugin/ServerPlugin.java
index 28c7355..2f8a923 100644
--- a/yoko-core/src/test/java/test/iiopplugin/ServerPlugin.java
+++ b/yoko-core/src/test/java/test/iiopplugin/ServerPlugin.java
@@ -30,7 +30,6 @@ import java.net.ServerSocket;
 import java.net.Socket;
 
 import org.apache.yoko.orb.OCI.IIOP.ConnectionHelper;
-import org.omg.CORBA.DynAnyPackage.Invalid;
 import org.omg.CORBA.Policy;
 import org.omg.CORBA.ORB;
 import org.omg.IOP.IOR;

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/test/java/test/iiopplugin/ServiceContextInterceptor.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/test/java/test/iiopplugin/ServiceContextInterceptor.java b/yoko-core/src/test/java/test/iiopplugin/ServiceContextInterceptor.java
index faeb14a..64c2841 100644
--- a/yoko-core/src/test/java/test/iiopplugin/ServiceContextInterceptor.java
+++ b/yoko-core/src/test/java/test/iiopplugin/ServiceContextInterceptor.java
@@ -46,9 +46,9 @@ final class ServiceContextInterceptor extends LocalObject implements ServerReque
         ServerRequestInfoExt riExt = (ServerRequestInfoExt) ri;
         TransportInfo_impl connection = (TransportInfo_impl)riExt.getTransportInfo();
         if (connection != null) {
-            Socket socket = connection.socket();
-            if (socket != null) {
-                System.out.println("Retrieved socket successfully");
+            String remoteHost = connection.remote_addr();
+            if (remoteHost != null && remoteHost.length() > 0) {
+                System.out.println("Retrieved remote host successfully");
                 return;
             }
         }

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/test/java/test/ins/Server.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/test/java/test/ins/Server.java b/yoko-core/src/test/java/test/ins/Server.java
index d7c2840..fa81ee2 100644
--- a/yoko-core/src/test/java/test/ins/Server.java
+++ b/yoko-core/src/test/java/test/ins/Server.java
@@ -114,10 +114,8 @@ public final class Server {
         // Create POA
         //
         Policy[] policies = new Policy[2];
-        policies[0] = poa
-                .create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID);
-        policies[1] = poa
-                .create_lifespan_policy(LifespanPolicyValue.PERSISTENT);
+        policies[0] = poa.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID);
+        policies[1] = poa.create_lifespan_policy(LifespanPolicyValue.PERSISTENT);
         POA testPOA = poa.create_POA("testPOA", manager, policies);
 
         //

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/test/java/test/util/MultiException.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/test/java/test/util/MultiException.java b/yoko-core/src/test/java/test/util/MultiException.java
new file mode 100644
index 0000000..23f9984
--- /dev/null
+++ b/yoko-core/src/test/java/test/util/MultiException.java
@@ -0,0 +1,61 @@
+package test.util;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+public class MultiException extends RuntimeException {
+    private static final String SEP = "--------------------------------------------------------------------------------";
+    private static final String NULL_COUNT_FORMAT = SEP + "%n%d \u2715 null%n" + SEP + "%n";
+    private static final String ENTRY_FORMAT = "%n" + SEP + "%n%d \u2715 %s" + SEP + "%n";
+    private Map<String, Integer> map = new TreeMap<>();
+    private int nullCount;
+
+    public boolean isEmpty() {
+        return map.isEmpty();
+    }
+
+    public Integer add(Throwable t) {
+        if (t == null) return nullCount++;
+        String desc = getDescription(t);
+        Integer count = map.get(desc);
+        return count == null ?
+                map.put(desc, 1) :
+                map.put(desc, ++count);
+    }
+
+    private String getDescription(Throwable t) {
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        pw.println(t);
+        pw.println(SEP);
+        t.printStackTrace(pw);
+        pw.flush();
+        return sw.getBuffer().toString();
+    }
+
+    public <T extends Throwable, F extends Future<T>> MultiException(Iterable<F> results) {
+        for (F f : results)
+            try {
+                add(f.get());
+            } catch (InterruptedException | ExecutionException e) {
+                add(e);
+            }
+    }
+
+    @Override
+    public void printStackTrace(PrintStream s) {
+        s.printf(NULL_COUNT_FORMAT, nullCount);
+        for (Map.Entry<String, Integer> e : map.entrySet()) s.printf(ENTRY_FORMAT, e.getValue(), e.getKey());
+    }
+
+    @Override
+    public void printStackTrace(PrintWriter s) {
+        s.printf(NULL_COUNT_FORMAT, nullCount);
+        for (Map.Entry<String, Integer> e : map.entrySet()) s.printf(ENTRY_FORMAT, e.getValue(), e.getKey());
+    }
+}

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-core/src/test/java/test/util/Skellington.java
----------------------------------------------------------------------
diff --git a/yoko-core/src/test/java/test/util/Skellington.java b/yoko-core/src/test/java/test/util/Skellington.java
new file mode 100644
index 0000000..5e2f0b5
--- /dev/null
+++ b/yoko-core/src/test/java/test/util/Skellington.java
@@ -0,0 +1,127 @@
+package test.util;
+
+import org.apache.yoko.orb.OBPortableServer.POAHelper;
+import org.junit.Assert;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAManagerPackage.AdapterInactive;
+import org.omg.PortableServer.POAPackage.ObjectNotActive;
+import org.omg.PortableServer.POAPackage.ServantAlreadyActive;
+import org.omg.PortableServer.POAPackage.ServantNotActive;
+import org.omg.PortableServer.POAPackage.WrongPolicy;
+import org.omg.PortableServer.Servant;
+
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+import java.lang.reflect.Method;
+import java.rmi.NoSuchObjectException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.util.*;
+
+public abstract class Skellington extends Servant implements Tie, Remote {
+    private final Collection<Class<? extends Remote>> interfaceClasses;
+    private final String[] ids;
+
+    public Skellington() {
+        Set<Class<? extends Remote>> ifaces = new HashSet<>();
+        for (Class<?> c = this.getClass(); c != Object.class; c = c.getSuperclass()) {
+            NEXT_CLASS: for (Class<?> iface: c.getInterfaces()) {
+                if (Remote.class.isAssignableFrom(iface)) {
+                    for (Method m : iface.getMethods()) {
+                        if (Arrays.asList(m.getExceptionTypes()).contains(RemoteException.class))
+                            continue;
+                        continue NEXT_CLASS;
+                    }
+                    // there were no non-remote methods, so add the interface
+                    ifaces.add((Class<? extends Remote>)iface);
+                }
+            }
+        }
+        final ValueHandler vh = Util.createValueHandler();
+        this.interfaceClasses = Collections.unmodifiableSet(ifaces);
+        this.ids = new String[interfaceClasses.size()];
+        int index = 0;
+        for (Class<?> c : interfaceClasses)
+            this.ids[index++] = vh.getRMIRepositoryID(c);
+    }
+
+    public Skellington(Class<? extends Remote>... interfaces) {
+        final ValueHandler vh = Util.createValueHandler();
+        ids = new String[interfaces.length];
+        List<Class<? extends Remote>> iflst = new ArrayList<>();
+        for (int i = 0; i < interfaces.length; i++) {
+            Assert.assertTrue(interfaces[i].isInterface());
+            iflst.add(interfaces[i]);
+            ids[i] = vh.getRMIRepositoryID(interfaces[i]);
+        }
+        this.interfaceClasses = Collections.unmodifiableList(iflst);
+    }
+
+    @Override
+    public String[] _all_interfaces(POA poa, byte[] objectId) {
+        return ids.clone();
+    }
+
+    @Override
+    public org.omg.CORBA.Object thisObject() {
+        return _this_object();
+    }
+
+    @Override
+    public void deactivate() throws NoSuchObjectException {
+        try{
+            _poa().deactivate_object(_poa().servant_to_id(this));
+        } catch (WrongPolicy |ObjectNotActive |ServantNotActive ignored){}
+    }
+
+    @Override
+    public ORB orb() {return _orb();}
+
+    @Override
+    public void orb(ORB orb) {
+        try {
+            ((org.omg.CORBA_2_3.ORB)orb).set_delegate(this);
+        } catch(ClassCastException e) {
+            throw new BAD_PARAM("POA Servant requires an instance of org.omg.CORBA_2_3.ORB");
+        }
+    }
+
+    @Override
+    public void setTarget(Remote target) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Remote getTarget() {
+        return this;
+    }
+
+    @Override
+    public OutputStream  _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException {
+        try {
+            return dispatch(method, (org.omg.CORBA_2_3.portable.InputStream) _in, reply);
+        } catch (SystemException ex) {
+            throw ex;
+        } catch (Throwable ex) {
+            throw new UnknownException(ex);
+        }
+    }
+
+    public String publish(ORB serverORB) throws InvalidName, AdapterInactive, ServantAlreadyActive, WrongPolicy {
+        POA rootPOA = POAHelper.narrow(serverORB.resolve_initial_references("RootPOA"));
+        rootPOA.the_POAManager().activate();
+        rootPOA.activate_object(this);
+        return serverORB.object_to_string(thisObject());
+    }
+
+    protected abstract OutputStream dispatch(String method, org.omg.CORBA_2_3.portable.InputStream in, ResponseHandler reply) throws RemoteException;
+}

http://git-wip-us.apache.org/repos/asf/geronimo-yoko/blob/f580371d/yoko-osgi/pom.xml
----------------------------------------------------------------------
diff --git a/yoko-osgi/pom.xml b/yoko-osgi/pom.xml
new file mode 100644
index 0000000..8f9468a
--- /dev/null
+++ b/yoko-osgi/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  See the NOTICE file distributed with
+*  this work for additional information regarding copyright ownership.
+*  The ASF licenses this file to You under the Apache License, Version 2.0
+*  (the "License"); you may not use this file except in compliance with
+*  the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+*  Unless required by applicable law or agreed to in writing, software
+*  distributed under the License is distributed on an "AS IS" BASIS,
+*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+*  See the License for the specific language governing permissions and
+*  limitations under the License.
+* -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>yoko</artifactId>
+        <groupId>org.apache.yoko</groupId>
+        <version>1.5-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>yoko-osgi</artifactId>
+
+    <name>Apache Yoko OSGi Utilities</name>
+
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <!-- this contains the osgi-relevant classes in the endorsed dir -->
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>5.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>5.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Export-Package>
+                            org.apache.yoko.osgi
+                        </Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>


Mime
View raw message