Register a MuxableSocket, but do not begin IO. A SocketMuxer
implementation should use this opportunity to do any set up it
needs to do before a call to read() may be performed. This call
is generally called shortly after a new MuxableSocket is created.
Calling it with a MuxableSocket which is already registered is an
error. Overwritten by NativeSocketMuxer.
A CALL TO register() MUST BE FOLLOWED BY A SUBSEQUENT CALL TO
read() OR cleanup(). FAILURE TO DO SO WILL LEAD TO THE LEAKING
OF FILE HANDLES AND OTHER RESOURCES IN THE SERVER.
Attempts to read data for a MuxableSocket that has been
registered. Calls to read() with a closed socket should be
tolerated and silently fail.
The SocketMuxer may use the MuxableSocket getRawSocket() or
getSocketInputStream() methods to retrieve the Socket or
SocketInputStream underlying the MuxableSocket. Once a read is in
progress the SocketMuxer should monitor the MuxableSocket's
activity and time it out if it is not used with in the period
specified by calling getIdleTimeoutMillis() on the MuxableSocket.
If the MuxableSocket is determined to have timed out
timeout() should be called on the MuxableSocket.
Data which becomes available should be placed into the byte
returned from getBuffer() starting at the index returned by
getBufferOffest(). After the data is in the byte
incrementBufferOffset() should be called with the number of bytes
read. isMessageComplete() should then be called and if it
returns true dispatch() should be called.
dispatch() must be called by a ExecuteThread. When the call
dispatch() returns no further reading of data should be attempted
until read() is called again.
If isMessageComplete() returns false the SocketMuxer should begin
monitoring the MuxableSocket to ensure that a complete message is
read within the timeout returned by
getCompleteMessageTimeoutMillis(). If a complete message is not
read within the timeout the SocketMuxer should call
hasException() on the MuxableSocket with an IOException.
If at any time the SocketMuxer receives an error while reading
data for a MuxableSocket it should call hasException passing in
as specific an IOException as possible. This is true even if the
error recieved is a MaxMessageSizeExceededException thrown by
incrementBufferOffset(). If the socket is reset by its peer the
SocketMuxer should throw a SocketResetException().
The main method in the SocketMuxer where the reading occurs. If
the SocketMuxer requires ExecuteThreads from the main execute
queue it should enqueue a SocketReaderRequest for each desired
thread using Kernel.execute(). These SocketReaderRequests will
call this method which is not expected to return until the thread
is no longer needed.
The number of threads concurrently in processSockets() should not
exceed the value indicated by