[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/transport/multiplex ...
Ron Sigal
ron_sigal at yahoo.com
Wed Jul 19 19:22:28 EDT 2006
User: rsigal
Date: 06/07/19 19:22:28
Modified: src/main/org/jboss/remoting/transport/multiplex
MultiplexServerInvoker.java
MultiplexingInputStream.java
VirtualServerSocketFactory.java
MultiplexingManager.java VirtualSocket.java
VirtualServerSocket.java Multiplex.java
MultiplexInvokerConstants.java
MultiplexClientInvoker.java OutputMultiplexor.java
MasterServerSocket.java PendingAction.java
InputMultiplexor.java MultiplexingOutputStream.java
Protocol.java VirtualSocketFactory.java
SocketId.java
Removed: src/main/org/jboss/remoting/transport/multiplex
StoppableThread.java SinkOutputStream.java
Log:
JBREM-390: added javadoc.
Revision Changes Path
1.51 +73 -63 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexServerInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MultiplexServerInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexServerInvoker.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- MultiplexServerInvoker.java 25 Jun 2006 19:00:14 -0000 1.50
+++ MultiplexServerInvoker.java 19 Jul 2006 23:22:28 -0000 1.51
@@ -22,25 +22,6 @@
package org.jboss.remoting.transport.multiplex;
-import org.jboss.logging.Logger;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.InvokerRegistry;
-import org.jboss.remoting.ServerInvocationHandler;
-import org.jboss.remoting.ServerInvoker;
-import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
-import org.jboss.remoting.marshal.serializable.SerializableMarshaller;
-import org.jboss.remoting.security.SSLSocketBuilder;
-import org.jboss.remoting.transport.PortUtil;
-import org.jboss.remoting.transport.multiplex.utility.AddressPair;
-import org.jboss.remoting.transport.socket.SocketServerInvoker;
-import org.jboss.remoting.transport.socket.SocketServerInvoker.ServerSocketRefresh;
-import org.jboss.remoting.util.socket.HandshakeRepeater;
-
-import javax.net.ServerSocketFactory;
-import javax.net.SocketFactory;
-import javax.net.ssl.HandshakeCompletedEvent;
-import javax.net.ssl.HandshakeCompletedListener;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
@@ -55,8 +36,28 @@
import java.util.Map;
import java.util.Set;
+import javax.net.ServerSocketFactory;
+import javax.net.ssl.HandshakeCompletedEvent;
+import javax.net.ssl.HandshakeCompletedListener;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.InvokerRegistry;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
+import org.jboss.remoting.marshal.serializable.SerializableMarshaller;
+import org.jboss.remoting.transport.PortUtil;
+import org.jboss.remoting.transport.multiplex.utility.AddressPair;
+import org.jboss.remoting.transport.socket.SocketServerInvoker;
+import org.jboss.remoting.util.socket.HandshakeRepeater;
+
/**
+ * <code>MultiplexServerInvoker</code> is the server side of the Multiplex transport.
+ * For more information, see Remoting documentation on labs.jboss.org.
+ *
* @author <a href="mailto:tom.elrod at jboss.com">Tom Elrod</a>
* @author <a href="mailto:r.sigal at computer.org">Ron Sigal</a>
*/
@@ -91,44 +92,54 @@
/*
* The following parameters may be set in any of four ways:
*
- * 1. They may be appended to an InvokerLocator passed to a Connector constructor.
- * 2. They may be included in a configuration Map passed to a Connector constructor.
- * 3. They may be described in a <config> XML element passed to Connector.setConfiguration().
- * 4. In some cases, a MultiplexServerInvoker setter methods may be invoked.
- *
- * Of those of the following parameters destined for MultiplexServerInvoker, there are
- * two categories.
- *
- * 1. serverMultiplexId, multiplexConnectHost, and multiplexConnectPort are used to
- * match up MultiplexClientInvokers and virtual MultiplexServerInvokers so that
+ * 1. They may be appended to an <code>InvokerLocator</code> passed to a
+ * <code>Connector</code> constructor.
+ * 2. They may be included in a configuration <code>Map</code> passed to a
+ * <code>Connector</code> constructor.
+ * 3. They may be described in a <config> XML element passed to
+ * <code>Connector.setConfiguration()</code>.
+ * 4. In some cases, a <code>MultiplexServerInvoker</code> setter methods may be invoked.
+ *
+ * Of those of the following parameters destined for <code>MultiplexServerInvoker</code>,
+ * there are two categories.
+ *
+ * 1. <code>serverMultiplexId</code>, <code>multiplexConnectHost</code>, and
+ * <code>multiplexConnectPort</code> are used to
+ * match up <code>MultiplexClientInvoker</code>s and virtual
+ * <code>MultiplexServerInvokers</code> so that
* they share an underlying socket connection. Depending on the way in which
* the information is provided (see Remoting documentation), the connection may
- * be created any time during or after the call to Connector.create(). Note,
- * however, that if a callback MultiplexServerInvoker is created with just a
- * serverMultiplexId parameter (server rule 3 in the Remoting documentation),
- * then calling setMultiplexConnectHost() and setMultiplexConnectPort() will
- * not trigger the creation of a connection. Moreover, when a Client comes
- * along, the connect information supplied by the Client will be used, so there
+ * be created any time during or after the call to <code>Connector.create()</code>. Note,
+ * however, that if a callback <code>MultiplexServerInvoker</code> is created with just a
+ * <code>serverMultiplexId</code> parameter (server rule 3 in the Remoting documentation),
+ * then calling <code>setMultiplexConnectHost()</code> and
+ * <code>setMultiplexConnectPort()</code> will
+ * not trigger the creation of a connection. Moreover, when a <code>Client</code> comes
+ * along, the connect information supplied by the <code>Client</code> will be used, so there
* is no point to having setter methods for these parameters.
*
- * 2. maxAcceptErrors is used in the MultiplexServerInvoker accept() loop, and it
- * may be changed at any time by calling setMaxAcceptErrors().
+ * 2. <code>maxAcceptErrors</code> is used in the
+ * <code>MultiplexServerInvoker</code> <code>accept()</code> loop, and it
+ * may be changed at any time by calling <code>setMaxAcceptErrors()</code>.
+ *
+ * Those of the following parameters which are destined for the <code>MultiplexingManager</code>,
+ * <code>InputMultiplexor</code>, and <code>OutputMultiplexor</code> classes are
+ * passed to them by way of a configuration <code>Map</code> passed to
+ * <code>VirtualSocket</code> and <code>VirtualServerSocket</code> constructors.
*
- * Those of the following parameters which are destined for the MultiplexingManager,
- * InputMultiplexor, and OutputMultiplexor classes are passed to them by way of a
- * configuration Map passed to VirtualSocket and VirtualServerSocket constructors.
- *
- * A VirtualServerSocket is created when a server side master MultiplexServerInvoker
+ * A <code>VirtualServerSocket</code> is created when a server side master
+ * <code>MultiplexServerInvoker</code>
* accepts a connection request generated by the creation of a priming socket on a client.
- * Since this can happen any time after Connector.start() is created, the values of
+ * Since this can happen any time after <code>Connector.start()</code> is created, the values of
* these parameters can be changed by calling their respective setter methods any
- * time before Connector.start() is called.
+ * time before <code>Connector.start()</code> is called.
*
- * A VirtualSocket is created when a client side MultiplexClientInvoker or callback
- * MultiplexServerInvoker opens a priming socket, and this happens when
- * Connector.create() is called. Therefore, the values of these parameters can be
- * changed by calling their respective setter methods any time before Connector.create()
- * is called.
+ * A <code>VirtualSocket</code> is created when a client side
+ * <code>MultiplexClientInvoker</code> or callback
+ * <code>MultiplexServerInvoker</code> opens a priming socket, and this happens when
+ * <code>Connector.create()</code> is called. Therefore, the values of these parameters can be
+ * changed by calling their respective setter methods any time before
+ * <code>Connector.create()</code> is called.
*/
// MultiplexingManager:
private int staticThreadsMonitorPeriod;
@@ -154,9 +165,8 @@
private int multiplexConnectPort;
private boolean multiplexConnectPortIsSet; // to check for missing configuration information
+
/**
- * FIXME Comment this
- *
* @return
*/
public static Map getAddressPairMap()
@@ -166,8 +176,6 @@
/**
- * FIXME Comment this
- *
* @return
*/
public static Map getSocketGroupMap()
@@ -178,7 +186,7 @@
/**
*
- * Create a new MultiplexServerInvoker.
+ * Create a new <code>MultiplexServerInvoker</code>.
*
* @param locator
*/
@@ -191,7 +199,7 @@
/**
*
- * Create a new MultiplexServerInvoker.
+ * Create a new <code>MultiplexServerInvoker</code>.
*
* @param locator
* @param configuration
@@ -205,12 +213,12 @@
/**
*
- * Create a new MultiplexServerInvoker.
+ * Create a new <code>MultiplexServerInvoker</code>.
* @param locator
* @param configuration
* @param serverSocket
- * @param virtualServerInvokers TODO
- * @param primintSocket TODO
+ * @param virtualServerInvokers
+ * @param primintSocket
*/
protected MultiplexServerInvoker(InvokerLocator locator, Map configuration,
ServerSocket serverSocket, Socket socket,
@@ -377,10 +385,10 @@
}
}
+
/**
- * FIXME Comment this
- *
- *
+ * Finishes start up process when suitable bind and connect information is available.
+ * For more information, see the Multiplex subsystem documentation at labs.jboss.org.
*/
protected void finishStart() throws IOException
{
@@ -963,7 +971,8 @@
/**
- * FIXME Comment this
+ * Provides access to a virtual <code>MultiplexServerInvoker</code> in a master
+ * <code>MultiplexServerInvoker</code>'s invoker farm.
*
* @param address
* @return
@@ -975,8 +984,8 @@
/**
- * FIXME Comment this
- *
+ * Provides access to all virtual <code>MultiplexServerInvoker</code>s in a master
+ * <code>MultiplexServerInvoker</code>'s invoker farm.
* @return
*/
public Collection getServerInvokers()
@@ -986,8 +995,6 @@
/**
- * FIXME Comment this
- *
*
*/
protected void setBindingInfo() throws IOException
@@ -1294,6 +1301,9 @@
}
+ /**
+ * <code>SocketGroupInfo</code> holds all of the information for a single virtual socket group.
+ */
public static class SocketGroupInfo
{
private String socketGroupId;
1.28 +22 -18 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexingInputStream.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MultiplexingInputStream.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexingInputStream.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- MultiplexingInputStream.java 19 May 2006 16:16:18 -0000 1.27
+++ MultiplexingInputStream.java 19 Jul 2006 23:22:28 -0000 1.28
@@ -35,7 +35,11 @@
import org.jboss.remoting.transport.multiplex.utility.VirtualSelector;
/**
- *
+ * <code>MultiplexingInputStream</code> is the class returned by
+ * <code>VirtualSocket.getInputStream()</code>.
+ * It supports the methods and behavior implemented by the <code>InputStream</code> returned by
+ * <code>java.net.Socket.getInputStream()</code>. For more information about the behavior
+ * of the methods, see the javadoc for <code>java.io.InputStream</code>.
* <p>
* Copyright (c) 2005
* <p>
@@ -44,22 +48,19 @@
public class MultiplexingInputStream extends GrowablePipedInputStream
{
protected static final Logger log = Logger.getLogger(MultiplexingInputStream.class);
- private MultiplexingManager manager;
private VirtualSocket socket;
- private GrowablePipedOutputStream sourceStream;
private boolean eof = false;
private boolean closed = false;
private boolean remoteShutDownPending = false;
private Set readingThreads = new HashSet();
- private byte[] oneByteArray = new byte[1];
private IOException readException;
private long skipCount = 0;
private boolean tracing;
/**
- * @param sourceStream TODO
- * @param manager TODO
+ * @param sourceStream
+ * @param manager
*/
public MultiplexingInputStream(GrowablePipedOutputStream sourceStream, MultiplexingManager manager)
throws IOException
@@ -70,8 +71,8 @@
/**
* @param sourceStream
- * @param manager TODO
- * @param socket TODO
+ * @param manager
+ * @param socket
*
*/
public MultiplexingInputStream(GrowablePipedOutputStream sourceStream,
@@ -85,9 +86,9 @@
/**
* @param sourceStream
- * @param manager TODO
+ * @param manager
* @param socket
- * @param virtualSelector TODO
+ * @param virtualSelector
*
*/
public MultiplexingInputStream(GrowablePipedOutputStream sourceStream,
@@ -97,8 +98,6 @@
throws IOException
{
super(sourceStream, virtualSelector);
- this.sourceStream = sourceStream;
- this.manager = manager;
this.socket = socket;
tracing = log.isTraceEnabled();
}
@@ -121,7 +120,7 @@
*************************************************************************************************/
/**
- *
+ * See superclass javadoc.
*/
public void close() throws IOException
{
@@ -141,7 +140,7 @@
/**
- *
+ * See superclass javadoc.
*/
public synchronized int read() throws IOException
{
@@ -192,7 +191,7 @@
/**
- *
+ * See superclass javadoc.
*/
public int read(byte[] bytes) throws IOException
{
@@ -201,7 +200,7 @@
/**
- *
+ * See superclass javadoc.
*/
public synchronized int read(byte[] bytes, int off, int len) throws IOException
{
@@ -251,6 +250,9 @@
}
+ /**
+ * See superclass javadoc.
+ */
public synchronized long skip(long n) throws IOException
{
if (eof)
@@ -419,8 +421,6 @@
/**
- * FIXME Comment this
- *
*
*/
protected synchronized void interruptReadingThreads()
@@ -438,6 +438,10 @@
}
+/**
+ * <code>readInt()</code> is borrowed from DataInputStream. It saves the extra expense of
+ * creating a DataInputStream
+ */
public final int readInt() throws IOException
{
int b1 = read();
1.8 +14 -18 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/VirtualServerSocketFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: VirtualServerSocketFactory.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/VirtualServerSocketFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- VirtualServerSocketFactory.java 3 Jan 2006 02:59:43 -0000 1.7
+++ VirtualServerSocketFactory.java 19 Jul 2006 23:22:28 -0000 1.8
@@ -36,10 +36,18 @@
/**
- * A VirtualServerSocketFactory.
-
+ * <code>VirtualServerSocketFactory</code> extends the
+ * <code>javax.net.ServerSocketFactory</code> class and reimplements
+ * its <code>createServerSocket()</code> methods. By default it creates
+ * <code>MasterServerSocket</code>s, but
+ * if the <code>setOnClient()</code> method has been called and the
+ * <code>setOnServer()</code> method has not
+ * been called more recently, <code>VirtualServerSocketFactory</code> creates
+ * <code>VirtualServerSocket</code>s.
+ *
+ * <p>
* @author <a href="mailto:r.sigal at computer.org">Ron Sigal</a>
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
* <p>
* Copyright (c) 2005
* </p>
@@ -56,10 +64,6 @@
}
-/**
- * Create a new VirtualServerSocketFactory.
- *
- */
protected VirtualServerSocketFactory()
{
}
@@ -70,7 +74,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
/**
- *
+ * See superclass javadoc.
*/
public ServerSocket createServerSocket(int port) throws IOException
{
@@ -82,7 +86,7 @@
/**
- * TODO
+ * See superclass javadoc.
*/
public ServerSocket createServerSocket(int port, int backlog) throws IOException
{
@@ -97,7 +101,7 @@
/**
- * TODO
+ * See superclass javadoc.
*/
public ServerSocket createServerSocket(int port, int backlog, InetAddress address) throws IOException
{
@@ -117,8 +121,6 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * FIXME Comment this
- *
* @return
*/
public boolean isOnClient()
@@ -128,8 +130,6 @@
/**
- * FIXME Comment this
- *
* @return
*/
public boolean isOnServer()
@@ -139,8 +139,6 @@
/**
- * FIXME Comment this
- *
* @return
*/
public boolean setOnClient()
@@ -152,8 +150,6 @@
/**
- * FIXME Comment this
- *
* @return
*/
public boolean setOnServer()
1.49 +62 -72 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexingManager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MultiplexingManager.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexingManager.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- MultiplexingManager.java 1 Jul 2006 00:18:39 -0000 1.48
+++ MultiplexingManager.java 19 Jul 2006 23:22:28 -0000 1.49
@@ -59,6 +59,25 @@
/**
+ * <code>MultiplexingManager</code> is the heart of the Multiplex system. It is the implementation
+ * of the virtual socket group concept. See the Multiplex documentation on the
+ * labs.jboss.org website for more information about virtual socket groups.
+ * <p>
+ * <code>MultiplexingManager</code> wraps a single real <code>java.net.Socket</code>.
+ * It creates the socket when it is running on the client side, and it is passed a
+ * socket by <code>MasterServerSocket</code> when it is running on the server side.
+ * <p>
+ * <code>MultiplexingManager</code> creates the infrastructure
+ * which supports multiplexing, including an <code>OutputMultiplexor</code> output thread and one
+ * or more <code>InputMultiplexor</code> input threads. When the last member leaves the socket
+ * group, a <code>MultiplexingManager</code> is responsible for negotiating with its remote peer
+ * for permission to shut down, and for tearing down the multiplexing infrastructure when
+ * the negotiations succeed.
+ * <p>
+ * <code>MultiplexingManager</code> also provides the mechanism by which a virtual socket joins
+ * a virtual socket group, identifying the new socket to the <code>InputMultiplexor</code> input
+ * thread.
+ *
* <p>
* Copyright (c) 2005
* <p>
@@ -345,7 +364,7 @@
/**
*
* @param socket
- * @param configuration TODO
+ * @param configuration
* @throws IOException
*/
protected MultiplexingManager(Socket socket, Map configuration) throws IOException
@@ -363,8 +382,8 @@
/**
*
* @param address
- * @param timeout TODO
- * @param configuration TODO
+ * @param timeout
+ * @param configuration
* @throws IOException
*/
protected MultiplexingManager(InetSocketAddress address, int timeout, Map configuration)
@@ -502,7 +521,7 @@
/**
*
* @param socket
- * @param configuration TODO
+ * @param configuration
* @return
* @throws IOException
*
@@ -1021,7 +1040,6 @@
/**
- * FIXME Comment this
*
*/
protected synchronized static void shutdownThreads()
@@ -1070,8 +1088,7 @@
/**
- * FIXME Comment this
- *
+ * Adds a <code>PendingAction</code> to the list of actions waiting to be executed.
* @param pendingAction
*/
protected static void addToPendingActions(PendingAction pendingAction)
@@ -1085,7 +1102,7 @@
/**
- *
+ * Binds the wrapped socket.
* @param address
* @throws IOException
*/
@@ -1106,9 +1123,9 @@
}
/**
- *
+ * Connects the wrapped socket.
* @param address
- * @param timeout TODO
+ * @param timeout
* @throws IOException
*/
public synchronized void connect(InetSocketAddress address, int timeout) throws IOException
@@ -1134,8 +1151,8 @@
/**
- *
- * @return
+ * Identifies a <code>VirtualServerSocket</code> as the one associated with this virtual socket group.
+ * @return a <code>MultiplexingInputStream</code> for use by serverSocket.
*/
public synchronized MultiplexingInputStream registerServerSocket(ServerSocket serverSocket) throws IOException
{
@@ -1154,7 +1171,7 @@
/**
- *
+ * Indicates a <code>VirtualServerSocket</code> is leaving this virtual socket group.
* @param serverSocket
* @throws IOException
*/
@@ -1174,9 +1191,9 @@
/**
- *
+ * Adds a <code>VirtualSocket</code> to this virtual socket group.
* @param socket
- * @return
+ * @return a <code>MultiplexingInputStream</code> for use by socket
* @throws IOException
*/
public synchronized MultiplexingInputStream registerSocket(VirtualSocket socket) throws IOException
@@ -1199,7 +1216,7 @@
/**
- *
+ * Indicates that a <code>VirtualSocket</code> is leaving a virtual socket group.
* @param socket
* @throws IOException
*/
@@ -1235,9 +1252,11 @@
/**
- * FIXME Comment this
- *
- *
+ * Indicates that a <code>VirtualServerSocket</code> belongs the virtual socket group at the
+ * remote end of the connection. This virtual socket groupD becomes "joinable", in the
+ * sense that a new <code>VirtualSocket</code> <it>v</it> can join this virtual group because there is a
+ * <code>VirtualServerSocket</code> at the other end of the connection to create a remote peer for
+ * <code>v</code>.
*/
public synchronized void registerRemoteServerSocket() throws IOException
{
@@ -1267,9 +1286,9 @@
/**
- * FIXME Comment this
- *
- *
+ * Indicates there will no longer be a <code>VirtualServeSocket</code> at the remote end of
+ * this connection. This virtual socket group will no longer be "joinable".
+ * (See registerRemoteServerSocket().)
*/
public synchronized void unRegisterRemoteServerSocket()
{
@@ -1348,8 +1367,7 @@
}
/**
- * FIXME Comment this
- *
+ * Increment reference counter for this <code>MultiplexingManager</code>.
* @throws IOException
*/
public void incrementReferences() throws IOException
@@ -1359,8 +1377,7 @@
/**
- * FIXME Comment this
- *
+ * Decrement reference counter for this <code>MultiplexingManager</code>.
* @throws IOException
*/
public void decrementReferences() throws IOException
@@ -1380,7 +1397,7 @@
/**
- * Returns OutputStream to use when corrupted InputStream gives no known "mailbox"
+ * Returns<code> OutputStream</code> to use when corrupted InputStream gives no known "mailbox"
* @return OutputStream to use when corrupted InputStream gives no known "mailbox"
*/
public OutputStream getDeadLetterOutputStream()
@@ -1390,7 +1407,7 @@
/**
- * Returns InputStream of real socket
+ * Returns <code>InputStream</code> of real socket
* @return InputStream of real socket
*/
public InputStream getInputStream()
@@ -1400,7 +1417,7 @@
/**
- * Returns OutputStream of real socket
+ * Returns <code>OutputStream</code> of real socket
* @return OutputStream of real socket
*/
public OutputStream getOutputStream()
@@ -1409,9 +1426,9 @@
}
/**
- *
+ * Get an <code>InputStream</code> for a <code>VirtualSocket</code>.
* @param socketId
- * @param socket TODO
+ * @param socket
* @return
* @throws IOException
*/
@@ -1442,7 +1459,11 @@
return mis;
}
-
+/**
+ * Get an <code>OutputStrem</code> for a <code>VirtualSocket</code>.
+ * @param socketId
+ * @return
+ */
public GrowablePipedOutputStream getAnOutputStream(SocketId socketId)
{
if (debug) log.debug("getAnOutputStream(): " + socketId.getPort());
@@ -1459,8 +1480,6 @@
/**
- * FIXME Comment this
- *
* @param socketId
* @return
*/
@@ -1475,9 +1494,10 @@
/**
- * Returns a GrowablePipedOutputStream that is connected to a MultiplexingInputStream.
- * It will create the MultiplexingInputStream if necessary. This method exists to
- * allow InputMultiplexor to get a place to put bytes directed to an unrecognized
+ * Returns a <code>GrowablePipedOutputStream</code> that is connected to a
+ * <code>MultiplexingInputStream</code>.
+ * It will create the <code>MultiplexingInputStream</code> if necessary. This method exists to
+ * allow <code>InputMultiplexor</code> to get a place to put bytes directed to an unrecognized
* SocketId, which might be necessary if the remote socket starts writing before this
* end of the connection is ready. Originally, we had a three step handshake, in which
* (1) the client socket sent a "connect" message, (2) the server socket sent a "connected"
@@ -1568,8 +1588,6 @@
/**
- * FIXME Comment this
- *
* @return
*/
public synchronized ServerSocket getServerSocket()
@@ -1609,7 +1627,7 @@
/**
- * To implement HandshakeCompletedListener interface.
+ * To implement <code>HandshakeCompletedListener</code> interface.
*/
public void handshakeCompleted(HandshakeCompletedEvent event)
{
@@ -1624,8 +1642,6 @@
/**
- * FIXME Comment this
- *
* @return
*/
public boolean isBound()
@@ -1635,8 +1651,6 @@
/**
- * FIXME Comment this
- *
* @return
*/
public boolean isConnected()
@@ -1646,8 +1660,6 @@
/**
- * FIXME Comment this
- *
* @return
*/
public synchronized boolean isServerSocketRegistered()
@@ -1678,8 +1690,6 @@
/**
- * FIXME Comment this
- *
* @return
*/
public boolean respondToShutdownRequest()
@@ -1743,8 +1753,6 @@
/**
- * FIXME Comment this
- *
* @param period
*/
public void setShutdownMonitorPeriod(int period)
@@ -1754,7 +1762,7 @@
/**
- * Needed to implement OutputMultiplexor.OutputMultiplexorClient
+ * Needed to implement <code>OutputMultiplexor.OutputMultiplexorClient</code>
*/
public synchronized void outputFlushed()
{
@@ -1848,9 +1856,9 @@
return socket;
}
+
+
/**
- * FIXME Comment this
- *
* @param address
*/
protected void registerByLocalAddress(InetSocketAddress address)
@@ -1884,8 +1892,6 @@
/**
- * FIXME Comment this
- *
*
*/
protected void unregisterByLocalAddress()
@@ -1948,8 +1954,6 @@
/**
- * FIXME Comment this
- *
*
*/
protected void unregisterByRemoteAddress()
@@ -1996,8 +2000,6 @@
/**
- * FIXME Comment this
- *
*
*/
protected void unregisterShareable()
@@ -2022,8 +2024,6 @@
/**
- * FIXME Comment this
- *
* @param socketId
*/
protected void removeAnInputStream(SocketId socketId)
@@ -2133,7 +2133,6 @@
/**
*
- *
*/
protected synchronized void shutdown()
{
@@ -2432,7 +2431,6 @@
}
/**
- * FIXME Comment this
*
* @throws IOException
*/
@@ -2480,8 +2478,6 @@
/**
- * FIXME Comment this
- *
*
*/
public synchronized void unreserveManager()
@@ -2558,8 +2554,6 @@
/**
- * FIXME Comment this
- *
*
*/
public synchronized void decrementReferences()
@@ -2640,8 +2634,6 @@
/**
- * FIXME Comment this
- *
* @return
*/
protected synchronized boolean respondToShutdownRequest()
@@ -2663,8 +2655,6 @@
/**
- * FIXME Comment this
- *
* @return
*/
protected boolean isShutdown()
1.48 +64 -67 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/VirtualSocket.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: VirtualSocket.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/VirtualSocket.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- VirtualSocket.java 19 May 2006 17:45:37 -0000 1.47
+++ VirtualSocket.java 19 Jul 2006 23:22:28 -0000 1.48
@@ -49,6 +49,13 @@
import org.jboss.logging.Logger;
/**
+ * <code>VirtualSocket</code> represents an endpoint on a virtual connection created by the
+ * Multiplex system. It extends <code>java.net.Socket</code> and reimplements nearly all of
+ * the methods in <code>java.net.Socket</code>. For information about method behavior, please
+ * see the <code>java.net.Socket</code> javadoc. For more information about the nature of
+ * virtual sockets, please see the Multiplex documentation at the labs.jboss.org
+ * web site.
+ *
* <p>
* Copyright (c) 2005
* <p>
@@ -84,6 +91,11 @@
private boolean info;
+ /**
+ * A class that implements <code>DisconnectListener</code> can register to
+ * be notified if the remote peer of this <code>VirtualSocket</code> has
+ * disconnected.
+ */
public interface DisconnectListener
{
void notifyDisconnected(VirtualSocket virtualSocket);
@@ -122,7 +134,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
/**
- *
+ * See superclass javadoc.
*/
public VirtualSocket()
{
@@ -131,7 +143,7 @@
/**
- *
+ * See superclass javadoc.
*/
public VirtualSocket(String host, int port) throws UnknownHostException, IOException
{
@@ -148,6 +160,7 @@
/**
+ * See superclass javadoc.
* @param host
* @param port
* @param stream
@@ -173,6 +186,7 @@
/**
+ * See superclass javadoc.
* @param address
* @param port
* @throws java.io.IOException
@@ -185,6 +199,7 @@
/**
+ * See superclass javadoc.
* @param host
* @param port
* @param stream
@@ -203,8 +218,10 @@
/**
+ * This constuctor is not implemented.
+ * <p>
* @param impl
- * @throws java.net.SocketException
+ * @throws java.net.SocketException in all cases
*/
public VirtualSocket(SocketImpl impl) throws SocketException
{
@@ -213,6 +230,7 @@
/**
+ * See superclass javadoc.
* @param host
* @param port
* @param localAddr
@@ -226,6 +244,7 @@
/**
+ * See superclass javadoc.
* @param address
* @param port
* @param localAddr
@@ -293,17 +312,7 @@
/**
- * Binds the socket to a local address.
- * <P>
- * If the address is <code>null</code>, then the system will pick up
- * an ephemeral port and a valid local address to bind the socket.
- *
- * TODO: security
- *
- * @param address the <code>SocketAddress</code> to bind to
- * @throws IOException if the bind operation fails, or if the socket is already bound.
- * @throws IllegalArgumentException if bindpoint is a
- * SocketAddress subclass not supported by this socket
+ * See superclass javadoc.
*/
public void bind(SocketAddress address) throws IOException
{
@@ -330,7 +339,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void close() throws IOException
{
@@ -366,12 +375,7 @@
/**
- * Connects this socket to the server.
- *
- * @param socketAddress the <code>SocketAddress</code>
- * @throws IOException if an error occurs during the connection
- * @throws IllegalArgumentException if endpoint is null or is a
- * SocketAddress subclass not supported by this socket
+ * See superclass javadoc.
*/
public void connect(SocketAddress socketAddress) throws IOException
{
@@ -380,16 +384,7 @@
/**
- * Connects this socket to the server with a specified timeout value.
- * A timeout of zero is interpreted as an infinite timeout. The connection
- * will then block until established or an error occurs.
- *
- * @param socketAddress the <code>SocketAddress</code>
- * @param timeout the timeout value to be used in milliseconds.
- * @throws IOException if an error occurs during the connection
- * @throws SocketTimeoutException if timeout expires before connecting
- * @throws IllegalArgumentException if endpoint is null or is a
- * SocketAddress subclass not supported by this socket
+ * See superclass javadoc.
*/
public void connect(SocketAddress socketAddress, int timeout) throws IOException
{
@@ -398,7 +393,7 @@
/**
- *
+ * See superclass javadoc.
*/
public SocketChannel getChannel()
{
@@ -406,8 +401,8 @@
}
- /**
- *
+/**
+ * See superclass javadoc.
*/
public InetAddress getInetAddress()
{
@@ -419,7 +414,7 @@
/**
- *
+ * See superclass javadoc.
*/
public InputStream getInputStream() throws IOException
{
@@ -437,7 +432,7 @@
/**
- *
+ * See superclass javadoc.
*/
public boolean getKeepAlive() throws SocketException
{
@@ -449,7 +444,8 @@
/**
- * Note. Socket.getLocalAddress() returns "wildcard" address for an unbound socket.
+ * See superclass javadoc.
+ * Note. <code>Socket.getLocalAddress()</code> returns "wildcard" address for an unbound socket.
*/
public InetAddress getLocalAddress()
{
@@ -479,7 +475,7 @@
/**
- *
+ * See superclass javadoc.
*/
public int getLocalPort()
{
@@ -491,7 +487,7 @@
/**
- *
+ * See superclass javadoc.
*/
public SocketAddress getLocalSocketAddress()
{
@@ -516,7 +512,7 @@
/**
- *
+ * See superclass javadoc.
*/
public boolean getOOBInline() throws SocketException
{
@@ -525,7 +521,7 @@
/**
- *
+ * See superclass javadoc.
*/
public OutputStream getOutputStream() throws IOException
{
@@ -545,7 +541,7 @@
/**
- *
+ * See superclass javadoc.
*/
public int getPort()
{
@@ -557,7 +553,7 @@
/**
- *
+ * See superclass javadoc.
*/
public int getReceiveBufferSize() throws SocketException
{
@@ -574,7 +570,7 @@
/**
- *
+ * See superclass javadoc.
*/
public SocketAddress getRemoteSocketAddress()
{
@@ -586,7 +582,7 @@
/**
- *
+ * See superclass javadoc.
*/
public boolean getReuseAddress() throws SocketException
{
@@ -598,7 +594,7 @@
/**
- *
+ * See superclass javadoc.
*/
public int getSendBufferSize() throws SocketException
{
@@ -615,7 +611,7 @@
/**
- *
+ * See superclass javadoc.
*/
public int getSoLinger() throws SocketException
{
@@ -627,7 +623,7 @@
/**
- *
+ * See superclass javadoc.
*/
public int getSoTimeout() throws SocketException
{
@@ -639,7 +635,7 @@
/**
- *
+ * See superclass javadoc.
*/
public boolean getTcpNoDelay() throws SocketException
{
@@ -651,7 +647,7 @@
/**
- *
+ * See superclass javadoc.
*/
public int getTrafficClass() throws SocketException
{
@@ -663,7 +659,7 @@
/**
- * @return Returns the bound.
+ * See superclass javadoc.
*/
public boolean isBound()
{
@@ -672,7 +668,7 @@
/**
- * Returns the closed state of the socket.
+ * See superclass javadoc.
*/
public boolean isClosed()
{
@@ -681,7 +677,7 @@
/**
- * Returns the connected state of the socket.
+ * See superclass javadoc.
*/
public boolean isConnected()
{
@@ -690,7 +686,7 @@
/**
- * Returns whether the read-half of the socket connection is closed.
+ * See superclass javadoc.
*/
public boolean isInputShutdown()
{
@@ -699,7 +695,7 @@
/**
- * Returns whether the write-half of the socket connection is closed.
+ * See superclass javadoc.
*/
public boolean isOutputShutdown()
{
@@ -708,7 +704,9 @@
/**
- *
+ * This method is not implemented.
+ * <p>
+ * See superclass javadoc.
*/
public void sendUrgentData(int data) throws IOException
{
@@ -720,7 +718,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void setKeepAlive(boolean on) throws SocketException
{
@@ -742,7 +740,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void setReceiveBufferSize(int size) throws SocketException
{
@@ -752,7 +750,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void setReuseAddress(boolean on) throws SocketException
{
@@ -762,7 +760,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void setSendBufferSize(int size) throws SocketException
{
@@ -772,7 +770,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void setSoLinger(boolean on, int linger) throws SocketException
{
@@ -782,7 +780,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void setSoTimeout(int timeout) throws SocketException
{
@@ -800,7 +798,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void setTcpNoDelay(boolean on) throws SocketException
{
@@ -810,7 +808,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void setTrafficClass(int tc) throws SocketException
{
@@ -820,7 +818,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void shutdownInput() throws IOException
{
@@ -840,7 +838,7 @@
/**
-*
+* See superclass javadoc.
*/
public void shutdownOutput() throws IOException
{
@@ -1230,7 +1228,6 @@
/**
- * FIXME Comment this
*
* @throws IOException
*/
1.11 +45 -47 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/VirtualServerSocket.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: VirtualServerSocket.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/VirtualServerSocket.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- VirtualServerSocket.java 5 Jul 2006 17:01:48 -0000 1.10
+++ VirtualServerSocket.java 19 Jul 2006 23:22:28 -0000 1.11
@@ -48,6 +48,16 @@
/**
+ * <code>VirtualServerSocket</code> is one of the two implementations of a server socket in the
+ * Multiplex project. Each <code>VirtualServerSocket</code> belongs to an existing virtual
+ * socket group, and each <code>VirtualScoket</code> it creates is added to that virtual socket
+ * group. For more details, see the Multiplex documentation on
+ * the labs.jboss.org web site.
+ *
+ * <p>
+ * Most of the methods in <code>VirtualServerSocket</code> override those in its parent class,
+ * <code>java.net.ServerSocket</code>. For method descriptions, see the <code>ServerSocket</code>
+ * javadoc.
*
* <p>
* Copyright (c) 2005
@@ -86,7 +96,7 @@
/**
*
- * Create a new VirtualServerSocket.
+ * See superclass javadoc.
*
* @param port
* @throws IOException
@@ -99,6 +109,8 @@
/**
+ * See superclass javadoc.
+ *
* @param port
* @param backlog
* @throws java.io.IOException
@@ -111,6 +123,8 @@
}
/**
+ * See superclass javadoc.
+ *
* @param port
* @param backlog
* @param bindAddr
@@ -129,8 +143,8 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * @param configuration TODO
- *
+ * See superclass javadoc.
+ * @param configuration
*/
public VirtualServerSocket(VirtualSocket socket, Map configuration) throws IOException
{
@@ -146,9 +160,10 @@
/**
*
- * Create a new VirtualServerSocket.
- * @param timeout TODO
- * @param configuration TODO
+ * See superclass javadoc.
+ *
+ * @param timeout
+ * @param configuration
* @param port
* @throws IOException
*/
@@ -188,7 +203,7 @@
*/
/**
- *
+ * See superclass javadoc.
*/
public synchronized Socket accept() throws IOException
{
@@ -269,7 +284,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void bind(SocketAddress socketAddress) throws IOException
{
@@ -278,7 +293,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void bind(SocketAddress socketAddress, int backlog) throws IOException
{
@@ -347,7 +362,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void close() throws IOException
{
@@ -391,7 +406,7 @@
/**
- *
+ * See superclass javadoc.
*/
public InetAddress getInetAddress()
{
@@ -403,7 +418,7 @@
/**
- *
+ * See superclass javadoc.
*/
public int getLocalPort()
{
@@ -415,7 +430,7 @@
/**
- *
+ * See superclass javadoc.
*/
public ServerSocketChannel getChannel()
{
@@ -424,7 +439,7 @@
/**
- *
+ * See superclass javadoc.
*/
public SocketAddress getLocalSocketAddress()
{
@@ -436,7 +451,7 @@
/**
- *
+ * See superclass javadoc.
*/
public int getReceiveBufferSize() throws SocketException
{
@@ -453,7 +468,7 @@
/**
- *
+ * See superclass javadoc.
*/
public boolean getReuseAddress() throws SocketException
{
@@ -465,7 +480,7 @@
/**
- *
+ * See superclass javadoc.
*/
public int getSoTimeout() throws SocketException
{
@@ -477,7 +492,7 @@
/**
- *
+ * See superclass javadoc.
*/
public boolean isBound()
{
@@ -486,7 +501,7 @@
/**
- *
+ * See superclass javadoc.
*/
public boolean isClosed()
{
@@ -495,7 +510,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void setReceiveBufferSize (int size) throws SocketException
{
@@ -505,7 +520,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void setReuseAddress(boolean on) throws SocketException
{
@@ -515,7 +530,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void setSoTimeout(int timeout) throws SocketException
{
@@ -536,7 +551,7 @@
/**
- *
+ * See superclass javadoc.
*/
public String toString()
{
@@ -560,12 +575,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * Connects this socket to the server.
- *
- * @param socketAddress the <code>SocketAddress</code>
- * @throws IOException if an error occurs during the connection
- * @throws IllegalArgumentException if endpoint is null or is a
- * SocketAddress subclass not supported by this socket
+ * See superclass javadoc.
*/
public void connect(SocketAddress remoteAddress) throws IOException
{
@@ -576,10 +586,7 @@
/**
* Connects this socket to the server.
*
- * @param socketAddress the <code>SocketAddress</code>
- * @throws IOException if an error occurs during the connection
- * @throws IllegalArgumentException if endpoint is null or is a
- * SocketAddress subclass not supported by this socket
+ * See superclass javadoc.
*/
public void connect(SocketAddress remoteAddress, SocketAddress localAddress) throws IOException
{
@@ -588,16 +595,7 @@
/**
- * Connects this socket to the server with a specified timeout value.
- * A timeout of zero is interpreted as an infinite timeout. The connection
- * will then block until established or an error occurs.
- * @param remoteAddress the <code>SocketAddress</code>
- * @param localAddress TODO
- * @param timeout the timeout value to be used in milliseconds.
- * @throws IOException if an error occurs during the connection
- * @throws SocketTimeoutException if timeout expires before connecting
- * @throws IllegalArgumentException if endpoint is null or is a
- * SocketAddress subclass not supported by this socket
+ * See superclass javadoc.
*/
public void connect(SocketAddress remoteAddress, SocketAddress localAddress, int timeout) throws IOException
{
@@ -738,7 +736,7 @@
/**
- * Returns the connected state of the socket.
+ * See superclass javadoc.
*/
public boolean isConnected()
{
@@ -747,7 +745,7 @@
/**
- * @return
+ * See superclass javadoc.
*/
public InetAddress getRemoteAddress()
{
@@ -759,7 +757,7 @@
/**
- * @return
+ * See superclass javadoc.
*/
public int getRemotePort()
{
@@ -771,7 +769,7 @@
/**
- * @param socketFactory
+ * See superclass javadoc.
*/
public void setConfiguration(Map configuration)
{
1.6 +18 -1 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/Multiplex.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Multiplex.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/Multiplex.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- Multiplex.java 6 Jul 2006 06:10:24 -0000 1.5
+++ Multiplex.java 19 Jul 2006 23:22:28 -0000 1.6
@@ -28,7 +28,15 @@
/**
- *
+ * <code>Multiplex</code> is the repository for the names and default values for all of the
+ * configurable parameters in the Multiplex system. The names are meant to
+ * be used as keys in a configuration <code>Map</code>.
+ * The <code>Multiplex</code> class also contains
+ * some keys used internally by the Multiplex classes.
+ * <p>
+ * For a discussion of the meaning of these parameters, please see the Multiplex
+ * documentation on the labs.jboss.org web site.
+ * <p>
* @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
* @version $Revision$
* <p>
@@ -119,6 +127,15 @@
/////////////////////////////////////////////////////////////////////////////////////
//////////////// Utility methods /////////////////
/////////////////////////////////////////////////////////////////////////////////////
+ /**
+ * Extracts a parameter value from a configuration <code>Map</code>.
+ * @param configuration configuration <code>Map</code>
+ * @param name display form of parameter name
+ * @param key key in configuration <code>Map</code>
+ * @param defaultValue value to use of key is not among configuration keys
+ * @return value in configuration association with key, or defautValue if key is not among
+ * configuration keys
+ */
public static int getOneParameter(Map configuration, String name, String key, int defaultValue)
{
if (configuration.containsKey(key))
1.3 +4 -3 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexInvokerConstants.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MultiplexInvokerConstants.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexInvokerConstants.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- MultiplexInvokerConstants.java 19 May 2006 16:30:57 -0000 1.2
+++ MultiplexInvokerConstants.java 19 Jul 2006 23:22:28 -0000 1.3
@@ -27,10 +27,11 @@
/**
- * A MultiplexInvokerConstants.
-
+ * Holds some constants for Multiplex system. Now superceded by the <code>Multiplex</code>
+ * class and deprecated. Will be eliminated in future.
+ *
* @author <a href="mailto:r.sigal at computer.org">Ron Sigal</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* <p>
* Copyright (c) 2005
* </p>
1.38 +14 -12 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexClientInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MultiplexClientInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexClientInvoker.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- MultiplexClientInvoker.java 20 Jun 2006 16:04:00 -0000 1.37
+++ MultiplexClientInvoker.java 19 Jul 2006 23:22:28 -0000 1.38
@@ -41,9 +41,11 @@
import java.util.Map;
/**
- * See javadoc for <code>MultiplexServerInvoker</code>.
+ * <code>MultiplexClientInvoker</code> is the client side of the Multiplex transport.
+ * For more information, see Remoting documentation on labs.jboss.org.
*
* @author <a href="mailto:tom.elrod at jboss.com">Tom Elrod</a>
+ * @author <a href="mailto:ron.sigal at jboss.com">Ron Sigal</a>
*/
public class MultiplexClientInvoker extends SocketClientInvoker implements BidirectionalClientInvoker
{
@@ -58,9 +60,10 @@
private boolean readyToRun;
protected String clientSocketClassName = ClientSocketWrapper.class.getName();
- /**
- *
- * Create a new MultiplexClientInvoker.
+
+
+/**
+ * Create a new <code>MultiplexClientInvoker</code>.
*
* @param locator
*/
@@ -71,8 +74,7 @@
/**
- *
- * Create a new MultiplexClientInvoker.
+ * Create a new <code>MultiplexClientInvoker</code>.
*
* @param locator
*/
@@ -109,10 +111,12 @@
throw new ConnectionFailedException(e.getMessage());
}
}
+
+
/**
- * FIXME Comment this
- *
- *
+ * Finishes the start up process, once adequate bind and connect information is
+ * made available. For more information, see the Multiplex subsystem documentation
+ * at labs.jboss.org.
*/
public void finishStart() throws IOException
{
@@ -152,9 +156,7 @@
return locator;
}
- /**
- * FIXME Comment this
- *
+/**
* @param parameters
* @throws IOException
*/
1.26 +66 -5 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/OutputMultiplexor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OutputMultiplexor.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/OutputMultiplexor.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- OutputMultiplexor.java 23 May 2006 05:54:55 -0000 1.25
+++ OutputMultiplexor.java 19 Jul 2006 23:22:28 -0000 1.26
@@ -49,6 +49,40 @@
import org.jboss.remoting.transport.multiplex.utility.StoppableThread;
/**
+ * <code>OutputMultiplexor</code> is one of the key Multiplex classes, responsible for
+ * multiplexing multiple byte streams that share a single TCP connection. It has an
+ * inner class that performs this function.
+ * <p>
+ * The data stream created here consists of a sequence of packets, each consisting of
+ * a header, with the format:
+ * <p>
+ * <table>
+ * <tr>
+ * <td><code>byte</code>: <td>version (current version is 0)
+ * </tr>
+ * <tr>
+ * <td><code>int</code>: <td>destination virtual socket id
+ * </tr>
+ * <tr>
+ * <td><code>short</code>: <td>number of data bytes to follow
+ * </tr>
+ * </table>
+ * <p>
+ * followed by the number of data bytes specified in the header.
+ * <p>
+ * <code>OutputMultiplexor</code> has two fairness constraints that prevent one virtual stream from
+ * starving the others.
+ * <p>
+ * <ol>
+ * <li><code>maxTimeSlice</code> determines the maximum time devoted to writing bytes for a
+ * given virtual connection before going on to process another virtual connection, and
+ * <li><code>maxDataSlice</code> determines the maximum number of bytes written for a given
+ * virtual connection before going on to process another virtual connection.
+ * </ol>
+ *
+ * <p>
+ * For additional information about configuring <code>OutputMultiplexor</code>, please see the
+ * documentation at labs.jbos.org.
* <p>
* Copyright (c) 2005
* <p>
@@ -83,7 +117,7 @@
/**
- * @param configuration TODO
+ * @param configuration
* @throws IOException
*/
protected OutputMultiplexor(Map configuration) throws IOException
@@ -134,6 +168,10 @@
}
+ /**
+ * A class implementing this interface can register to be notified when all of its
+ * bytes have been processed.
+ */
public interface OutputMultiplexorClient
{
void outputFlushed();
@@ -220,6 +258,8 @@
/**
+ * Allows a <code>OutputMultiplexorClient</code> to register to be notified when all
+ * of its bytes have been processed.
*
* @param client
*/
@@ -235,10 +275,9 @@
/**
- * Allows a OutputMultiplexorClient to register to be notified when all of its bytes have been
- * processed.
+ * Unregisters an <code>OutputMultiplexorClient</code>.
*
- * @param manager
+ * @param client
*/
public void unregister(OutputMultiplexorClient client)
{
@@ -617,7 +656,29 @@
/**
- *
+ * A <code>Message</code> holds the destination and content of a byte array destined for
+ * the endpoint of a virtual connection.
+ * <p>
+ * It also has a variable <code>brackets</code> which can be used to indicate that this
+ * <code>Message</code> should be sent after other <code>Message</code>s to a given
+ * destination. There are three cases:
+ * <p>
+ * <table>
+ * <tr><td><b>value<td><b>meaning</tr>
+ * <tr>
+ * <td><code>BRACKETS_ALL</code>
+ * <td>all other <code>Message</code>s should preceed this one
+ * </tr>
+ * <tr>
+ * <td><code>BRACKETS_NONE</code>
+ * <td>there are no constraints on this <code>Message</code>
+ * </tr>
+ * <tr>
+ * <td>any other integer <code>x</code>
+ * <td>all other <code>Message</code>s to destination <code>x</code> should
+ * preceed this <code>Message</code>
+ * </tr>
+ * </table>
*/
private static class Message
{
1.9 +31 -19 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MasterServerSocket.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MasterServerSocket.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MasterServerSocket.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- MasterServerSocket.java 5 Jul 2006 17:01:48 -0000 1.8
+++ MasterServerSocket.java 19 Jul 2006 23:22:28 -0000 1.9
@@ -44,6 +44,14 @@
/**
+ * <code>MasterServerSocket</code> is one of the two implementations of a server socket in the
+ * Multiplex project. For each socket created in the <code>accept()</code> method, it builds
+ * a virtual socket group. For more details, see the Multiplex documentation on
+ * the labs.jboss.org web site.
+ *
+ * <p>
+ * Most of the methods in <code>MasterServerSocket</code> override those in its parent class,
+ * <code>java.net.ServerSocket</code>. For method descriptions, see the <code>ServerSocket</code> javadoc.
*
* <p>
* Copyright (c) 2005
@@ -172,8 +180,9 @@
/**
*
- * Create a new MasterServerSocket. If Map conf contains key Multiplex.SERVER_SOCKET_FACTORY, will use it.
- * Otherwise, will create an NIO ServerSocket.
+ * Create a new <code>MasterServerSocket</code>.
+ * If <code>Map</code> conf contains key <code>Multiplex.SERVER_SOCKET_FACTORY</code>, will use it.
+ * Otherwise, will create an NIO <code>ServerSocket</code>.
*
* @param port
* @param backlog
@@ -281,7 +290,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public Socket accept() throws IOException
{
@@ -396,7 +405,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public void bind(SocketAddress endpoint) throws IOException
{
@@ -405,7 +414,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public void bind(SocketAddress endpoint, int backlog) throws IOException
{
@@ -414,7 +423,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public void close() throws IOException
{
@@ -423,7 +432,7 @@
}
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public ServerSocketChannel getChannel()
{
@@ -432,7 +441,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public InetAddress getInetAddress()
{
@@ -441,7 +450,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public int getLocalPort()
{
@@ -450,7 +459,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public SocketAddress getLocalSocketAddress()
{
@@ -459,7 +468,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public int getReceiveBufferSize() throws SocketException
{
@@ -468,7 +477,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public boolean getReuseAddress() throws SocketException
{
@@ -477,7 +486,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public int getSoTimeout() throws IOException
{
@@ -486,7 +495,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public boolean isBound()
{
@@ -495,7 +504,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public boolean isClosed()
{
@@ -504,7 +513,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public void setReceiveBufferSize(int size) throws SocketException
{
@@ -513,7 +522,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public void setReuseAddress(boolean on) throws SocketException
{
@@ -522,7 +531,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public void setSoTimeout(int timeout) throws SocketException
{
@@ -531,7 +540,7 @@
/**
- *
+ * See <code>java.net.ServerSocket</code> javadoc.
*/
public String toString()
{
@@ -546,6 +555,9 @@
// / The following methods are specific to MasterServerSocket '///
//////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Accepts a connection from a remote <code>VirtualServerSocket</code>.
+ */
public int acceptServerSocketConnection() throws IOException
{
long start = System.currentTimeMillis();
1.5 +6 -3 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/PendingAction.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PendingAction.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/PendingAction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- PendingAction.java 3 Jan 2006 00:32:52 -0000 1.4
+++ PendingAction.java 19 Jul 2006 23:22:28 -0000 1.5
@@ -28,10 +28,13 @@
/**
- * A PendingAction.
-
+ * Each <code>PendingAction</code> holds information about an action that will be performed
+ * on the <code>MultiplexingManager.PendingActionThread</code>. These are time consuming
+ * activities that should not be executed on the "main" thread.
+ * For more information, see <code>MultiplexingManager</code>.
+ * <p>
* @author <a href="mailto:r.sigal at computer.org">Ron Sigal</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* <p>
* Copyright (c) 2005
* </p>
1.24 +22 -8 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/InputMultiplexor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InputMultiplexor.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/InputMultiplexor.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- InputMultiplexor.java 25 Jun 2006 17:43:07 -0000 1.23
+++ InputMultiplexor.java 19 Jul 2006 23:22:28 -0000 1.24
@@ -45,6 +45,20 @@
import org.jboss.remoting.transport.multiplex.utility.StoppableThread;
/**
+ * <code>InputMultiplexor</code> is one of the key Multiplex classes, responsible for
+ * demultiplexing multiple byte streams sharing a single TCP connection. It has two
+ * inner classes which can perform this function. <code>MultiGroupInputThread</code> can perform
+ * demultiplexing for any number of NIO sockets, taking advantage of the <code>Selector</code>
+ * facility. For non-NIO sockets, notably SSL sockets, <code>SingleGroupInputThread</code>
+ * handles demultiplexing for a single socket.
+ * <p>
+ * The data stream, created at the other end of the TCP connection by the
+ * <code>OutputMultiplexor</code> class, consists of a sequence of packets, each consisting of
+ * a header, giving version, destination virtual socket, and number of bytes. followed
+ * by the specified number of data bytes. (See <code>OutputMultiplexor</code> for the
+ * header format.
+ * Each of the demultiplexing thread classes reads a header and transfers the
+ * following bytes to the input stream of the target virtual socket.
*
* <p>
* Copyright (c) 2005
@@ -77,9 +91,9 @@
/**
- * Returns a MultiGroupInputThread designed to handle multiple virtual socket groups.
- * @param configuration TODO
- * @return a MultiGroupInputThread designed to handle multiple virtual socket groups
+ * Returns a <code>MultiGroupInputThread</code> designed to handle multiple virtual socket groups.
+ * @param configuration
+ * @return a <code>MultiGroupInputThread</code> designed to handle multiple virtual socket groups
*/
public MultiGroupInputThread getaMultiGroupInputThread() throws IOException
{
@@ -88,8 +102,8 @@
/**
- * Returns a SingleGroupInputThread designed to handle a single virtual socket group.
- * @return a SingleGroupInputThread designed to handle a single virtual socket group
+ * Returns a <code>SingleGroupInputThread</code> designed to handle a single virtual socket group.
+ * @return a <code>SingleGroupInputThread</code> designed to handle a single virtual socket group
*/
public SingleGroupInputThread getaSingleGroupInputThread(MultiplexingManager manager, Socket socket, OutputStream os) throws IOException
{
@@ -130,9 +144,9 @@
/**
* Registers manager and socket with NIO Selector
- * @param manager MultiplexingManager
- * @return TODO
- * @throws IOException
+ * @param manager <code>MultiplexingManager</code>
+ * @return
+ * @throws <code>IOException</code>
*/
public void registerSocketGroup(MultiplexingManager manager) throws IOException
{
1.20 +13 -16 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexingOutputStream.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MultiplexingOutputStream.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/MultiplexingOutputStream.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- MultiplexingOutputStream.java 14 May 2006 04:03:54 -0000 1.19
+++ MultiplexingOutputStream.java 19 Jul 2006 23:22:28 -0000 1.20
@@ -33,6 +33,11 @@
import org.jboss.logging.Logger;
/**
+ * <code>MultiplexingOutputStream</code> is the class returned by
+ * <code>VirtualSocket.getOutputStream()</code>.
+ * It supports the methods and behavior implemented by the <code>OutputStream</code> returned by
+ * <code>java.net.Socket.getOutputStream()</code>. For more information about the behavior
+ * of the methods, see the javadoc for <code>java.io.OutputStream</code>.
* <p>
* Copyright (c) 2005
* <p>
@@ -71,7 +76,7 @@
/**
*
* @param manager
- * @param virtualSocket TODO
+ * @param virtualSocket
* @param socketId
*/
public MultiplexingOutputStream(MultiplexingManager manager, VirtualSocket virtualSocket, SocketId socketId)
@@ -96,7 +101,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void close() throws IOException
{
@@ -113,7 +118,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void flush() throws IOException
{
@@ -122,7 +127,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void write(int i) throws IOException
{
@@ -132,7 +137,7 @@
}
/**
- *
+ * See superclass javadoc.
*/
public void write(byte[] array) throws IOException, NullPointerException
{
@@ -142,7 +147,7 @@
/**
- *
+ * See superclass javadoc.
*/
public void write(byte[] array, int off, int len)
throws IOException, NullPointerException, IndexOutOfBoundsException
@@ -175,8 +180,8 @@
/**
- * FIXME Comment this
- *
+ * <code>writeInt()</code> is borrowed from <code>DataOutputStream</code>.
+ * It saves the extra expense of creating a <code>DataOutputStream</code>.
* @param i
* @throws IOException
*/
@@ -247,8 +252,6 @@
/**
- * FIXME Comment this
- *
*
*/
protected void handleRemoteDisconnect()
@@ -269,8 +272,6 @@
/**
- * FIXME Comment this
- *
*
*/
protected void shutdown()
@@ -280,8 +281,6 @@
/**
- * FIXME Comment this
- *
* @param i
* @param brackets
* @throws IOException
@@ -295,8 +294,6 @@
/**
- * FIXME Comment this
- *
* @param i
* @param brackets
* @throws IOException
1.34 +14 -19 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/Protocol.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Protocol.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/Protocol.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- Protocol.java 19 May 2006 17:42:49 -0000 1.33
+++ Protocol.java 19 Jul 2006 23:22:28 -0000 1.34
@@ -39,7 +39,12 @@
import org.jboss.remoting.transport.multiplex.utility.VirtualSelector;
/**
- *
+ * <code>Protocol</code> is responsible for handling internal Multiplex messages.
+ * Some of these, for example, the messages involved in creating a
+ * new connection (<code>acceptConnect()</code>, <code>connect()</code>,
+ * <code>answerConnect()</code>) are synchronous.
+ * Others, such as a request to shut down, are received asynchronously by
+ * <code>Protocol.BackChannelThread</code>.
* <p>
* Copyright (c) 2005
* <p>
@@ -75,9 +80,10 @@
private boolean trace;
private boolean debug;
private boolean info;
-/**
- * FIXME Comment this
- * @param virtualSelector TODO
+
+
+ /**
+ * @param virtualSelector
* @return
*/
public static BackChannelThread getBackChannelThread(VirtualSelector virtualSelector)
@@ -103,8 +109,7 @@
/**
- * FIXME Comment this
- * @param is TODO
+ * @param is
* @param socketId
* @return
* @throws IOException
@@ -116,8 +121,7 @@
/**
- * FIXME Comment this
- * @param is TODO
+ * @param is
* @param socketId
*
* @return
@@ -187,9 +191,8 @@
/**
- * FIXME Comment this
* @param is
- * @param timeout TODO
+ * @param timeout
*
* @return
* @throws IOException
@@ -241,8 +244,7 @@
/**
- * FIXME Comment this
- * @param os TODO
+ * @param os
* @param port
*
* @throws IOException
@@ -257,7 +259,6 @@
/**
- * FIXME Comment this
*
* @param socketId
*/
@@ -283,7 +284,6 @@
/**
- * FIXME Comment this
*
* @param socketId
*/
@@ -309,10 +309,7 @@
/**
- * FIXME Comment this
* @param timeout
- *
- *
*/
public void registerRemoteServerSocket(int timeout) throws IOException
{
@@ -338,8 +335,6 @@
/**
- * FIXME Comment this
- *
*
*/
public void unregisterRemoteServerSocket()
1.7 +12 -12 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/VirtualSocketFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: VirtualSocketFactory.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/VirtualSocketFactory.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- VirtualSocketFactory.java 5 Jul 2006 17:01:48 -0000 1.6
+++ VirtualSocketFactory.java 19 Jul 2006 23:22:28 -0000 1.7
@@ -34,21 +34,21 @@
import java.net.UnknownHostException;
/**
+ * <code>VirtualSocketFactory</code> extends the
+ * <code>javax.net.SocketFactory</code> class and reimplements
+ * its <code>createSocket()</code> methods, returning <code>VirtualSocket</code>s.
*
* <p>
* Copyright (c) 2005
* <p>
* @author <a href="mailto:r.sigal at computer.org">Ron Sigal</a>
- *
- * TODO: finish
- * TODO: write VirtualServerSocketFactory
*/
public class VirtualSocketFactory extends SocketFactory implements Serializable
{
private static final long serialVersionUID = 3422810508320563967L;
- /**
- *
+/**
+ * See superclass javadoc.
*/
public static SocketFactory getDefault()
{
@@ -57,7 +57,7 @@
/**
- *
+ * See superclass javadoc.
*/
protected VirtualSocketFactory()
{
@@ -65,7 +65,7 @@
/**
- *
+ * See superclass javadoc.
*/
public Socket createSocket()
{
@@ -74,7 +74,7 @@
/**
- *
+ * See superclass javadoc.
*/
public Socket createSocket(String host, int port) throws IOException, UnknownHostException
{
@@ -83,7 +83,7 @@
/**
- *
+ * See superclass javadoc.
*/
public Socket createSocket(String host, int port, InetAddress localAddress, int localPort)
throws IOException, UnknownHostException
@@ -93,7 +93,7 @@
/**
- *
+ * See superclass javadoc.
*/
public Socket createSocket(InetAddress address, int port) throws IOException
{
@@ -102,7 +102,7 @@
/**
- *
+ * See superclass javadoc.
*/
public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort)
throws IOException, UnknownHostException
1.24 +6 -0 JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/SocketId.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SocketId.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/SocketId.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- SocketId.java 5 Jul 2006 17:01:48 -0000 1.23
+++ SocketId.java 19 Jul 2006 23:22:28 -0000 1.24
@@ -34,6 +34,12 @@
import java.util.HashSet;
/**
+ * A <code>SocketId</code> wraps an integer that identifies an endpoint of a
+ * virtual connection. Each virtual
+ * socket group is created with a standard set of system endpoints used
+ * for protocol messages. These have standard negative integer values
+ * that are reused in each virtual socket group. Virtual sockets are
+ * created with a <code>SocketId</code> whose value is unique in its JVM.
* <p>
* Copyright (c) 2005
* <p>
More information about the jboss-cvs-commits
mailing list