[jboss-remoting-commits] JBoss Remoting SVN: r3760 - in remoting3/trunk: jrpp/src/main/java/org/jboss/cx/remoting/jrpp and 1 other directory.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Tue Mar 25 20:38:16 EDT 2008


Author: david.lloyd at jboss.com
Date: 2008-03-25 20:38:16 -0400 (Tue, 25 Mar 2008)
New Revision: 3760

Modified:
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java
Log:
Fix serialization problem, exception handling, and closed connection handling

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java	2008-03-26 00:12:50 UTC (rev 3759)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java	2008-03-26 00:38:16 UTC (rev 3760)
@@ -98,7 +98,7 @@
     }
 
     UserSession getUserSession() {
-        state.requireHold(State.UP);
+        state.waitForHold(State.UP);
         try {
             return userSession;
         } finally {
@@ -452,9 +452,9 @@
 
         @SuppressWarnings ({"unchecked"})
         public void openSession(String remoteEndpointName) {
-            state.waitForNotExclusive(State.NEW);
+            state.waitFor(State.CONNECTING);
+            state.requireTransitionExclusive(State.CONNECTING, State.UP);
             try {
-                state.requireTransition(State.CONNECTING, State.UP);
                 CoreSession.this.remoteEndpointName = remoteEndpointName;
             } finally {
                 state.releaseExclusive();
@@ -565,9 +565,11 @@
                         throw new IOException("Duplicate stream identifier encountered: " + streamIdentifier);
                     }
                     streamSerializers.add(stream.getStreamSerializer());
+                    log.trace("Writing stream marker for object: %s", testObject);
                     return new StreamMarker(factory.getClass(), streamIdentifier);
                 }
             }
+            log.trace("Writing object: %s", testObject);
             return testObject;
         }
     }

Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java	2008-03-26 00:12:50 UTC (rev 3759)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java	2008-03-26 00:38:16 UTC (rev 3760)
@@ -320,19 +320,19 @@
     }
 
     private void write(ObjectOutput output, ServiceIdentifier serviceIdentifier) throws IOException {
-        output.writeShort(((JrppServiceIdentifier)serviceIdentifier).getId());
+        output.writeObject(serviceIdentifier);
     }
 
     private void write(ObjectOutput output, ContextIdentifier contextIdentifier) throws IOException {
-        output.writeShort(((JrppContextIdentifier)contextIdentifier).getId());
+        output.writeObject(contextIdentifier);
     }
 
     private void write(ObjectOutput output, StreamIdentifier streamIdentifier) throws IOException {
-        output.writeShort(((JrppStreamIdentifier)streamIdentifier).getId());
+        output.writeObject(streamIdentifier);
     }
 
     private void write(ObjectOutput output, RequestIdentifier requestIdentifier) throws IOException {
-        output.writeShort(((JrppRequestIdentifier)requestIdentifier).getId());
+        output.writeObject(requestIdentifier);
     }
 
     public void sendResponse(byte[] rawMsgData) throws IOException {
@@ -674,6 +674,7 @@
 
         public void exceptionCaught(Throwable throwable) {
             log.error(throwable, "Exception from JRPP connection handler");
+            close();
             if (throwable instanceof IOException) {
                 fail((IOException)throwable);
             } else {

Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java	2008-03-26 00:12:50 UTC (rev 3759)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java	2008-03-26 00:38:16 UTC (rev 3760)
@@ -10,6 +10,7 @@
 import org.apache.mina.common.IoProcessor;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoSessionInitializer;
+import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.filter.logging.LoggingFilter;
 import org.apache.mina.filter.sasl.SaslClientFilter;
 import org.apache.mina.filter.sasl.SaslMessageSender;
@@ -73,6 +74,11 @@
     // Lifecycle
 
     public void create() throws RemotingException {
+        ExceptionMonitor.setInstance(new ExceptionMonitor() {
+            public void exceptionCaught(final Throwable cause) {
+                // do nothing!
+            }
+        });
         ioProcessor = new NioProcessor(executor);
         protocolHandlerFactory = new ProtocolHandlerFactoryImpl();
         final Registration registration = endpoint.registerProtocol("jrpp", protocolHandlerFactory);




More information about the jboss-remoting-commits mailing list