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

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Sat Apr 19 00:24:07 EDT 2008


Author: david.lloyd at jboss.com
Date: 2008-04-19 00:24:07 -0400 (Sat, 19 Apr 2008)
New Revision: 4025

Added:
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericClientIdentifier.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericIdentifier.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericRequestIdentifier.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericServiceIdentifier.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericStreamIdentifier.java
Removed:
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppClientIdentifier.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppRequestIdentifier.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppServiceIdentifier.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppStreamIdentifier.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppSubChannelIdentifier.java
Modified:
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
Log:
Make the numeric identifier system generally available

Copied: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericClientIdentifier.java (from rev 4023, remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppClientIdentifier.java)
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericClientIdentifier.java	                        (rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericClientIdentifier.java	2008-04-19 04:24:07 UTC (rev 4025)
@@ -0,0 +1,21 @@
+package org.jboss.cx.remoting.spi.protocol;
+
+/**
+ *
+ */
+ at SuppressWarnings ({"EqualsAndHashcode"})
+public final class NumericClientIdentifier extends NumericIdentifier implements ClientIdentifier {
+
+    private static final long serialVersionUID = 1L;
+
+    public NumericClientIdentifier() {
+    }
+
+    public NumericClientIdentifier(final boolean client, final int id) {
+        super(client, id);
+    }
+
+    public boolean equals(Object obj) {
+        return obj instanceof NumericClientIdentifier && super.equals(obj);
+    }
+}

Copied: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericIdentifier.java (from rev 4023, remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppSubChannelIdentifier.java)
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericIdentifier.java	                        (rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericIdentifier.java	2008-04-19 04:24:07 UTC (rev 4025)
@@ -0,0 +1,52 @@
+package org.jboss.cx.remoting.spi.protocol;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/**
+ *
+ */
+public abstract class NumericIdentifier implements Externalizable {
+
+    private static final long serialVersionUID = 1L;
+
+    private /*final*/ boolean client;
+    private /*final*/ int id;
+
+    protected NumericIdentifier() {
+    }
+
+    protected NumericIdentifier(final boolean client, final int id) {
+        if (id < 0) {
+            throw new IllegalArgumentException("id must be >= 0");
+        }
+        this.client = client;
+        this.id = id;
+    }
+
+    public final void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(id << 1 | (client ? 0 : 1));
+    }
+
+    public final void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        int i = in.readInt();
+        id = i >>> 1;
+        client = (i & 1) == 0;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public boolean equals(Object obj) {
+        if (!(obj instanceof NumericIdentifier)) return false;
+        NumericIdentifier other = (NumericIdentifier) obj;
+        return other.id == id && other.client == client;
+    }
+
+    public int hashCode() {
+        return id << 1 | (client ? 0 : 1);
+    }
+}

Copied: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericRequestIdentifier.java (from rev 4023, remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppRequestIdentifier.java)
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericRequestIdentifier.java	                        (rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericRequestIdentifier.java	2008-04-19 04:24:07 UTC (rev 4025)
@@ -0,0 +1,21 @@
+package org.jboss.cx.remoting.spi.protocol;
+
+/**
+ *
+ */
+ at SuppressWarnings ({"EqualsAndHashcode"})
+public final class NumericRequestIdentifier extends NumericIdentifier implements RequestIdentifier {
+
+    private static final long serialVersionUID = 1L;
+
+    public NumericRequestIdentifier() {
+    }
+
+    public NumericRequestIdentifier(final boolean client, final int id) {
+        super(client, id);
+    }
+
+    public boolean equals(Object obj) {
+        return obj instanceof NumericRequestIdentifier && super.equals(obj);
+    }
+}

Copied: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericServiceIdentifier.java (from rev 4023, remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppServiceIdentifier.java)
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericServiceIdentifier.java	                        (rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericServiceIdentifier.java	2008-04-19 04:24:07 UTC (rev 4025)
@@ -0,0 +1,21 @@
+package org.jboss.cx.remoting.spi.protocol;
+
+/**
+ *
+ */
+ at SuppressWarnings ({"EqualsAndHashcode"})
+public final class NumericServiceIdentifier extends NumericIdentifier implements ServiceIdentifier {
+
+    private static final long serialVersionUID = 1L;
+
+    public NumericServiceIdentifier() {
+    }
+
+    public NumericServiceIdentifier(final boolean client, final int id) {
+        super(client, id);
+    }
+
+    public boolean equals(Object obj) {
+        return obj instanceof NumericServiceIdentifier && super.equals(obj);
+    }
+}

Copied: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericStreamIdentifier.java (from rev 4023, remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppStreamIdentifier.java)
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericStreamIdentifier.java	                        (rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/NumericStreamIdentifier.java	2008-04-19 04:24:07 UTC (rev 4025)
@@ -0,0 +1,21 @@
+package org.jboss.cx.remoting.spi.protocol;
+
+/**
+ *
+ */
+ at SuppressWarnings ({"EqualsAndHashcode"})
+public final class NumericStreamIdentifier extends NumericIdentifier implements StreamIdentifier {
+
+    private static final long serialVersionUID = 1L;
+
+    public NumericStreamIdentifier() {
+    }
+
+    public NumericStreamIdentifier(final boolean client, final int id) {
+        super(client, id);
+    }
+
+    public boolean equals(Object obj) {
+        return obj instanceof NumericStreamIdentifier && super.equals(obj);
+    }
+}

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-04-19 04:19:02 UTC (rev 4024)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java	2008-04-19 04:24:07 UTC (rev 4025)
@@ -20,10 +20,10 @@
 import org.apache.mina.handler.multiton.SingleSessionIoHandler;
 import org.jboss.cx.remoting.CommonKeys;
 import org.jboss.cx.remoting.RemoteExecutionException;
-import org.jboss.cx.remoting.jrpp.id.JrppClientIdentifier;
-import org.jboss.cx.remoting.jrpp.id.JrppRequestIdentifier;
-import org.jboss.cx.remoting.jrpp.id.JrppServiceIdentifier;
-import org.jboss.cx.remoting.jrpp.id.JrppStreamIdentifier;
+import org.jboss.cx.remoting.spi.protocol.NumericClientIdentifier;
+import org.jboss.cx.remoting.spi.protocol.NumericRequestIdentifier;
+import org.jboss.cx.remoting.spi.protocol.NumericServiceIdentifier;
+import org.jboss.cx.remoting.spi.protocol.NumericStreamIdentifier;
 import org.jboss.cx.remoting.jrpp.mina.IoBufferByteMessageInput;
 import org.jboss.cx.remoting.jrpp.mina.IoBufferByteMessageOutput;
 import org.jboss.cx.remoting.log.Logger;
@@ -160,8 +160,8 @@
             ioSession.setAttribute(JRPP_CONNECTION, this);
             this.ioSession = ioSession;
             client = true;
-            remoteRootClientIdentifier = new JrppClientIdentifier(false, 0);
-            localRootClientIdentifier = new JrppClientIdentifier(true, 0);
+            remoteRootClientIdentifier = new NumericClientIdentifier(false, 0);
+            localRootClientIdentifier = new NumericClientIdentifier(true, 0);
         } finally {
             state.releaseExclusive();
         }
@@ -176,8 +176,8 @@
             ioSession.setAttribute(JRPP_CONNECTION, this);
             this.ioSession = ioSession;
             client = false;
-            remoteRootClientIdentifier = new JrppClientIdentifier(true, 0);
-            localRootClientIdentifier = new JrppClientIdentifier(false, 0);
+            remoteRootClientIdentifier = new NumericClientIdentifier(true, 0);
+            localRootClientIdentifier = new NumericClientIdentifier(false, 0);
         } finally {
             state.releaseExclusive();
         }
@@ -418,36 +418,36 @@
         }
     }
 
