tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject svn commit: r1511348 [1/3] - in /tomee/tomee/trunk/server: openejb-client/src/main/java/org/apache/openejb/client/ openejb-client/src/test/java/org/apache/openejb/client/ openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/ openejb-ejbd/src/test/...
Date Wed, 07 Aug 2013 15:06:22 GMT
Author: andygumbrecht
Date: Wed Aug  7 15:06:21 2013
New Revision: 1511348

URL: http://svn.apache.org/r1511348
Log:
Steps to ensure legacy client compatibility through ProtocolMetaData propagation - In progress, but initial testing seems OK.

Any Externalizable must respect order of readExternal and writeExternal and can now check the ProtocolMetaData for versioning on future changes.

Request and response handling are now separate methods, which ensures a more logical processing.

Added:
    tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/RequestHandler.java
Modified:
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ArrayEnumeration.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/AuthenticationRequest.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/AuthenticationResponse.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClientMetaData.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClientSecurity.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterMetaData.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterRequest.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterResponse.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/DataSourceMetaData.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandle.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeProxyHandle.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBMetaDataImpl.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandle.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectProxyHandle.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/InjectionMetaData.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIRequest.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIResponse.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/NameClassPairEnumeration.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ProtocolMetaData.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Response.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ServerMetaData.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ThrowableArtifact.java
    tomee/tomee/trunk/server/openejb-client/src/test/java/org/apache/openejb/client/JndiRequestTest.java
    tomee/tomee/trunk/server/openejb-client/src/test/java/org/apache/openejb/client/OverlyStickyConnectionTest.java
    tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/AuthRequestHandler.java
    tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/ClientObjectFactory.java
    tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/ClusterRequestHandler.java
    tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
    tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java
    tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
    tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/MultithreadTest.java
    tomee/tomee/trunk/server/openejb-server/src/main/java/org/apache/openejb/server/context/RequestInfos.java

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ArrayEnumeration.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ArrayEnumeration.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ArrayEnumeration.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ArrayEnumeration.java Wed Aug  7 15:06:21 2013
@@ -17,29 +17,32 @@
  */
 package org.apache.openejb.client;
 
-import java.util.Enumeration;
-import java.util.Vector;
-import java.util.NoSuchElementException;
 import java.io.Externalizable;
