org.jboss.remoting.transport.multiplex
Class OutputMultiplexor

java.lang.Object
  extended by org.jboss.remoting.transport.multiplex.OutputMultiplexor

public class OutputMultiplexor
extends java.lang.Object

OutputMultiplexor 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.

The data stream created here consists of a sequence of packets, each consisting of a header, with the format:

byte: version (current version is 0)
int: destination virtual socket id
short: number of data bytes to follow

followed by the number of data bytes specified in the header.

OutputMultiplexor has two fairness constraints that prevent one virtual stream from starving the others.

  1. maxTimeSlice determines the maximum time devoted to writing bytes for a given virtual connection before going on to process another virtual connection, and
  2. maxDataSlice determines the maximum number of bytes written for a given virtual connection before going on to process another virtual connection.

For additional information about configuring OutputMultiplexor, please see the documentation at labs.jbos.org.

Copyright (c) 2005

Author:
Ron Sigal

Nested Class Summary
static interface OutputMultiplexor.OutputMultiplexorClient
          A class implementing this interface can register to be notified when all of its bytes have been processed.
 
Field Summary
protected static int BRACKETS_ALL
           
protected static int BRACKETS_NONE
           
protected static int HEADER_SIZE
           
protected static org.jboss.logging.Logger log
           
 
Constructor Summary
protected OutputMultiplexor(java.util.Map configuration)
           
 
Method Summary
protected  org.jboss.remoting.transport.multiplex.OutputMultiplexor.Message getaMessage(SocketId socketId, byte[] content, int brackets)
           
 org.jboss.remoting.transport.multiplex.OutputMultiplexor.OutputThread getAnOutputThread()
           
 int getMaxChunkSize()
           
 int getMessagePoolSize()
           
 int getMessageSize()
           
 void register(OutputMultiplexor.OutputMultiplexorClient client)
          Allows a OutputMultiplexorClient to register to be notified when all of its bytes have been processed.
protected  void releaseMessage(org.jboss.remoting.transport.multiplex.OutputMultiplexor.Message m)
           
 void setMaxChunkSize(int maxChunkSize)
           
 void setMessagePoolSize(int messagePoolSize)
           
 void setMessageSize(int messageSize)
           
 void unregister(OutputMultiplexor.OutputMultiplexorClient client)
          Unregisters an OutputMultiplexorClient.
 void write(MultiplexingManager manager, SocketId socketId, byte[] content)
           
 void write(MultiplexingManager manager, SocketId socketId, byte[] content, int brackets)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.jboss.logging.Logger log

BRACKETS_ALL

protected static final int BRACKETS_ALL
See Also:
Constant Field Values

BRACKETS_NONE

protected static final int BRACKETS_NONE
See Also:
Constant Field Values

HEADER_SIZE

protected static final int HEADER_SIZE
See Also:
Constant Field Values
Constructor Detail

OutputMultiplexor

protected OutputMultiplexor(java.util.Map configuration)
                     throws java.io.IOException
Parameters:
configuration -
Throws:
java.io.IOException
Method Detail

getAnOutputThread

public org.jboss.remoting.transport.multiplex.OutputMultiplexor.OutputThread getAnOutputThread()
Returns:

write

public void write(MultiplexingManager manager,
                  SocketId socketId,
                  byte[] content)
           throws java.io.IOException
Parameters:
manager -
socketId -
content -
Throws:
java.io.IOException

write

public void write(MultiplexingManager manager,
                  SocketId socketId,
                  byte[] content,
                  int brackets)
           throws java.io.IOException
Parameters:
manager -
socketId -
content -
Throws:
java.lang.InterruptedException
java.io.IOException

register

public void register(OutputMultiplexor.OutputMultiplexorClient client)
Allows a OutputMultiplexorClient to register to be notified when all of its bytes have been processed.

Parameters:
client -

unregister

public void unregister(OutputMultiplexor.OutputMultiplexorClient client)
Unregisters an OutputMultiplexorClient.

Parameters:
client -

getaMessage

protected org.jboss.remoting.transport.multiplex.OutputMultiplexor.Message getaMessage(SocketId socketId,
                                                                                       byte[] content,
                                                                                       int brackets)
                                                                                throws java.io.IOException
Throws:
java.io.IOException

releaseMessage

protected void releaseMessage(org.jboss.remoting.transport.multiplex.OutputMultiplexor.Message m)

getMaxChunkSize

public int getMaxChunkSize()

setMaxChunkSize

public void setMaxChunkSize(int maxChunkSize)

getMessagePoolSize

public int getMessagePoolSize()

setMessagePoolSize

public void setMessagePoolSize(int messagePoolSize)

getMessageSize

public int getMessageSize()

setMessageSize

public void setMessageSize(int messageSize)


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.