-    private JrppClientIdentifier getNewContextIdentifier() {
+    private NumericClientIdentifier getNewContextIdentifier() {
         for (;;) {
-            final JrppClientIdentifier contextIdentifier = new JrppClientIdentifier(client, contextIdSequence.getAndIncrement());
+            final NumericClientIdentifier contextIdentifier = new NumericClientIdentifier(client, contextIdSequence.getAndIncrement());
             if (liveClientSet.add(contextIdentifier)) {
                 return contextIdentifier;
             }
         }
     }
 
-    private JrppRequestIdentifier getNewRequestIdentifier() {
+    private NumericRequestIdentifier getNewRequestIdentifier() {
         for (;;) {
-            final JrppRequestIdentifier requestIdentifier = new JrppRequestIdentifier(client, requestIdSequence.getAndIncrement());
+            final NumericRequestIdentifier requestIdentifier = new NumericRequestIdentifier(client, requestIdSequence.getAndIncrement());
             if (liveRequestSet.add(requestIdentifier)) {
                 return requestIdentifier;
             }
         }
     }
 
-    private JrppStreamIdentifier getNewStreamIdentifier() {
+    private NumericStreamIdentifier getNewStreamIdentifier() {
         for (;;) {
-            final JrppStreamIdentifier streamIdentifier = new JrppStreamIdentifier(client, streamIdSequence.getAndIncrement());
+            final NumericStreamIdentifier streamIdentifier = new NumericStreamIdentifier(client, streamIdSequence.getAndIncrement());
             if (liveStreamSet.add(streamIdentifier)) {
                 return streamIdentifier;
             }
         }
     }
 
-    private JrppServiceIdentifier getNewServiceIdentifier() {
+    private NumericServiceIdentifier getNewServiceIdentifier() {
         for (;;) {
-            final JrppServiceIdentifier serviceIdentifier = new JrppServiceIdentifier(client, serviceIdSequence.getAndIncrement());
+            final NumericServiceIdentifier serviceIdentifier = new NumericServiceIdentifier(client, serviceIdSequence.getAndIncrement());
             if (liveServiceSet.add(serviceIdentifier)) {
                 return serviceIdentifier;
             }

Deleted: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppClientIdentifier.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppClientIdentifier.java	2008-04-19 04:19:02 UTC (rev 4024)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppClientIdentifier.java	2008-04-19 04:24:07 UTC (rev 4025)
@@ -1,23 +0,0 @@
-package org.jboss.cx.remoting.jrpp.id;
-
-import org.jboss.cx.remoting.spi.protocol.ClientIdentifier;
-
-/**
- *
- */
- at SuppressWarnings ({"EqualsAndHashcode"})
-public final class JrppClientIdentifier extends JrppSubChannelIdentifier implements ClientIdentifier {
-
-    private static final long serialVersionUID = 1L;
-
-    public JrppClientIdentifier() {
-    }
-
-    public JrppClientIdentifier(final boolean client, final int id) {
-        super(client, id);
-    }
-
-    public boolean equals(Object obj) {
-        return obj instanceof JrppClientIdentifier && super.equals(obj);
-    }
-}

Deleted: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppRequestIdentifier.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppRequestIdentifier.java	2008-04-19 04:19:02 UTC (rev 4024)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppRequestIdentifier.java	2008-04-19 04:24:07 UTC (rev 4025)
@@ -1,23 +0,0 @@
-package org.jboss.cx.remoting.jrpp.id;
-
-import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
-
-/**
- *
- */
- at SuppressWarnings ({"EqualsAndHashcode"})
-public final class JrppRequestIdentifier extends JrppSubChannelIdentifier implements RequestIdentifier {
-
-    private static final long serialVersionUID = 1L;
-
-    public JrppRequestIdentifier() {
-    }
-
-    public JrppRequestIdentifier(final boolean client, final int id) {
-        super(client, id);
-    }
-
-    public boolean equals(Object obj) {
-        return obj instanceof JrppRequestIdentifier && super.equals(obj);
-    }
-}

Deleted: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppServiceIdentifier.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppServiceIdentifier.java	2008-04-19 04:19:02 UTC (rev 4024)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppServiceIdentifier.java	2008-04-19 04:24:07 UTC (rev 4025)
@@ -1,23 +0,0 @@
-package org.jboss.cx.remoting.jrpp.id;
-
-import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;
-
-/**
- *
- */
- at SuppressWarnings ({"EqualsAndHashcode"})
-public final class JrppServiceIdentifier extends JrppSubChannelIdentifier implements ServiceIdentifier {
-
-    private static final long serialVersionUID = 1L;
-
-    public JrppServiceIdentifier() {
-    }
-
-    public JrppServiceIdentifier(final boolean client, final int id) {
-        super(client, id);
-    }
-
-    public boolean equals(Object obj) {
-        return obj instanceof JrppServiceIdentifier && super.equals(obj);
-    }
-}

Deleted: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppStreamIdentifier.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppStreamIdentifier.java	2008-04-19 04:19:02 UTC (rev 4024)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppStreamIdentifier.java	2008-04-19 04:24:07 UTC (rev 4025)
@@ -1,23 +0,0 @@
-package org.jboss.cx.remoting.jrpp.id;
-
-import org.jboss.cx.remoting.spi.protocol.StreamIdentifier;
-
-/**
- *
- */
- at SuppressWarnings ({"EqualsAndHashcode"})
-public final class JrppStreamIdentifier extends JrppSubChannelIdentifier implements StreamIdentifier {
-
-    private static final long serialVersionUID = 1L;
-
-    public JrppStreamIdentifier() {
-    }
-
-    public JrppStreamIdentifier(final boolean client, final int id) {
-        super(client, id);
-    }
-
-    public boolean equals(Object obj) {
-        return obj instanceof JrppStreamIdentifier && super.equals(obj);
-    }
-}

Deleted: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppSubChannelIdentifier.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppSubChannelIdentifier.java	2008-04-19 04:19:02 UTC (rev 4024)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppSubChannelIdentifier.java	2008-04-19 04:24:07 UTC (rev 4025)
@@ -1,52 +0,0 @@
-package org.jboss.cx.remoting.jrpp.id;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-/**
- *
- */
-public abstract class JrppSubChannelIdentifier implements Externalizable {
-
-    private static final long serialVersionUID = 1L;
-
-    private /*final*/ boolean client;
-    private /*final*/ int id;
-
-    protected JrppSubChannelIdentifier() {
-    }
-
-    protected JrppSubChannelIdentifier(final boolean client, final int id) {
-        if (id < 0) {
-            throw new IllegalArgumentException("id must be >= 0");
-        }
-        this.client = client;
-        this.id = id;
-    }
-
-    public final void writeExternal(ObjectOutput out) throws IOException {
-        out.writeInt(id << 1 | (client ? 0 : 1));
-    }
-
-    public final void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        int i = in.readInt();
-        id = i >>> 1;
-        client = (i & 1) == 0;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public boolean equals(Object obj) {
-        if (!(obj instanceof JrppSubChannelIdentifier)) return false;
-        JrppSubChannelIdentifier other = (JrppSubChannelIdentifier) obj;
-        return other.id == id && other.client == client;
-    }
-
-    public int hashCode() {
-        return id << 1 | (client ? 0 : 1);
-    }
-}




More information about the jboss-remoting-commits mailing list