-import java.io.ObjectOutput;
 import java.io.IOException;
 import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+import java.util.Vector;
 
 /**
  * @version $Revision$ $Date$
  */
 public final class ArrayEnumeration implements Enumeration, Externalizable {
+
     static final long serialVersionUID = -1194966576855523042L;
 
-    private Object[] elements;
-    private int elementsIndex;
+    private transient Object[] elements;
+    private transient int elementsIndex;
+    private transient ProtocolMetaData metaData;
 
-    public ArrayEnumeration(Vector elements) {
+    @SuppressWarnings("UseOfObsoleteCollectionType")
+    public ArrayEnumeration(final Vector elements) {
         this.elements = new Object[elements.size()];
         elements.copyInto(this.elements);
     }
 
-    public ArrayEnumeration(java.util.List list) {
+    public ArrayEnumeration(final java.util.List list) {
         this.elements = new Object[list.size()];
         list.toArray(this.elements);
     }
@@ -47,11 +50,15 @@ public final class ArrayEnumeration impl
     public ArrayEnumeration() {
     }
 
-    public Object get(int index) {
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
+    public Object get(final int index) {
         return elements[index];
     }
 
-    public void set(int index, Object o) {
+    public void set(final int index, final Object o) {
         elements[index] = o;
     }
 
@@ -59,24 +66,30 @@ public final class ArrayEnumeration impl
         return elements.length;
     }
 
+    @Override
     public boolean hasMoreElements() {
         return (elementsIndex < elements.length);
     }
 
+    @Override
     public Object nextElement() {
-        if (!hasMoreElements()) throw new NoSuchElementException("No more elements exist");
+        if (!hasMoreElements()) {
+            throw new NoSuchElementException("No more elements exist");
+        }
         return elements[elementsIndex++];
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         out.writeInt(elements.length);
         out.writeInt(elementsIndex);
-        for (int i = 0; i < elements.length; i++) {
-            out.writeObject(elements[i]);
+        for (final Object element : elements) {
+            out.writeObject(element);
         }
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
         elements = new Object[in.readInt()];
         elementsIndex = in.readInt();
         for (int i = 0; i < elements.length; i++) {

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/AuthenticationRequest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/AuthenticationRequest.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/AuthenticationRequest.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/AuthenticationRequest.java Wed Aug  7 15:06:21 2013
@@ -25,6 +25,7 @@ public class AuthenticationRequest imple
     private transient String realm;
     private transient String username;
     private transient String credentials;
+    private transient ProtocolMetaData metaData;
 
     public AuthenticationRequest() {
     }
@@ -39,6 +40,10 @@ public class AuthenticationRequest imple
         this.credentials = credentials;
     }
 
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
     @Override
     public RequestType getRequestType() {
         return RequestType.AUTH_REQUEST;
@@ -77,8 +82,9 @@ public class AuthenticationRequest imple
 
     public String toString() {
         final StringBuilder sb = new StringBuilder(50);
-        sb.append(realm).append(':');
-        sb.append(username);
+        sb.append(null != realm ? realm : "Unknown realm").append(':');
+        sb.append(null != username ? username : "Unknown user").append(':');
+        sb.append(null != credentials ? credentials : "Unknown credentials");
         return sb.toString();
     }
 }

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/AuthenticationResponse.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/AuthenticationResponse.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/AuthenticationResponse.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/AuthenticationResponse.java Wed Aug  7 15:06:21 2013
@@ -26,12 +26,27 @@ public class AuthenticationResponse impl
     private transient ClientMetaData identity;
     private transient ServerMetaData server;
     private transient Throwable deniedCause;
+    private transient AuthenticationRequest request;
+    private transient ProtocolMetaData metaData;
 
     public AuthenticationResponse() {
     }
 
-    public AuthenticationResponse(int code) {
-        responseCode = code;
+    public AuthenticationResponse(final int code) {
+        this.responseCode = code;
+    }
+
+    @Override
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
+    public AuthenticationRequest getRequest() {
+        return request;
+    }
+
+    public void setRequest(final AuthenticationRequest request) {
+        this.request = request;
     }
 
     public int getResponseCode() {
@@ -46,15 +61,15 @@ public class AuthenticationResponse impl
         return server;
     }
 
-    public void setResponseCode(int responseCode) {
+    public void setResponseCode(final int responseCode) {
         this.responseCode = responseCode;
     }
 
-    public void setIdentity(ClientMetaData identity) {
+    public void setIdentity(final ClientMetaData identity) {
         this.identity = identity;
     }
 
-    public void setServer(ServerMetaData server) {
+    public void setServer(final ServerMetaData server) {
         this.server = server;
     }
 
@@ -62,70 +77,82 @@ public class AuthenticationResponse impl
         return deniedCause;
     }
 
-    public void setDeniedCause(Throwable deniedCause) {
+    public void setDeniedCause(final Throwable deniedCause) {
         this.deniedCause = deniedCause;
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        byte version = in.readByte(); // future use
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+        final byte version = in.readByte(); // future use
 
         responseCode = in.readByte();
         switch (responseCode) {
             case ResponseCodes.AUTH_GRANTED:
                 identity = new ClientMetaData();
+                identity.setMetaData(metaData);
                 identity.readExternal(in);
                 break;
             case ResponseCodes.AUTH_REDIRECT:
                 identity = new ClientMetaData();
+                identity.setMetaData(metaData);
                 identity.readExternal(in);
+
                 server = new ServerMetaData();
+                server.setMetaData(metaData);
                 server.readExternal(in);
                 break;
             case ResponseCodes.AUTH_DENIED:
-                ThrowableArtifact ta = new ThrowableArtifact();
+                final ThrowableArtifact ta = new ThrowableArtifact();
+                ta.setMetaData(metaData);
                 ta.readExternal(in);
                 deniedCause = ta.getThrowable();
                 break;
         }
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         // write out the version of the serialized data for future use
         out.writeByte(1);
 
         out.writeByte((byte) responseCode);
         switch (responseCode) {
             case ResponseCodes.AUTH_GRANTED:
+                identity.setMetaData(metaData);
                 identity.writeExternal(out);
                 break;
             case ResponseCodes.AUTH_REDIRECT:
+                identity.setMetaData(metaData);
                 identity.writeExternal(out);
+
+                server.setMetaData(metaData);
                 server.writeExternal(out);
                 break;
             case ResponseCodes.AUTH_DENIED:
-                ThrowableArtifact ta = new ThrowableArtifact(deniedCause);
+                final ThrowableArtifact ta = new ThrowableArtifact(deniedCause);
+                ta.setMetaData(metaData);
                 ta.writeExternal(out);
                 break;
         }
     }
 
     public String toString() {
-        StringBuilder sb = new StringBuilder(50);
+        final StringBuilder sb = new StringBuilder(50);
 
         switch (responseCode) {
             case ResponseCodes.AUTH_GRANTED: {
                 sb.append("AUTH_GRANTED:");
-                sb.append(identity);
+                sb.append(null != identity ? identity.toString() : "Unknown identity");
                 break;
             }
             case ResponseCodes.AUTH_REDIRECT: {
                 sb.append("AUTH_REDIRECT:");
-                sb.append(server);
+                sb.append(null != server ? server.toString() : "Unknown server");
                 break;
             }
             case ResponseCodes.AUTH_DENIED: {
                 sb.append("AUTH_DENIED:");
-                sb.append(deniedCause.toString());
+                sb.append(null != deniedCause ? deniedCause.toString() : "Unknown denial");
                 break;
             }
         }

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java Wed Aug  7 15:06:21 2013
@@ -49,12 +49,13 @@ import java.util.logging.Logger;
 import static org.apache.openejb.client.Exceptions.newIOException;
 
 public class Client {
+
     private static final Logger logger = Logger.getLogger("OpenEJB.client");
     private boolean FINEST = logger.isLoggable(Level.FINEST);
     private boolean FINER = logger.isLoggable(Level.FINER);
 
     public static final ThreadLocal<Set<URI>> failed = new ThreadLocal<Set<URI>>();
-    private static final ProtocolMetaData PROTOCOL_VERSION = new ProtocolMetaData("4.6");
+    private static final ProtocolMetaData PROTOCOL_META_DATA = new ProtocolMetaData();
     private static final int maxConditionRetry = Integer.parseInt(System.getProperty("openejb.client.retry.condition.max", "20"));
 
     private List<Class<? extends Throwable>> retryConditions = new CopyOnWriteArrayList<Class<? extends Throwable>>();
@@ -72,7 +73,9 @@ public class Client {
     }
 
     public static void addEventObserver(final Object observer) {
-        if (observer == null) throw new IllegalArgumentException("observer cannot be null");
+        if (observer == null) {
+            throw new IllegalArgumentException("observer cannot be null");
+        }
 
         if (client.observers.addObserver(observer)) {
             fireEvent(new ObserverAdded(observer));
@@ -80,7 +83,9 @@ public class Client {
     }
 
     public static void removeEventObserver(final Object observer) {
-        if (observer == null) throw new IllegalArgumentException("observer cannot be null");
+        if (observer == null) {
+            throw new IllegalArgumentException("observer cannot be null");
+        }
 
         if (client.observers.removeObserver(observer)) {
             fireEvent(new ObserverAdded(observer));
@@ -92,22 +97,32 @@ public class Client {
     }
 
     public static boolean addRetryCondition(final Class<? extends Throwable> throwable) {
-        if (throwable == null) throw new IllegalArgumentException("throwable cannot be null");
+        if (throwable == null) {
+            throw new IllegalArgumentException("throwable cannot be null");
+        }
         final boolean add = client.retryConditions.add(throwable);
-        if (add) fireEvent(new RetryConditionAdded(throwable));
+        if (add) {
+            fireEvent(new RetryConditionAdded(throwable));
+        }
         return add;
     }
 
     public static boolean removeRetryCondition(final Class<? extends Throwable> throwable) {
-        if (throwable == null) throw new IllegalArgumentException("throwable cannot be null");
+        if (throwable == null) {
+            throw new IllegalArgumentException("throwable cannot be null");
+        }
         final boolean remove = client.retryConditions.remove(throwable);
-        if (remove) fireEvent(new RetryConditionRemoved(throwable));
+        if (remove) {
+            fireEvent(new RetryConditionRemoved(throwable));
+        }
         return remove;
     }
 
     // This lame hook point if only of testing
     public static void setClient(final Client client) {
-        if (client == null) throw new IllegalArgumentException("client cannot be null");
+        if (client == null) {
+            throw new IllegalArgumentException("client cannot be null");
+        }
         Client.client = client;
     }
 
@@ -161,7 +176,7 @@ public class Client {
             /*----------------------------------*/
             try {
 
-                PROTOCOL_VERSION.writeExternal(out);
+                PROTOCOL_META_DATA.writeExternal(out);
 
             } catch (IOException e) {
                 throw newIOException("Cannot write the protocol metadata to the server: ", e);
@@ -256,7 +271,7 @@ public class Client {
 
             } catch (IOException e) {
 
-                throw newIOException("Cannot deternmine server protocol version: Received " + protocolMetaData.getSpec(), e);
+                throw newIOException("Cannot determine server protocol version: Received " + protocolMetaData.getSpec() + " : " + e.getMessage(), e);
             }
 
             final ObjectInput objectIn;
@@ -273,6 +288,7 @@ public class Client {
             /*----------------------------------*/
             try {
                 final ClusterResponse clusterResponse = new ClusterResponse();
+                clusterResponse.setMetaData(protocolMetaData);
                 clusterResponse.readExternal(objectIn);
                 switch (clusterResponse.getResponseCode()) {
                     case UPDATE: {
@@ -297,7 +313,7 @@ public class Client {
             /* Read response */
             /*----------------------------------*/
             try {
-
+                res.setMetaData(protocolMetaData);
                 res.readExternal(objectIn);
             } catch (ClassNotFoundException e) {
                 throw new RemoteException("Cannot read the response from the server.  The class for an object being returned is not located in this system:", e);
@@ -319,13 +335,13 @@ public class Client {
 
                             throw new RetryException(res);
 
-//                            if (? < maxConditionRetry) {
-//                                throw new RetryException(res);
-//                            } else {
-//                                if (FINER) {
-//                                    logger.log(Level.FINER, "Giving up on " + artifact.getThrowable().getClass().getName().toString());
-//                                }
-//                            }
+                            //                            if (? < maxConditionRetry) {
+                            //                                throw new RetryException(res);
+                            //                            } else {
+                            //                                if (FINER) {
+                            //                                    logger.log(Level.FINER, "Giving up on " + artifact.getThrowable().getClass().getName().toString());
+                            //                                }
+                            //                            }
                         }
                     }
                 }
@@ -436,6 +452,7 @@ public class Client {
     }
 
     public static class Context {
+
         private final Properties properties = new Properties();
         private final ServerMetaData serverMetaData;
         private ClusterMetaData clusterMetaData;
@@ -457,7 +474,9 @@ public class Client {
         }
 
         public void setClusterMetaData(final ClusterMetaData updated) {
-            if (updated == null) throw new IllegalArgumentException("clusterMetaData cannot be null");
+            if (updated == null) {
+                throw new IllegalArgumentException("clusterMetaData cannot be null");
+            }
 
             final ClusterMetaData previous = this.clusterMetaData;
             this.clusterMetaData = updated;
@@ -498,7 +517,9 @@ public class Client {
         public Set<URI> diff(final Set<URI> a, final Set<URI> b) {
             final Set<URI> diffs = new HashSet<URI>();
             for (final URI uri : b) {
-                if (!a.contains(uri)) diffs.add(uri);
+                if (!a.contains(uri)) {
+                    diffs.add(uri);
+                }
             }
 
             return diffs;

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClientMetaData.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClientMetaData.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClientMetaData.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClientMetaData.java Wed Aug  7 15:06:21 2013
@@ -27,19 +27,24 @@ public class ClientMetaData implements E
 
     transient Object clientIdentity;
     private transient EJBDSerializer serializer;
+    private transient ProtocolMetaData metaData;
 
     public ClientMetaData() {
     }
 
-    public ClientMetaData(Object identity) {
+    public ClientMetaData(final Object identity) {
         this.clientIdentity = identity;
     }
 
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
     public Object getClientIdentity() {
         return clientIdentity;
     }
 
-    public void setClientIdentity(Object clientIdentity) {
+    public void setClientIdentity(final Object clientIdentity) {
         this.clientIdentity = clientIdentity;
     }
 
@@ -51,27 +56,35 @@ public class ClientMetaData implements E
         this.serializer = serializer;
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        byte version = in.readByte(); // future use
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
 
+        final byte version = in.readByte(); // future use
         this.clientIdentity = in.readObject();
-        if (in.readBoolean()) {
-            try {
-                serializer = EJBDSerializer.class.cast(Thread.currentThread().getContextClassLoader().loadClass(in.readUTF()).newInstance());
-            } catch (final Exception e) {
-                // no-op
+
+        if (null == metaData || metaData.isAtLeast(4, 6)) {
+            if (in.readBoolean()) {
+                try {
+                    serializer = EJBDSerializer.class.cast(Thread.currentThread().getContextClassLoader().loadClass(in.readUTF()).newInstance());
+                } catch (final Exception e) {
+                    // no-op
+                }
             }
         }
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         // write out the version of the serialized data for future use
         out.writeByte(1);
-
         out.writeObject(clientIdentity);
-        out.writeBoolean(serializer != null);
-        if (serializer != null) {
-            out.writeUTF(serializer.getClass().getName());
+
+        if (null == metaData || metaData.isAtLeast(4, 6)) {
+
+            out.writeBoolean(serializer != null);
+            if (serializer != null) {
+                out.writeUTF(serializer.getClass().getName());
+            }
         }
     }
 }

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClientSecurity.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClientSecurity.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClientSecurity.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClientSecurity.java Wed Aug  7 15:06:21 2013
@@ -23,26 +23,27 @@ import java.net.URISyntaxException;
 import java.rmi.RemoteException;
 
 public class ClientSecurity {
+
     public static final String IDENTITY_RESOLVER_STRATEGY = "openejb.client.identityResolver";
 
     private static ServerMetaData server;
     private static IdentityResolver identityResolver;
     private static Object staticClientIdentity;
-    private static InheritableThreadLocal<Object> threadClientIdentity = new InheritableThreadLocal<Object>();
+    private static final InheritableThreadLocal<Object> threadClientIdentity = new InheritableThreadLocal<Object>();
 
     static {
         // determine the server uri
-        String serverUri = System.getProperty("openejb.server.uri");
+        final String serverUri = System.getProperty("openejb.server.uri");
 
         if (serverUri != null) {
             // determine the server location
             try {
-                URI location = new URI(serverUri);
+                final URI location = new URI(serverUri);
                 server = new ServerMetaData(location);
             } catch (Exception e) {
-                if (serverUri.indexOf("://") == -1) {
+                if (!serverUri.contains("://")) {
                     try {
-                        URI location =  new URI("oejb://" + serverUri);
+                        final URI location = new URI("oejb://" + serverUri);
                         server = new ServerMetaData(location);
                     } catch (URISyntaxException ignored) {
                     }
@@ -51,12 +52,11 @@ public class ClientSecurity {
         }
     }
 
-
     public static ServerMetaData getServer() {
         return server;
     }
 
-    public static void setServer(ServerMetaData server) {
+    public static void setServer(final ServerMetaData server) {
         ClientSecurity.server = server;
     }
 
@@ -66,12 +66,13 @@ public class ClientSecurity {
      * ClientSecurity.login(username, password, true);
      * </p>
      * This is the equivalent of ClientSecurity.login(username, password, false);
+     *
      * @param username the user to login
      * @param password the password for the user
      * @throws FailedLoginException if the username and password combination are not valid or
-     *      if there is a problem communiating with the server
+     *                              if there is a problem communiating with the server
      */
-    public static void login(String username, String password) throws FailedLoginException {
+    public static void login(final String username, final String password) throws FailedLoginException {
         login(username, password, false);
     }
 
@@ -83,15 +84,15 @@ public class ClientSecurity {
      * when using thread pools.  If a thread is returned to the pool with a login attached to the
      * thread the next user of that thread will inherit the thread scoped login.
      *
-     * @param username the user to login
-     * @param password the password for the user
+     * @param username     the user to login
+     * @param password     the password for the user
      * @param threadScoped if true the login is scoped to the thread; otherwise the login is global
-     * for the entire Java Virtural Machine
+     *                     for the entire Java Virtural Machine
      * @throws FailedLoginException if the username and password combination are not valid or
-     *      if there is a problem communiating with the server
+     *                              if there is a problem communiating with the server
      */
-    public static void login(String username, String password, boolean threadScoped) throws FailedLoginException {
-        Object clientIdentity = directAuthentication(username, password, server);
+    public static void login(final String username, final String password, final boolean threadScoped) throws FailedLoginException {
+        final Object clientIdentity = directAuthentication(username, password, server);
         if (threadScoped) {
             threadClientIdentity.set(clientIdentity);
         } else {
@@ -116,18 +117,18 @@ public class ClientSecurity {
      *
      * @param username the username for authentication
      * @param password the password for authentication
-     * @param server
+     * @param server   ServerMetaData
      * @return the client identity token
      * @throws FailedLoginException if the username password combination is not valid
      */
-    public static Object directAuthentication(String username, String password, ServerMetaData server) throws FailedLoginException {
+    public static Object directAuthentication(final String username, final String password, final ServerMetaData server) throws FailedLoginException {
         return directAuthentication(null, username, password, server);
     }
 
-    public static Object directAuthentication(String securityRealm, String username, String password, ServerMetaData server) throws FailedLoginException {
+    public static Object directAuthentication(final String securityRealm, final String username, final String password, final ServerMetaData server) throws FailedLoginException {
         // authenticate
-        AuthenticationRequest authReq = new AuthenticationRequest(securityRealm, username, password);
-        AuthenticationResponse authRes;
+        final AuthenticationRequest authReq = new AuthenticationRequest(securityRealm, username, password);
+        final AuthenticationResponse authRes;
         try {
             authRes = (AuthenticationResponse) Client.request(authReq, new AuthenticationResponse(), server);
         } catch (RemoteException e) {
@@ -140,8 +141,7 @@ public class ClientSecurity {
         }
 
         // return the response object
-        Object clientIdentity = authRes.getIdentity().getClientIdentity();
-        return clientIdentity;
+        return authRes.getIdentity().getClientIdentity();
     }
 
     public static Object getIdentity() {
@@ -150,13 +150,13 @@ public class ClientSecurity {
 
     public static IdentityResolver getIdentityResolver() {
         if (identityResolver == null) {
-            String strategy = System.getProperty(IDENTITY_RESOLVER_STRATEGY);
+            final String strategy = System.getProperty(IDENTITY_RESOLVER_STRATEGY);
             if (strategy == null) {
                 identityResolver = new JaasIdentityResolver();
             } else {
                 // find the strategy class
-                ResourceFinder finder = new ResourceFinder("META-INF/");
-                Class identityResolverClass;
+                final ResourceFinder finder = new ResourceFinder("META-INF/");
+                final Class identityResolverClass;
                 try {
                     identityResolverClass = finder.findClass(IdentityResolver.class.getName() + "/" + strategy);
                 } catch (Exception e) {
@@ -166,8 +166,8 @@ public class ClientSecurity {
                 // verify the interface
                 if (!IdentityResolver.class.isAssignableFrom(identityResolverClass)) {
                     throw new IllegalArgumentException("Client identity strategy '" + strategy + "' " +
-                            "class '" + identityResolverClass.getName() + "' does not implement the " +
-                            "interface '"  + IdentityResolver.class.getSimpleName() + "'");
+                                                       "class '" + identityResolverClass.getName() + "' does not implement the " +
+                                                       "interface '" + IdentityResolver.class.getSimpleName() + "'");
                 }
 
                 // create the class
@@ -175,7 +175,7 @@ public class ClientSecurity {
                     identityResolver = (IdentityResolver) identityResolverClass.newInstance();
                 } catch (Exception e) {
                     throw new IllegalArgumentException("Unable to create client identity strategy '" + strategy + "' " +
-                            "class '" + identityResolverClass.getName() + "'", e);
+                                                       "class '" + identityResolverClass.getName() + "'", e);
                 }
             }
 
@@ -183,8 +183,7 @@ public class ClientSecurity {
         return identityResolver;
     }
 
-
-    public static void setIdentityResolver(IdentityResolver identityResolver) {
+    public static void setIdentityResolver(final IdentityResolver identityResolver) {
         ClientSecurity.identityResolver = identityResolver;
     }
 
@@ -192,6 +191,8 @@ public class ClientSecurity {
     }
 
     public static class SimpleIdentityResolver implements IdentityResolver {
+
+        @Override
         public Object getIdentity() {
             Object clientIdentity = threadClientIdentity.get();
             if (clientIdentity == null) {

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterMetaData.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterMetaData.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterMetaData.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterMetaData.java Wed Aug  7 15:06:21 2013
@@ -17,8 +17,8 @@
 package org.apache.openejb.client;
 
 import java.io.Externalizable;
-import java.io.ObjectInput;
 import java.io.IOException;
+import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -27,20 +27,26 @@ import java.net.URISyntaxException;
  * @version $Rev$ $Date$
  */
 public class ClusterMetaData implements Externalizable {
+
     private URI[] locations;
     private long version;
     private String connectionStrategy;
     private volatile URI lastLocation;
     private transient final Context context = new Context();
+    private transient ProtocolMetaData metaData;
 
     public ClusterMetaData() {
     }
 
-    public ClusterMetaData(long version, URI... locations) {
+    public ClusterMetaData(final long version, final URI... locations) {
         this.locations = locations;
         this.version = version;
     }
 
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
     public Context getContext() {
         return context;
     }
@@ -49,7 +55,7 @@ public class ClusterMetaData implements 
         return lastLocation;
     }
 
-    public void setLastLocation(URI lastLocation) {
+    public void setLastLocation(final URI lastLocation) {
         this.lastLocation = lastLocation;
     }
 
@@ -61,7 +67,7 @@ public class ClusterMetaData implements 
         return version;
     }
 
-    public void setConnectionStrategy(String connectionStrategy) {
+    public void setConnectionStrategy(final String connectionStrategy) {
         this.connectionStrategy = connectionStrategy;
     }
 
@@ -69,33 +75,35 @@ public class ClusterMetaData implements 
         return connectionStrategy;
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
         in.readByte(); // for future use to identify format of the data.
 
         version = in.readLong();
         connectionStrategy = (String) in.readObject();
 
-        int length = in.readInt();
+        final int length = in.readInt();
         locations = new URI[length];
 
         for (int i = 0; i < locations.length; i++) {
-            Object o = in.readObject();
+            final Object o = in.readObject();
             try {
-                locations[i] = new URI((String)o);
+                locations[i] = new URI((String) o);
             } catch (URISyntaxException e) {
                 throw (IOException) new IOException().initCause(e);
             }
         }
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         // write out the version of the serialized data for future use
         out.writeByte(1);
 
         out.writeLong(version);
         out.writeObject(connectionStrategy);
         out.writeInt(locations.length);
-        for (URI uri : locations) {
+        for (final URI uri : locations) {
             out.writeObject(uri.toString());
         }
     }

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterRequest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterRequest.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterRequest.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterRequest.java Wed Aug  7 15:06:21 2013
@@ -16,23 +16,30 @@
  */
 package org.apache.openejb.client;
 
-import java.io.ObjectInput;
 import java.io.IOException;
+import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
 /**
  * @version $Rev$ $Date$
  */
 public class ClusterRequest implements Request {
-    private long clusterMetaDataVersion;
+
+    private transient long clusterMetaDataVersion;
+    private transient ProtocolMetaData metaData;
 
     public ClusterRequest() {
     }
 
-    public ClusterRequest(ClusterMetaData clusterMetaData) {
+    public ClusterRequest(final ClusterMetaData clusterMetaData) {
         clusterMetaDataVersion = clusterMetaData.getVersion();
     }
 
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
+    @Override
     public RequestType getRequestType() {
         return RequestType.CLUSTER_REQUEST;
     }
@@ -41,11 +48,13 @@ public class ClusterRequest implements R
         return clusterMetaDataVersion;
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
         clusterMetaDataVersion = in.readLong();
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         out.writeLong(clusterMetaDataVersion);
     }
 }

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterResponse.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterResponse.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterResponse.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ClusterResponse.java Wed Aug  7 15:06:21 2013
@@ -16,29 +16,38 @@
  */
 package org.apache.openejb.client;
 
-import java.io.ObjectInput;
 import java.io.IOException;
+import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
 /**
  * @version $Rev$ $Date$
  */
 public class ClusterResponse implements Response {
+
     public static enum Code {
-        CURRENT, UPDATE, FAILURE;
+        CURRENT,
+        UPDATE,
+        FAILURE
     }
 
     private Code responseCode;
     private ClusterMetaData updatedMetaData;
     private Throwable failure;
+    private transient ProtocolMetaData metaData;
 
-    public ClusterResponse(Code responseCode) {
+    public ClusterResponse(final Code responseCode) {
         this.responseCode = responseCode;
     }
 
     public ClusterResponse() {
     }
 
+    @Override
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
     public Code getResponseCode() {
         return responseCode;
     }
@@ -47,7 +56,7 @@ public class ClusterResponse implements 
         this.responseCode = Code.CURRENT;
     }
 
-    public void setUpdatedMetaData(ClusterMetaData updatedMetaData) {
+    public void setUpdatedMetaData(final ClusterMetaData updatedMetaData) {
         this.responseCode = Code.UPDATE;
         this.updatedMetaData = updatedMetaData;
     }
@@ -60,37 +69,44 @@ public class ClusterResponse implements 
         return failure;
     }
 
-    public void setFailure(Throwable failure) {
+    public void setFailure(final Throwable failure) {
         this.responseCode = Code.FAILURE;
         this.failure = failure;
     }
 
-
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        byte i = in.readByte();
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+        final byte i = in.readByte();
         responseCode = Code.values()[i];
 
-        switch(responseCode){
-            case CURRENT: break;
+        switch (responseCode) {
+            case CURRENT:
+                break;
             case UPDATE: {
                 updatedMetaData = new ClusterMetaData();
+                updatedMetaData.setMetaData(metaData);
                 updatedMetaData.readExternal(in);
-            }; break;
-            case FAILURE:{
+                break;
+            }
+            case FAILURE: {
                 failure = (IOException) in.readObject();
             }
         }
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         out.writeByte(responseCode.ordinal());
 
-        switch(responseCode){
-            case CURRENT: break;
+        switch (responseCode) {
+            case CURRENT:
+                break;
             case UPDATE: {
+                updatedMetaData.setMetaData(metaData);
                 updatedMetaData.writeExternal(out);
-            }; break;
-            case FAILURE:{
+                break;
+            }
+            case FAILURE: {
                 out.writeObject(failure);
             }
         }

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/DataSourceMetaData.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/DataSourceMetaData.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/DataSourceMetaData.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/DataSourceMetaData.java Wed Aug  7 15:06:21 2013
@@ -17,31 +17,38 @@
 package org.apache.openejb.client;
 
 import java.io.Externalizable;
-import java.io.ObjectInput;
 import java.io.IOException;
+import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
 /**
  * @version $Rev$ $Date$
  */
 public class DataSourceMetaData implements Externalizable {
-    private String jdbcUrl;
-    private String jdbcDriver;
-    private String defaultPassword;
-    private String defaultUserName;
+
+    private transient String jdbcUrl;
+    private transient String jdbcDriver;
+    private transient String defaultPassword;
+    private transient String defaultUserName;
+    private transient ProtocolMetaData metaData;
 
     public DataSourceMetaData() {
     }
 
-    public DataSourceMetaData(String jdbcDriver, String jdbcUrl, String defaultUserName, String defaultPassword) {
+    public DataSourceMetaData(final String jdbcDriver, final String jdbcUrl, final String defaultUserName, final String defaultPassword) {
         this.defaultPassword = defaultPassword;
         this.defaultUserName = defaultUserName;
         this.jdbcDriver = jdbcDriver;
         this.jdbcUrl = jdbcUrl;
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        byte version = in.readByte(); // future use
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+        final byte version = in.readByte(); // future use
 
         jdbcDriver = (String) in.readObject();
         jdbcUrl = (String) in.readObject();
@@ -49,7 +56,8 @@ public class DataSourceMetaData implemen
         defaultPassword = (String) in.readObject();
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         // write out the version of the serialized data for future use
         out.writeByte(1);
 

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandle.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandle.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandle.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandle.java Wed Aug  7 15:06:21 2013
@@ -16,59 +16,69 @@
  */
 package org.apache.openejb.client;
 
+import javax.ejb.EJBHome;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.rmi.RemoteException;
 
-import javax.ejb.EJBHome;
-
 public class EJBHomeHandle implements java.io.Externalizable, javax.ejb.HomeHandle {
 
     protected transient EJBHomeProxy ejbHomeProxy;
     protected transient EJBHomeHandler handler;
+    private transient ProtocolMetaData metaData;
 
     public EJBHomeHandle() {
     }
 
-    public EJBHomeHandle(EJBHomeProxy proxy) {
+    public EJBHomeHandle(final EJBHomeProxy proxy) {
         this.ejbHomeProxy = proxy;
         this.handler = ejbHomeProxy.getEJBHomeHandler();
     }
 
-    protected void setEJBHomeProxy(EJBHomeProxy ejbHomeProxy) {
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
+    protected void setEJBHomeProxy(final EJBHomeProxy ejbHomeProxy) {
         this.ejbHomeProxy = ejbHomeProxy;
         this.handler = ejbHomeProxy.getEJBHomeHandler();
     }
 
+    @Override
     public EJBHome getEJBHome() throws RemoteException {
         return ejbHomeProxy;
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         // write out the version of the serialized data for future use
         out.writeByte(1);
 
-
+        handler.client.setMetaData(metaData);
         handler.client.writeExternal(out);
 
-        EJBMetaDataImpl ejb = handler.ejb;
+        final EJBMetaDataImpl ejb = handler.ejb;
         out.writeObject(getClassName(ejb.homeClass));
         out.writeObject(getClassName(ejb.remoteClass));
         out.writeObject(getClassName(ejb.keyClass));
         out.writeByte(ejb.type);
         out.writeUTF(ejb.deploymentID);
         out.writeShort(ejb.deploymentCode);
+
+        handler.server.setMetaData(metaData);
         handler.server.writeExternal(out);
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        byte version = in.readByte(); // future use
-
-        ClientMetaData client = new ClientMetaData();
-        EJBMetaDataImpl ejb = new EJBMetaDataImpl();
-        ServerMetaData server = new ServerMetaData();
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+        final byte version = in.readByte(); // future use
+
+        final ClientMetaData client = new ClientMetaData();
+        final EJBMetaDataImpl ejb = new EJBMetaDataImpl();
+        final ServerMetaData server = new ServerMetaData();
 
+        client.setMetaData(metaData);
         client.readExternal(in);
 
         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
@@ -83,17 +93,18 @@ public class EJBHomeHandle implements ja
         ejb.deploymentID = in.readUTF();
         ejb.deploymentCode = in.readShort();
 
+        server.setMetaData(metaData);
         server.readExternal(in);
 
         handler = EJBHomeHandler.createEJBHomeHandler(ejb, server, client, null);
         ejbHomeProxy = handler.createEJBHomeProxy();
     }
 
-    private static String getClassName(Class clazz) {
-        return (clazz == null) ? null: clazz.getName();
+    private static String getClassName(final Class clazz) {
+        return (clazz == null) ? null : clazz.getName();
     }
 
-    private static Class loadClass(ClassLoader classLoader, String homeClassName) throws ClassNotFoundException {
+    private static Class loadClass(final ClassLoader classLoader, final String homeClassName) throws ClassNotFoundException {
         return (homeClassName == null) ? null : Class.forName(homeClassName, true, classLoader);
     }
 }

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeHandler.java Wed Aug  7 15:06:21 2013
@@ -81,6 +81,7 @@ public abstract class EJBHomeHandler ext
         }
     }
 
+    @Override
     protected Object _invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
 
         final String methodName = method.getName();
@@ -95,7 +96,7 @@ public abstract class EJBHomeHandler ext
                     return Boolean.FALSE;
 
                 } else if (method.equals(HASHCODE)) {
-                    return new Integer(this.hashCode());
+                    return this.hashCode();
 
                 } else {
                     throw new UnsupportedOperationException("Unkown method: " + method);
@@ -243,9 +244,11 @@ public abstract class EJBHomeHandler ext
 
     protected abstract Object removeByPrimaryKey(Method method, Object[] args, Object proxy) throws Throwable;
 
+    @Override
     public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
     }
 
+    @Override
     public void writeExternal(final ObjectOutput out) throws IOException {
     }
 

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeProxyHandle.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeProxyHandle.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeProxyHandle.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBHomeProxyHandle.java Wed Aug  7 15:06:21 2013
@@ -24,42 +24,52 @@ import java.io.ObjectStreamException;
 
 public class EJBHomeProxyHandle implements Externalizable {
 
-    public static ThreadLocal<Resolver> resolver = new DefaultedThreadLocal<Resolver>(new ClientSideResovler());
+    public static final ThreadLocal<Resolver> resolver = new DefaultedThreadLocal<Resolver>(new ClientSideResovler());
 
-    EJBHomeHandler handler;
+    private transient EJBHomeHandler handler;
+    private transient ProtocolMetaData metaData;
 
     public EJBHomeProxyHandle() {
     }
 
-    public EJBHomeProxyHandle(EJBHomeHandler handler) {
+    public EJBHomeProxyHandle(final EJBHomeHandler handler) {
         this.handler = handler;
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         // write out the version of the serialized data for future use
         out.writeByte(1);
 
-
+        handler.client.setMetaData(metaData);
         handler.client.writeExternal(out);
 
-        EJBMetaDataImpl ejb = handler.ejb;
+        final EJBMetaDataImpl ejb = handler.ejb;
         out.writeObject(ejb.homeClass);
         out.writeObject(ejb.remoteClass);
         out.writeObject(ejb.keyClass);
         out.writeByte(ejb.type);
         out.writeUTF(ejb.deploymentID);
         out.writeShort(ejb.deploymentCode);
+
+        handler.server.setMetaData(metaData);
         handler.server.writeExternal(out);
-///        out.writeObject( handler.primaryKey );
+        ///        out.writeObject( handler.primaryKey );
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        byte version = in.readByte(); // future use
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+        final byte version = in.readByte(); // future use
 
-        ClientMetaData client = new ClientMetaData();
-        EJBMetaDataImpl ejb = new EJBMetaDataImpl();
-        ServerMetaData server = new ServerMetaData();
+        final ClientMetaData client = new ClientMetaData();
+        final EJBMetaDataImpl ejb = new EJBMetaDataImpl();
+        final ServerMetaData server = new ServerMetaData();
 
+        client.setMetaData(metaData);
         client.readExternal(in);
 
         ejb.homeClass = (Class) in.readObject();
@@ -69,7 +79,9 @@ public class EJBHomeProxyHandle implemen
         ejb.deploymentID = in.readUTF();
         ejb.deploymentCode = in.readShort();
 
+        server.setMetaData(metaData);
         server.readExternal(in);
+
         handler = EJBHomeHandler.createEJBHomeHandler(ejb, server, client, /* TODO */ null);
     }
 
@@ -78,11 +90,14 @@ public class EJBHomeProxyHandle implemen
     }
 
     public static interface Resolver {
+
         Object resolve(EJBHomeHandler handler);
     }
 
     public static class ClientSideResovler implements Resolver {
-        public Object resolve(EJBHomeHandler handler) {
+
+        @Override
+        public Object resolve(final EJBHomeHandler handler) {
             handler.ejb.ejbHomeProxy = handler.createEJBHomeProxy();
             return handler.ejb.ejbHomeProxy;
         }

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBMetaDataImpl.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBMetaDataImpl.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBMetaDataImpl.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBMetaDataImpl.java Wed Aug  7 15:06:21 2013
@@ -31,7 +31,8 @@ import java.util.Properties;
 import java.util.Set;
 
 public class EJBMetaDataImpl implements javax.ejb.EJBMetaData, java.io.Externalizable {
-	private static final long serialVersionUID = -858340852654709679L;
+
+    private static final long serialVersionUID = -858340852654709679L;
 
     public static final byte STATEFUL = (byte) 6;
 
@@ -69,27 +70,34 @@ public class EJBMetaDataImpl implements 
     // only used for business objects;
     protected transient Object primaryKey;
 
+    private transient ProtocolMetaData metaData;
+
     public EJBMetaDataImpl() {
 
     }
 
-    public EJBMetaDataImpl(Class homeInterface, Class remoteInterface, String typeOfBean, InterfaceType interfaceType, List<Class> businessInterfaces, Set<String> asynchronousMethodSignatures) {
+    public EJBMetaDataImpl(final Class homeInterface,
+                           final Class remoteInterface,
+                           final String typeOfBean,
+                           final InterfaceType interfaceType,
+                           final List<Class> businessInterfaces,
+                           final Set<String> asynchronousMethodSignatures) {
         this.interfaceType = interfaceType;
 
-        if ("STATEFUL".equalsIgnoreCase(typeOfBean)){
+        if ("STATEFUL".equalsIgnoreCase(typeOfBean)) {
             this.type = STATEFUL;
-        } else if ("STATELESS".equalsIgnoreCase(typeOfBean)){
+        } else if ("STATELESS".equalsIgnoreCase(typeOfBean)) {
             this.type = STATELESS;
-        } else if ("SINGLETON".equalsIgnoreCase(typeOfBean)){
+        } else if ("SINGLETON".equalsIgnoreCase(typeOfBean)) {
             this.type = SINGLETON;
-        } else if ("BMP_ENTITY".equalsIgnoreCase(typeOfBean)){
+        } else if ("BMP_ENTITY".equalsIgnoreCase(typeOfBean)) {
             this.type = BMP_ENTITY;
-        } else if ("CMP_ENTITY".equalsIgnoreCase(typeOfBean)){
+        } else if ("CMP_ENTITY".equalsIgnoreCase(typeOfBean)) {
             this.type = CMP_ENTITY;
         }
         this.homeClass = homeInterface;
         this.remoteClass = remoteInterface;
-        if (businessInterfaces != null){
+        if (businessInterfaces != null) {
             this.businessClasses.addAll(businessInterfaces);
         }
         if (asynchronousMethodSignatures != null) {
@@ -97,23 +105,49 @@ public class EJBMetaDataImpl implements 
         }
     }
 
-    public EJBMetaDataImpl(Class homeInterface, Class remoteInterface, Class primaryKeyClass, String typeOfBean, InterfaceType interfaceType, List<Class> businessInterfaces, Set<String> asynchronousMethodSignatures) {
+    public EJBMetaDataImpl(final Class homeInterface,
+                           final Class remoteInterface,
+                           final Class primaryKeyClass,
+                           final String typeOfBean,
+                           final InterfaceType interfaceType,
+                           final List<Class> businessInterfaces,
+                           final Set<String> asynchronousMethodSignatures) {
         this(homeInterface, remoteInterface, typeOfBean, interfaceType, businessInterfaces, asynchronousMethodSignatures);
         if (type == CMP_ENTITY || type == BMP_ENTITY) {
             this.keyClass = primaryKeyClass;
         }
     }
 
-    public EJBMetaDataImpl(Class homeInterface, Class remoteInterface, Class primaryKeyClass, String typeOfBean, String deploymentID, InterfaceType interfaceType, List<Class> businessInterfaces, Set<String> asynchronousMethodSignatures) {
+    public EJBMetaDataImpl(final Class homeInterface,
+                           final Class remoteInterface,
+                           final Class primaryKeyClass,
+                           final String typeOfBean,
+                           final String deploymentID,
+                           final InterfaceType interfaceType,
+                           final List<Class> businessInterfaces,
+                           final Set<String> asynchronousMethodSignatures) {
         this(homeInterface, remoteInterface, primaryKeyClass, typeOfBean, interfaceType, businessInterfaces, asynchronousMethodSignatures);
         this.deploymentID = deploymentID;
     }
 
-    public EJBMetaDataImpl(Class homeInterface, Class remoteInterface, Class primaryKeyClass, String typeOfBean, String deploymentID, int deploymentCode, InterfaceType interfaceType, List<Class> businessInterfaces, Set<String> asynchronousMethodSignatures) {
+    public EJBMetaDataImpl(final Class homeInterface,
+                           final Class remoteInterface,
+                           final Class primaryKeyClass,
+                           final String typeOfBean,
+                           final String deploymentID,
+                           final int deploymentCode,
+                           final InterfaceType interfaceType,
+                           final List<Class> businessInterfaces,
+                           final Set<String> asynchronousMethodSignatures) {
         this(homeInterface, remoteInterface, primaryKeyClass, typeOfBean, deploymentID, interfaceType, businessInterfaces, asynchronousMethodSignatures);
         this.deploymentCode = deploymentCode;
     }
 
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
+    @Override
     public Class getPrimaryKeyClass() {
         if (type != BMP_ENTITY && type != CMP_ENTITY) {
 
@@ -122,14 +156,17 @@ public class EJBMetaDataImpl implements 
         return keyClass;
     }
 
+    @Override
     public EJBHome getEJBHome() {
         return ejbHomeProxy;
     }
 
+    @Override
     public Class getHomeInterfaceClass() {
         return homeClass;
     }
 
+    @Override
     public boolean isStatelessSession() {
         return type == STATELESS;
     }
@@ -142,26 +179,28 @@ public class EJBMetaDataImpl implements 
         return type == SINGLETON;
     }
 
+    @Override
     public Class getRemoteInterfaceClass() {
         return remoteClass;
     }
 
+    @Override
     public boolean isSession() {
         return (type == STATEFUL || type == STATELESS || type == SINGLETON);
     }
 
-    public boolean isAsynchronousMethod(Method method) {
-        if(asynchronousMethods.size() == 0) {
+    public boolean isAsynchronousMethod(final Method method) {
+        if (asynchronousMethods.size() == 0) {
             return false;
         }
         return asynchronousMethods.contains(generateMethodSignature(method));
     }
 
-    public void addAsynchronousMethod(Method method) {
+    public void addAsynchronousMethod(final Method method) {
         asynchronousMethods.add(generateMethodSignature(method));
     }
 
-    protected void setEJBHomeProxy(EJBHomeProxy home) {
+    protected void setEJBHomeProxy(final EJBHomeProxy home) {
         ejbHomeProxy = home;
     }
 
@@ -189,11 +228,12 @@ public class EJBMetaDataImpl implements 
         return primaryKey;
     }
 
-    public void setPrimaryKey(Object primaryKey) {
+    public void setPrimaryKey(final Object primaryKey) {
         this.primaryKey = primaryKey;
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         // write out the version of the serialized data for future use
         out.writeByte(3);
 
@@ -205,10 +245,10 @@ public class EJBMetaDataImpl implements 
         out.writeUTF(deploymentID);
         out.writeShort((short) deploymentCode);
         out.writeShort((short) businessClasses.size());
-        for (Class clazz : businessClasses) {
+        for (final Class clazz : businessClasses) {
             out.writeObject(clazz);
         }
-        if (businessClasses.size() >0){
+        if (businessClasses.size() > 0) {
             out.writeObject(primaryKey);
         }
         out.writeObject(mainInterface);
@@ -216,10 +256,10 @@ public class EJBMetaDataImpl implements 
         out.writeByte(interfaceType.ordinal());
 
         out.writeInt(asynchronousMethods.size());
-        for (String asynchronousMethod : asynchronousMethods) {
+        for (final String asynchronousMethod : asynchronousMethods) {
             out.writeObject(asynchronousMethod);
         }
- 
+
         if (properties.size() == 0) {
             out.writeBoolean(false);
         } else {
@@ -235,8 +275,9 @@ public class EJBMetaDataImpl implements 
 
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        byte version = in.readByte(); // future use
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+        final byte version = in.readByte(); // future use
 
         homeClass = (Class) in.readObject();
         remoteClass = (Class) in.readObject();
@@ -249,18 +290,18 @@ public class EJBMetaDataImpl implements 
         for (int i = in.readShort(); i > 0; i--) {
             businessClasses.add((Class) in.readObject());
         }
-        if (businessClasses.size() > 0){
+        if (businessClasses.size() > 0) {
             primaryKey = in.readObject();
         }
         if (version > 2) {
             mainInterface = (Class) in.readObject();
         }
         if (version > 1) {
-            byte typeIndex = in.readByte();
+            final byte typeIndex = in.readByte();
             interfaceType = InterfaceType.values()[typeIndex];
         }
         for (int i = in.readInt(); i > 0; i--) {
-            asynchronousMethods.add((String)in.readObject());
+            asynchronousMethods.add((String) in.readObject());
         }
 
         final boolean hasProperties = in.readBoolean();
@@ -274,43 +315,53 @@ public class EJBMetaDataImpl implements 
     }
 
     public String toString() {
-        StringBuilder sb = new StringBuilder(100);
-        switch(type){
-            case STATEFUL: sb.append("STATEFUL:"); break;
-            case STATELESS: sb.append("STATELESS:");break;
-            case SINGLETON: sb.append("SINGLETON:");break;
-            case CMP_ENTITY: sb.append("CMP_ENTITY:");break;
-            case BMP_ENTITY: sb.append("BMP_ENTITY:");break;
+        final StringBuilder sb = new StringBuilder(100);
+        switch (type) {
+            case STATEFUL:
+                sb.append("STATEFUL:");
+                break;
+            case STATELESS:
+                sb.append("STATELESS:");
+                break;
+            case SINGLETON:
+                sb.append("SINGLETON:");
+                break;
+            case CMP_ENTITY:
+                sb.append("CMP_ENTITY:");
+                break;
+            case BMP_ENTITY:
+                sb.append("BMP_ENTITY:");
+                break;
         }
         sb.append(deploymentID).append(":");
-        if (homeClass != null){
+        if (homeClass != null) {
             sb.append(homeClass.getName());
-        } else if (businessClasses.size() != 0){
-            for (Class clazz : businessClasses) {
+        } else if (businessClasses.size() != 0) {
+            for (final Class clazz : businessClasses) {
                 sb.append(clazz.getName()).append(',');
             }
-            sb.deleteCharAt(sb.length()-1);
-            if (type == STATEFUL){
+            sb.deleteCharAt(sb.length() - 1);
+            if (type == STATEFUL) {
                 sb.append(":").append(primaryKey);
             }
         }
         return sb.toString();
     }
 
-    public void loadProperties(Properties properties) {
-        for (Map.Entry<Object, Object> entry : properties.entrySet()) {
+    public void loadProperties(final Properties properties) {
+        for (final Map.Entry<Object, Object> entry : properties.entrySet()) {
             if (entry.getKey() instanceof String) {
-                String key = (String) entry.getKey();
-                if (key.startsWith("openejb.client.")){
+                final String key = (String) entry.getKey();
+                if (key.startsWith("openejb.client.")) {
                     this.properties.put(key, entry.getValue());
                 }
             }
         }
     }
 
-    private String generateMethodSignature(Method method) {
-        StringBuilder buffer = new StringBuilder(method.getName());
-        for(Class<?> parameterType : method.getParameterTypes()) {
+    private String generateMethodSignature(final Method method) {
+        final StringBuilder buffer = new StringBuilder(method.getName());
+        for (final Class<?> parameterType : method.getParameterTypes()) {
             buffer.append(parameterType.getName());
         }
         return buffer.toString();

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandle.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandle.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandle.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandle.java Wed Aug  7 15:06:21 2013
@@ -16,60 +16,71 @@
  */
 package org.apache.openejb.client;
 
+import javax.ejb.EJBObject;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.rmi.RemoteException;
 
-import javax.ejb.EJBObject;
-
 public class EJBObjectHandle implements java.io.Externalizable, javax.ejb.Handle {
 
     protected transient EJBObjectProxy ejbObjectProxy;
     protected transient EJBObjectHandler handler;
+    private transient ProtocolMetaData metaData;
 
     public EJBObjectHandle() {
     }
 
-    public EJBObjectHandle(EJBObjectProxy proxy) {
+    public EJBObjectHandle(final EJBObjectProxy proxy) {
         this.ejbObjectProxy = proxy;
         this.handler = ejbObjectProxy.getEJBObjectHandler();
     }
 
-    protected void setEJBObjectProxy(EJBObjectProxy ejbObjectProxy) {
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
+    protected void setEJBObjectProxy(final EJBObjectProxy ejbObjectProxy) {
         this.ejbObjectProxy = ejbObjectProxy;
         this.handler = ejbObjectProxy.getEJBObjectHandler();
     }
 
+    @Override
     public EJBObject getEJBObject() throws RemoteException {
         return (EJBObject) ejbObjectProxy;
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         // write out the version of the serialized data for future use
         out.writeByte(1);
 
-
+        handler.client.setMetaData(metaData);
         handler.client.writeExternal(out);
 
-        EJBMetaDataImpl ejb = handler.ejb;
+        final EJBMetaDataImpl ejb = handler.ejb;
         out.writeObject(getClassName(ejb.homeClass));
         out.writeObject(getClassName(ejb.remoteClass));
         out.writeObject(getClassName(ejb.keyClass));
         out.writeByte(ejb.type);
         out.writeUTF(ejb.deploymentID);
         out.writeShort(ejb.deploymentCode);
+
+        handler.server.setMetaData(metaData);
         handler.server.writeExternal(out);
+
         out.writeObject(handler.primaryKey);
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        byte version = in.readByte(); // future use
-
-        ClientMetaData client = new ClientMetaData();
-        EJBMetaDataImpl ejb = new EJBMetaDataImpl();
-        ServerMetaData server = new ServerMetaData();
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+        final byte version = in.readByte(); // future use
+
+        final ClientMetaData client = new ClientMetaData();
+        final EJBMetaDataImpl ejb = new EJBMetaDataImpl();
+        final ServerMetaData server = new ServerMetaData();
 
+        client.setMetaData(metaData);
         client.readExternal(in);
 
         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
@@ -84,18 +95,20 @@ public class EJBObjectHandle implements 
         ejb.deploymentID = in.readUTF();
         ejb.deploymentCode = in.readShort();
 
+        server.setMetaData(metaData);
         server.readExternal(in);
-        Object primaryKey = in.readObject();
+
+        final Object primaryKey = in.readObject();
 
         handler = EJBObjectHandler.createEJBObjectHandler(ejb, server, client, primaryKey, null);
         ejbObjectProxy = handler.createEJBObjectProxy();
     }
 
-    private static String getClassName(Class clazz) {
-        return (clazz == null) ? null: clazz.getName();
+    private static String getClassName(final Class clazz) {
+        return (clazz == null) ? null : clazz.getName();
     }
 
-    private static Class loadClass(ClassLoader classLoader, String homeClassName) throws ClassNotFoundException {
+    private static Class loadClass(final ClassLoader classLoader, final String homeClassName) throws ClassNotFoundException {
         return (homeClassName == null) ? null : Class.forName(homeClassName, true, classLoader);
     }
 }
\ No newline at end of file

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectProxyHandle.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectProxyHandle.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectProxyHandle.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectProxyHandle.java Wed Aug  7 15:06:21 2013
@@ -24,49 +24,61 @@ import java.io.ObjectStreamException;
 
 public class EJBObjectProxyHandle implements Externalizable {
 
-    public static ThreadLocal<Resolver> resolver = new DefaultedThreadLocal<Resolver>(new ClientSideResovler());
+    public static final ThreadLocal<Resolver> resolver = new DefaultedThreadLocal<Resolver>(new ClientSideResovler());
 
-    EJBObjectHandler handler;
+    private transient EJBObjectHandler handler;
+    private transient ProtocolMetaData metaData;
 
     public EJBObjectProxyHandle() {
     }
 
-    public EJBObjectProxyHandle(EJBObjectHandler handler) {
+    public EJBObjectProxyHandle(final EJBObjectHandler handler) {
         this.handler = handler;
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         // write out the version of the serialized data for future use
         out.writeByte(1);
 
+        handler.client.setMetaData(metaData);
         handler.client.writeExternal(out);
 
+        handler.ejb.setMetaData(metaData);
         handler.ejb.writeExternal(out);
 
+        handler.server.setMetaData(metaData);
         handler.server.writeExternal(out);
+
         out.writeObject(handler.primaryKey);
         out.writeObject(handler.authenticationInfo);
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        byte version = in.readByte(); // future use
-
-        ClientMetaData client = new ClientMetaData();
-        EJBMetaDataImpl ejb = new EJBMetaDataImpl();
-        ServerMetaData server = new ServerMetaData();
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+        final byte version = in.readByte(); // future use
+
+        final ClientMetaData client = new ClientMetaData();
+        final EJBMetaDataImpl ejb = new EJBMetaDataImpl();
+        final ServerMetaData server = new ServerMetaData();
+
+        client.setMetaData(metaData);
+        ejb.setMetaData(metaData);
+        server.setMetaData(metaData);
 
         client.readExternal(in);
-
         ejb.readExternal(in);
-
         server.readExternal(in);
 
-        Object primaryKey = in.readObject();
+        final Object primaryKey = in.readObject();
 
         final JNDIContext.AuthenticationInfo authenticationInfo = JNDIContext.AuthenticationInfo.class.cast(in.readObject());
 
         handler = EJBObjectHandler.createEJBObjectHandler(ejb, server, client, primaryKey, authenticationInfo);
-
     }
 
     private Object readResolve() throws ObjectStreamException {
@@ -74,11 +86,14 @@ public class EJBObjectProxyHandle implem
     }
 
     public static interface Resolver {
+
         Object resolve(EJBObjectHandler handler);
     }
 
     public static class ClientSideResovler implements Resolver {
-        public Object resolve(EJBObjectHandler handler) {
+
+        @Override
+        public Object resolve(final EJBObjectHandler handler) {
             return handler.createEJBObjectProxy();
         }
     }

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBRequest.java Wed Aug  7 15:06:21 2013
@@ -41,6 +41,7 @@ public class EJBRequest implements Clust
     private transient int serverHash;
     private transient Body body;
     private transient EJBDSerializer serializer;
+    private transient ProtocolMetaData metaData;
 
     // Only visible on the client side
     private transient final EJBMetaDataImpl ejbMetaData;
@@ -74,6 +75,11 @@ public class EJBRequest implements Clust
         setPrimaryKey(primaryKey);
     }
 
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+        this.body.setMetaData(this.metaData);
+    }
+
     public EJBMetaDataImpl getEjbMetaData() {
         return ejbMetaData;
     }
@@ -281,6 +287,7 @@ public class EJBRequest implements Clust
      */
     @Override
     public void writeExternal(final ObjectOutput out) throws IOException {
+
         out.writeByte(requestMethod.getCode());
 
         if (deploymentCode > 0) {
@@ -292,6 +299,8 @@ public class EJBRequest implements Clust
         out.writeShort(deploymentCode);
         out.writeObject(clientIdentity);
         out.writeInt(serverHash);
+
+        body.setMetaData(metaData);
         body.writeExternal(out);
     }
 
@@ -311,6 +320,7 @@ public class EJBRequest implements Clust
         private byte version = EJBResponse.VERSION;
 
         private transient JNDIContext.AuthenticationInfo authentication;
+        private transient ProtocolMetaData metaData;
 
         public Body(final EJBMetaDataImpl ejb) {
             this.ejb = ejb;
@@ -319,6 +329,10 @@ public class EJBRequest implements Clust
         public Body() {
         }
 
+        public void setMetaData(final ProtocolMetaData metaData) {
+            this.metaData = metaData;
+        }
+
         public byte getVersion() {
             return version;
         }
@@ -406,10 +420,6 @@ public class EJBRequest implements Clust
         @SuppressWarnings("unchecked")
         @Override
         public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
-            readExternal(in , new ProtocolMetaData("4.6"));
-        }
-
-        public void readExternal(final ObjectInput in, final ProtocolMetaData metaData) throws IOException, ClassNotFoundException {
 
             this.version = in.readByte();
 
@@ -438,6 +448,7 @@ public class EJBRequest implements Clust
 
             if (interfaceClass != null) {
                 try {
+                    //noinspection unchecked
                     methodInstance = interfaceClass.getMethod(methodName, methodParamTypes);
                 } catch (NoSuchMethodException nsme) {
                     if (result == null) {
@@ -446,8 +457,7 @@ public class EJBRequest implements Clust
                 }
             }
 
-            //Version 3
-            if (metaData.isAtLeast(4, 6)) {
+            if (null == metaData || metaData.isAtLeast(4, 6)) {
                 authentication = JNDIContext.AuthenticationInfo.class.cast(in.readObject());
             } else {
                 authentication = null;
@@ -468,13 +478,14 @@ public class EJBRequest implements Clust
             out.writeObject(primaryKey);
 
             out.writeObject(interfaceClass);
-            //            out.writeObject(methodClass);
+
             out.writeUTF(methodName);
 
             writeMethodParameters(out, methodParamTypes, methodParameters);
 
-            //Version 3
-            out.writeObject(authentication);
+            if (null == metaData || metaData.isAtLeast(4, 6)) {
+                out.writeObject(authentication);
+            }
         }
 
         protected void writeMethodParameters(final ObjectOutput out, final Class[] types, final Object[] args) throws IOException {

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBResponse.java Wed Aug  7 15:06:21 2013
@@ -35,10 +35,25 @@ public class EJBResponse implements Clus
     private transient ServerMetaData server;
     private transient final long[] times = new long[Time.values().length];
     private transient final int timesLength = times.length;
+    private transient EJBRequest request;
+    private transient ProtocolMetaData metaData;
 
     public EJBResponse() {
     }
 
+    @Override
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
+
+    public EJBRequest getRequest() {
+        return request;
+    }
+
+    public void setRequest(final EJBRequest request) {
+        this.request = request;
+    }
+
     public int getResponseCode() {
         return responseCode;
     }
@@ -121,6 +136,7 @@ public class EJBResponse implements Clus
         final boolean readServer = in.readBoolean();
         if (readServer) {
             server = new ServerMetaData();
+            server.setMetaData(metaData);
             server.readExternal(in);
         }
 
@@ -145,6 +161,7 @@ public class EJBResponse implements Clus
 
         if (null != server) {
             out.writeBoolean(true);
+            server.setMetaData(metaData);
             server.writeExternal(out);
         } else {
             out.writeBoolean(false);

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/InjectionMetaData.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/InjectionMetaData.java?rev=1511348&r1=1511347&r2=1511348&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/InjectionMetaData.java (original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/InjectionMetaData.java Wed Aug  7 15:06:21 2013
@@ -29,34 +29,43 @@ import java.util.ArrayList;
 public class InjectionMetaData implements Externalizable {
 
     private final List<Injection> injections = new ArrayList<Injection>();
+    private transient ProtocolMetaData metaData;
 
+    public InjectionMetaData() {
+    }
+
+    public void setMetaData(final ProtocolMetaData metaData) {
+        this.metaData = metaData;
+    }
 
     public List<Injection> getInjections() {
         return injections;
     }
 
-    public void addInjection(String target, String name, String jndiName){
+    public void addInjection(final String target, final String name, final String jndiName){
         injections.add(new Injection(target, name, jndiName));
     }
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        byte version = in.readByte(); // future use
+    @Override
+    public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+        final byte version = in.readByte(); // future use
 
-        int size = in.readInt();
+        final int size = in.readInt();
         for (int i = 0; i < size; i++) {
-            String jndiName = (String) in.readObject();
-            String name = (String) in.readObject();
-            String target = (String) in.readObject();
+            final String jndiName = (String) in.readObject();
+            final String name = (String) in.readObject();
+            final String target = (String) in.readObject();
             addInjection(target, name, jndiName);
         }
     }
 
-    public void writeExternal(ObjectOutput out) throws IOException {
+    @Override
+    public void writeExternal(final ObjectOutput out) throws IOException {
         // write out the version of the serialized data for future use
         out.writeByte(1);
 
         out.writeInt(injections.size());
-        for (Injection injection : injections) {
+        for (final Injection injection : injections) {
             out.writeObject(injection.getJndiName());
             out.writeObject(injection.getName());
             out.writeObject(injection.getTargetClass());



Mime
View raw message