tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject svn commit: r1513162 - in /tomee/tomee/trunk/server: openejb-client/src/main/java/org/apache/openejb/client/ openejb-client/src/main/java/org/apache/openejb/client/serializer/ openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/ openejb-ejbd/src/...
Date Mon, 12 Aug 2013 15:19:56 GMT
Author: andygumbrecht
Date: Mon Aug 12 15:19:55 2013
New Revision: 1513162

URL: http://svn.apache.org/r1513162
Log:
Ensure all Externalizables/Serializables have a serialVersionUID - Pretty daft to have missed
this!

Modified:
    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/ClusterMetaData.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/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/EJBObjectHandler.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/InjectionMetaData.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.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/ServerMetaData.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ThrowableArtifact.java
    tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/serializer/SerializationWrapper.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/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/ClientMulticastDiscoveryTest.java
    tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/FailoverTest.java
    tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/UberInterfaceTest.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/Client.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java?rev=1513162&r1=1513161&r2=1513162&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
Mon Aug 12 15:19:55 2013
@@ -185,9 +185,8 @@ public class Client {
             /* Write the protocol magic         */
             /*----------------------------------*/
             try {
-
                 PROTOCOL_META_DATA.writeExternal(out);
-
+                out.flush();
             } catch (IOException e) {
                 throw newIOException("Cannot write the protocol metadata to the server: ",
e);
             }
@@ -197,9 +196,7 @@ public class Client {
             /*----------------------------------*/
             final ObjectOutput objectOut;
             try {
-
                 objectOut = new ObjectOutputStream(out);
-
             } catch (IOException e) {
                 throw newIOException("Cannot open object output stream to server: ", e);
             }
@@ -208,9 +205,7 @@ public class Client {
             /* Write ServerMetaData */
             /*----------------------------------*/
             try {
-
                 server.writeExternal(objectOut);
-
             } catch (IOException e) {
                 throw newIOException("Cannot write the ServerMetaData to the server: ", e);
             }
@@ -223,7 +218,6 @@ public class Client {
                 final ClusterRequest clusterRequest = new ClusterRequest(cluster);
                 objectOut.write(clusterRequest.getRequestType().getCode());
                 clusterRequest.writeExternal(objectOut);
-
             } catch (Throwable e) {
                 throw newIOException("Cannot write the ClusterMetaData to the server: ",
e);
             }
@@ -232,9 +226,7 @@ public class Client {
             /* Write request type */
             /*----------------------------------*/
             try {
-
                 objectOut.write(req.getRequestType().getCode());
-
             } catch (IOException e) {
                 throw newIOException("Cannot write the request type to the server: ", e);
             }
@@ -255,7 +247,7 @@ public class Client {
 
             } catch (IOException e) {
 
-                throw newIOException("Cannot write the request to the server: ", e);
+                throw newIOException("Cannot write the request to the server: " + e.getMessage(),
e);
             }
 
             /*----------------------------------*/
@@ -278,7 +270,7 @@ public class Client {
 
             } catch (EOFException e) {
 
-                throw newIOException("Prematurely reached the end of the stream.  " + protocolMetaData.getSpec(),
e);
+                throw newIOException("Prematurely reached the end of the stream.  " + protocolMetaData.getSpec()
+ " : " + e.getMessage(), e);
 
             } catch (IOException e) {
 
@@ -295,7 +287,7 @@ public class Client {
             }
 
             /*----------------------------------*/
-            /* Read response */
+            /* Read cluster response */
             /*----------------------------------*/
             try {
                 final ClusterResponse clusterResponse = new ClusterResponse();
@@ -311,13 +303,13 @@ public class Client {
                     }
                 }
             } 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);
+                throw new RemoteException("Cannot read the cluster response from the server.
 The class for an object being returned is not located in this system:", e);
 
             } catch (IOException e) {
-                throw newIOException("Cannot read the response from the server (" + protocolMetaData.getSpec()
+ ") : " + e.getMessage(), e);
+                throw newIOException("Cannot read the cluster response from the server ("
+ protocolMetaData.getSpec() + ") : " + e.getMessage(), e);
 
             } catch (Throwable e) {
-                throw new RemoteException("Error reading response from server (" + protocolMetaData.getSpec()
+ ") : " + e.getMessage(), e);
+                throw new RemoteException("Error reading cluster response from server ("
+ protocolMetaData.getSpec() + ") : " + e.getMessage(), e);
             }
 
             /*----------------------------------*/

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=1513162&r1=1513161&r2=1513162&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
Mon Aug 12 15:19:55 2013
@@ -28,6 +28,7 @@ import java.net.URISyntaxException;
  */
 public class ClusterMetaData implements Externalizable {
 
+    private static final long serialVersionUID = 8437242645853639397L;
     private URI[] locations;
     private long version;
     private String connectionStrategy;

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=1513162&r1=1513161&r2=1513162&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
Mon Aug 12 15:19:55 2013
@@ -26,6 +26,7 @@ import java.io.ObjectOutput;
  */
 public class DataSourceMetaData implements Externalizable {
 
+    private static final long serialVersionUID = -1117298086418904681L;
     private transient String jdbcUrl;
     private transient String jdbcDriver;
     private transient String defaultPassword;

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=1513162&r1=1513161&r2=1513162&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
Mon Aug 12 15:19:55 2013
@@ -31,6 +31,7 @@ import java.rmi.RemoteException;
 @SuppressWarnings("NullArgumentToVariableArgMethod")
 public abstract class EJBHomeHandler extends EJBInvocationHandler implements Externalizable
{
 
+    private static final long serialVersionUID = -9217145176099242745L;
     protected static final Method GETEJBMETADATA = getMethod(EJBHome.class, "getEJBMetaData",
null);
     protected static final Method GETHOMEHANDLE = getMethod(EJBHome.class, "getHomeHandle",
null);
     @SuppressWarnings("RedundantArrayCreation")

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=1513162&r1=1513161&r2=1513162&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
Mon Aug 12 15:19:55 2013
@@ -25,6 +25,7 @@ import java.io.ObjectStreamException;
 public class EJBHomeProxyHandle implements Externalizable {
 
     public static final ThreadLocal<Resolver> resolver = new DefaultedThreadLocal<Resolver>(new
ClientSideResovler());
+    private static final long serialVersionUID = 1967004939200853880L;
 
     private transient EJBHomeHandler handler;
     private transient ProtocolMetaData metaData;

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java
(original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/EJBObjectHandler.java
Mon Aug 12 15:19:55 2013
@@ -49,12 +49,12 @@ public abstract class EJBObjectHandler e
     public static final String OPENEJB_CLIENT_INVOKER_THREADS = "openejb.client.invoker.threads";
     public static final String OPENEJB_CLIENT_INVOKER_QUEUE = "openejb.client.invoker.queue";
 
-    protected static final Method GETEJBHOME = getMethod(EJBObject.class, "getEJBHome", 
null);
+    protected static final Method GETEJBHOME = getMethod(EJBObject.class, "getEJBHome", null);
     protected static final Method GETHANDLE = getMethod(EJBObject.class, "getHandle", null);
-    protected static final Method GETPRIMARYKEY = getMethod(EJBObject.class, "getPrimaryKey",
 null);
+    protected static final Method GETPRIMARYKEY = getMethod(EJBObject.class, "getPrimaryKey",
null);
     protected static final Method ISIDENTICAL = getMethod(EJBObject.class, "isIdentical",
EJBObject.class);
     protected static final Method REMOVE = getMethod(EJBObject.class, "remove", null);
-    protected static final Method GETHANDLER = getMethod(EJBObjectProxy.class, "getEJBObjectHandler",
 null);
+    protected static final Method GETHANDLER = getMethod(EJBObjectProxy.class, "getEJBObjectHandler",
null);
     protected static final Method CANCEL = getMethod(Future.class, "cancel", boolean.class);
 
     //TODO figure out how to configure and manage the thread pool on the client side, this
will do for now...

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=1513162&r1=1513161&r2=1513162&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
Mon Aug 12 15:19:55 2013
@@ -25,6 +25,7 @@ import java.io.ObjectStreamException;
 public class EJBObjectProxyHandle implements Externalizable {
 
     public static final ThreadLocal<Resolver> resolver = new DefaultedThreadLocal<Resolver>(new
ClientSideResovler());
+    private static final long serialVersionUID = -5290534267672475715L;
 
     private transient EJBObjectHandler handler;
     private transient ProtocolMetaData metaData;

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=1513162&r1=1513161&r2=1513162&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
Mon Aug 12 15:19:55 2013
@@ -28,6 +28,7 @@ import java.util.List;
  */
 public class InjectionMetaData implements Externalizable {
 
+    private static final long serialVersionUID = 808826768745812984L;
     private final List<Injection> injections = new ArrayList<Injection>();
     private transient ProtocolMetaData metaData;
 

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
(original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/JNDIContext.java
Mon Aug 12 15:19:55 2013
@@ -656,6 +656,7 @@ public class JNDIContext implements Init
 
     public static class AuthenticationInfo implements Serializable {
 
+        private static final long serialVersionUID = -8898613532355280735L;
         private String realm;
         private String user;
         private char[] password;

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ProtocolMetaData.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ProtocolMetaData.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ProtocolMetaData.java
(original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ProtocolMetaData.java
Mon Aug 12 15:19:55 2013
@@ -21,7 +21,6 @@ import java.io.EOFException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.Serializable;
 
 /**
  * OpenEJB Enterprise Javabean Protocol (OEJP)
@@ -35,14 +34,14 @@ import java.io.Serializable;
  * @version $Revision$ $Date$
  */
 @SuppressWarnings("UnusedDeclaration")
-public class ProtocolMetaData implements Serializable {
+public class ProtocolMetaData {
 
     public static final String VERSION = "4.6";
 
     private static final String OEJB = "OEJP";
-    private String id;
-    private int major;
-    private int minor;
+    private transient String id;
+    private transient int major;
+    private transient int minor;
 
     public ProtocolMetaData() {
         init(OEJB + "/" + VERSION);

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ServerMetaData.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ServerMetaData.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ServerMetaData.java
(original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ServerMetaData.java
Mon Aug 12 15:19:55 2013
@@ -25,6 +25,7 @@ import java.util.Arrays;
 
 public class ServerMetaData implements Externalizable {
 
+    private static final long serialVersionUID = -5561826098789699923L;
     private transient URI[] locations;
     private transient URI location;
     private transient ProtocolMetaData metaData;

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ThrowableArtifact.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ThrowableArtifact.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ThrowableArtifact.java
(original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/ThrowableArtifact.java
Mon Aug 12 15:19:55 2013
@@ -29,6 +29,7 @@ import java.util.Stack;
 @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
 public class ThrowableArtifact implements Externalizable {
 
+    private static final long serialVersionUID = 8465895155478377443L;
     private transient Throwable throwable;
     private transient ProtocolMetaData metaData;
 

Modified: tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/serializer/SerializationWrapper.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/serializer/SerializationWrapper.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/serializer/SerializationWrapper.java
(original)
+++ tomee/tomee/trunk/server/openejb-client/src/main/java/org/apache/openejb/client/serializer/SerializationWrapper.java
Mon Aug 12 15:19:55 2013
@@ -20,6 +20,7 @@ import java.io.Serializable;
 
 public class SerializationWrapper implements Serializable {
 
+    private static final long serialVersionUID = -9108946890164480879L;
     private String classname;
     private Serializable data;
 

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/AuthRequestHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/AuthRequestHandler.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/AuthRequestHandler.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/AuthRequestHandler.java
Mon Aug 12 15:19:55 2013
@@ -97,7 +97,7 @@ class AuthRequestHandler extends Request
 
         if (AuthenticationResponse.class.isInstance(response)) {
 
-            final AuthenticationResponse res = AuthenticationResponse.class.cast(response);
+            final AuthenticationResponse res = (AuthenticationResponse) response;
             res.setMetaData(metaData);
 
             try {

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/ClusterRequestHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/ClusterRequestHandler.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/ClusterRequestHandler.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/ClusterRequestHandler.java
Mon Aug 12 15:19:55 2013
@@ -105,7 +105,7 @@ public class ClusterRequestHandler exten
 
             if (ClusterResponse.class.isInstance(response)) {
 
-                final ClusterResponse res = ClusterResponse.class.cast(response);
+                final ClusterResponse res = (ClusterResponse) response;
 
                 try {
                     res.setMetaData(metaData);

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
Mon Aug 12 15:19:55 2013
@@ -167,11 +167,12 @@ public class EjbDaemon implements org.ap
         try {
 
             final RequestInfos.RequestInfo info = RequestInfos.info();
-            info.inputStream = new CountingInputStream(rawIn);
+            info.setInputStream(new CountingInputStream(rawIn));
 
             // Read client Protocol Version
-            clientMetaData.readExternal(info.inputStream);
-            ois = new EjbObjectInputStream(info.inputStream);
+            final CountingInputStream cis = info.getInputStream();
+            clientMetaData.readExternal(cis);
+            ois = new EjbObjectInputStream(cis);
 
             // Read ServerMetaData
             final ServerMetaData serverMetaData = new ServerMetaData();
@@ -198,11 +199,13 @@ public class EjbDaemon implements org.ap
                     clusterHandler.getLogger().debug("Failed to write to ClusterResponse",
failure);
 
                     try {
-                        oos = new ObjectOutputStream(info.outputStream);
+                        info.setOutputStream(new CountingOutputStream(rawOut));
+                        oos = new ObjectOutputStream(info.getOutputStream());
                         clusterResponse.setMetaData(clientMetaData);
                         clusterResponse.writeExternal(oos);
+                        oos.flush();
                     } catch (IOException ie) {
-                        final String m = "Failed to write to ClusterResponse";
+                        final String m = "Failed to write to ClusterResponse: " + ie.getMessage();
                         clusterHandler.getLogger().error(m, ie);
                         throw Exceptions.newIOException(m, ie);
                     }
@@ -238,11 +241,16 @@ public class EjbDaemon implements org.ap
             }
 
             try {
-                info.outputStream = new CountingOutputStream(rawOut);
-                PROTOCOL_VERSION.writeExternal(info.outputStream);
-                oos = new ObjectOutputStream(info.outputStream);
+                info.setOutputStream(new CountingOutputStream(rawOut));
+
+                final CountingOutputStream cos = info.getOutputStream();
+                PROTOCOL_VERSION.writeExternal(cos);
+                cos.flush();
 
+                oos = new ObjectOutputStream(cos);
                 clusterHandler.processResponse(clusterResponse, oos, clientMetaData);
+                oos.flush();
+
             } finally {
                 switch (requestType) {
                     case EJB_REQUEST:

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbRequestHandler.java
Mon Aug 12 15:19:55 2013
@@ -296,7 +296,7 @@ class EjbRequestHandler extends RequestH
     public void processResponse(final Response response, final ObjectOutputStream out, final
ProtocolMetaData metaData) throws Exception {
         if (EJBResponse.class.isInstance(response)) {
 
-            final EJBResponse res = EJBResponse.class.cast(response);
+            final EJBResponse res = (EJBResponse)response;
 
             try {
                 res.setMetaData(metaData);

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
Mon Aug 12 15:19:55 2013
@@ -45,6 +45,8 @@ import org.apache.openejb.core.webservic
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.resource.jdbc.DataSourceFactory;
 import org.apache.openejb.server.context.RequestInfos;
+import org.apache.openejb.server.stream.CountingInputStream;
+import org.apache.openejb.server.stream.CountingOutputStream;
 import org.apache.openejb.spi.ContainerSystem;
 import org.apache.openejb.util.LogCategory;
 import org.apache.openejb.util.Logger;
@@ -152,7 +154,7 @@ class JndiRequestHandler extends Request
 
         if (JNDIResponse.class.isInstance(response)) {
 
-            final JNDIResponse res = JNDIResponse.class.cast(response);
+            final JNDIResponse res = (JNDIResponse) response;
             final JNDIRequest req = res.getRequest();
 
             try {
@@ -208,9 +210,12 @@ class JndiRequestHandler extends Request
 
     private void logRequestResponse(final JNDIRequest req, final JNDIResponse res) {
         final RequestInfos.RequestInfo info = RequestInfos.info();
-        logger.debug("JNDI REQUEST: " + req + " (size = " + info.inputStream.getCount()
+        final CountingInputStream cis = info.getInputStream();
+        final CountingOutputStream cos = info.getOutputStream();
+
+        logger.debug("JNDI REQUEST: " + req + " (size = " + (null != cis ? cis.getCount()
: 0)
                      + "b, remote-ip =" + info.ip
-                     + ") -- RESPONSE: " + res + " (size = " + info.outputStream.getCount()
+ "b)");
+                     + ") -- RESPONSE: " + res + " (size = " + (null != cos ? cos.getCount()
: 0) + "b)");
     }
 
     private String getPrefix(final JNDIRequest req) throws NamingException {

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ClientMulticastDiscoveryTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ClientMulticastDiscoveryTest.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ClientMulticastDiscoveryTest.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ClientMulticastDiscoveryTest.java
Mon Aug 12 15:19:55 2013
@@ -242,6 +242,7 @@ public class ClientMulticastDiscoveryTes
 
     public static class Wrapper implements Serializable {
 
+        private static final long serialVersionUID = 5812936504765768722L;
         transient Socket socket;
         private final Host host;
 

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/FailoverTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/FailoverTest.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/FailoverTest.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/FailoverTest.java
Mon Aug 12 15:19:55 2013
@@ -313,6 +313,7 @@ public class FailoverTest extends TestCa
 
     public static class Wrapper implements Serializable {
 
+        private static final long serialVersionUID = 4604591462681914507L;
         transient Socket socket;
         private final Host host;
 

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/UberInterfaceTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/UberInterfaceTest.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/UberInterfaceTest.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/UberInterfaceTest.java
Mon Aug 12 15:19:55 2013
@@ -47,63 +47,63 @@ import static java.util.Arrays.asList;
 public class UberInterfaceTest extends TestCase {
 
     public void test() throws Exception {
-        EjbServer ejbServer = new EjbServer();
+        final EjbServer ejbServer = new EjbServer();
 
-        Properties initProps = new Properties();
+        final Properties initProps = new Properties();
         initProps.setProperty("openejb.deployments.classpath.include", "");
         initProps.setProperty("openejb.deployments.classpath.filter.descriptors", "true");
         OpenEJB.init(initProps, new ServerFederation());
         ejbServer.init(new Properties());
 
-        ServicePool pool = new ServicePool(ejbServer, 10);
-        ServiceDaemon serviceDaemon = new ServiceDaemon(pool, 0, "localhost");
+        final ServicePool pool = new ServicePool(ejbServer, 10);
+        final ServiceDaemon serviceDaemon = new ServiceDaemon(pool, 0, "localhost");
         serviceDaemon.start();
 
-        int port = serviceDaemon.getPort();
+        final int port = serviceDaemon.getPort();
 
-        Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
-        ConfigurationFactory config = new ConfigurationFactory();
+        final Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
+        final ConfigurationFactory config = new ConfigurationFactory();
 
-        EjbJar ejbJar = new EjbJar();
-        StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(SuperBean.class));
+        final EjbJar ejbJar = new EjbJar();
+        final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(SuperBean.class));
 
-        EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
+        final EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
 
-        EnterpriseBeanInfo beanInfo = ejbJarInfo.enterpriseBeans.get(0);
+        final EnterpriseBeanInfo beanInfo = ejbJarInfo.enterpriseBeans.get(0);
 
         assertEquals(asList(Everything.class.getName()), beanInfo.businessLocal);
         assertEquals(asList(Everything.class.getName()), beanInfo.businessRemote);
 
         assembler.createApplication(ejbJarInfo);
 
-        ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
-        BeanContext deployment = containerSystem.getBeanContext(beanInfo.ejbDeploymentId);
+        final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
+        final BeanContext deployment = containerSystem.getBeanContext(beanInfo.ejbDeploymentId);
 
         assertEquals(asList(Everything.class), deployment.getBusinessLocalInterfaces());
         assertEquals(asList(Everything.class), deployment.getBusinessRemoteInterfaces());
 
         { // remote invoke
-            Properties props = new Properties();
+            final Properties props = new Properties();
             props.put("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
             props.put("java.naming.provider.url", "ejbd://127.0.0.1:" + port);
-            Context context = new InitialContext(props);
+            final Context context = new InitialContext(props);
 
-            Everything remote = (Everything) context.lookup("SuperBeanRemote");
+            final Everything remote = (Everything) context.lookup("SuperBeanRemote");
 
-            Reference reference = new Reference("test");
+            final Reference reference = new Reference("test");
 
             assertEquals(reference, remote.echo(reference));
             assertNotSame(reference, remote.echo(reference)); // pass by value
         }
 
         { // local invoke
-            Properties props = new Properties();
+            final Properties props = new Properties();
             props.put("java.naming.factory.initial", "org.apache.openejb.core.LocalInitialContextFactory");
-            Context context = new InitialContext(props);
+            final Context context = new InitialContext(props);
 
-            Everything local = (Everything) context.lookup("SuperBeanLocal");
+            final Everything local = (Everything) context.lookup("SuperBeanLocal");
 
-            Reference reference = new Reference("test");
+            final Reference reference = new Reference("test");
 
             assertEquals(reference, local.echo(reference));
             assertSame(reference, local.echo(reference)); // pass by reference
@@ -120,21 +120,23 @@ public class UberInterfaceTest extends T
 
     public static class SuperBean implements Everything {
 
-        public Object echo(Object o) {
+        @Override
+        public Object echo(final Object o) {
             return o;
         }
     }
 
     public static class Reference implements Serializable {
 
+        private static final long serialVersionUID = -7739317717965024181L;
         private final String value;
 
-        public Reference(String value) {
+        public Reference(final String value) {
             this.value = value;
         }
 
         @Override
-        public boolean equals(Object o) {
+        public boolean equals(final Object o) {
             if (this == o) {
                 return true;
             }
@@ -142,7 +144,7 @@ public class UberInterfaceTest extends T
                 return false;
             }
 
-            Reference value1 = (Reference) o;
+            final Reference value1 = (Reference) o;
 
             if (!value.equals(value1.value)) {
                 return false;

Modified: tomee/tomee/trunk/server/openejb-server/src/main/java/org/apache/openejb/server/context/RequestInfos.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-server/src/main/java/org/apache/openejb/server/context/RequestInfos.java?rev=1513162&r1=1513161&r2=1513162&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-server/src/main/java/org/apache/openejb/server/context/RequestInfos.java
(original)
+++ tomee/tomee/trunk/server/openejb-server/src/main/java/org/apache/openejb/server/context/RequestInfos.java
Mon Aug 12 15:19:55 2013
@@ -73,8 +73,34 @@ public final class RequestInfos {
     public static class RequestInfo {
 
         public String ip;
-        public CountingInputStream inputStream;
-        public CountingOutputStream outputStream;
+        private CountingInputStream inputStream;
+        private CountingOutputStream outputStream;
+
+        public CountingInputStream getInputStream() {
+
+            if (null == inputStream) {
+                throw new RuntimeException("InputStream has not been set");
+            }
+
+            return inputStream;
+        }
+
+        public CountingOutputStream getOutputStream() {
+
+            if (null == outputStream) {
+                throw new RuntimeException("OutputStream has not been set");
+            }
+
+            return outputStream;
+        }
+
+        public void setInputStream(final CountingInputStream inputStream) {
+            this.inputStream = inputStream;
+        }
+
+        public void setOutputStream(final CountingOutputStream outputStream) {
+            this.outputStream = outputStream;
+        }
 
         @Override
         public String toString() {



Mime
View raw message