com.sun.jini.jeri.internal.mux
Class MuxClient

java.lang.Object
  extended by com.sun.jini.jeri.internal.mux.Mux
      extended by com.sun.jini.jeri.internal.mux.MuxClient
Direct Known Subclasses:
ConnectionManager.OutboundMux

public class MuxClient
extends Mux

A MuxClient controls the client side of multiplexed connection.

Author:
Sun Microsystems, Inc.

Field Summary
private static int clientInitialInboundRation
          initial inbound ration as client, default is 32768
 
Fields inherited from class com.sun.jini.jeri.internal.mux.Mux
Abort, Abort_partial, Acknowledgment, busySessions, CLIENT, ClientConnectionHeader_negotiate, Close, Data, Data_ackRequired, Data_close, Data_eof, Data_open, Error, IncrementRation, IncrementRation_shift, initialInboundRation, initialOutboundRation, MAX_REQUESTS, MAX_SESSION_ID, maxFragmentSize, muxDown, muxDownCause, muxDownMessage, muxLock, NoOperation, Ping, PingAck, role, SERVER, serverConnectionReady, sessions, Shutdown
 
Constructor Summary
MuxClient(OutputStream out, InputStream in)
          Initiates the client side of the multiplexed connection over the given input/output stream pair.
MuxClient(SocketChannel channel)
           
 
Method Summary
 OutboundRequest newRequest()
          Starts a new request over this connection, returning the corresponding OutboundRequest object.
protected  void populateContext(Collection context)
          Populates the context collection with information representing this connection.
 int requestsInProgress()
          Returns the current number of requests in progress over this connection.
 void shutdown(String message)
          Shuts down this multiplexed connection.
 
Methods inherited from class com.sun.jini.jeri.internal.mux.Mux
addSession, asyncSendAbort, asyncSendAcknowledgment, asyncSendClientConnectionHeader, asyncSendClose, asyncSendData, asyncSendError, asyncSendIncrementRation, asyncSendNoOperation, asyncSendPing, asyncSendPingAck, asyncSendServerConnectionHeader, asyncSendShutdown, directBuffersUseful, futureSendData, futureSendError, handleDown, handleOpen, processIncomingData, removeSession, setDown, setStartTimeout, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clientInitialInboundRation

private static final int clientInitialInboundRation
initial inbound ration as client, default is 32768

Constructor Detail

MuxClient

public MuxClient(OutputStream out,
                 InputStream in)
          throws IOException
Initiates the client side of the multiplexed connection over the given input/output stream pair.

Parameters:
out - the output stream of the underlying connection
in - the input stream of the underlying connection
Throws:
IOException

MuxClient

public MuxClient(SocketChannel channel)
          throws IOException
Throws:
IOException
Method Detail

newRequest

public OutboundRequest newRequest()
                           throws IOException
Starts a new request over this connection, returning the corresponding OutboundRequest object.

Returns:
the OutboundRequest for the newly created request
Throws:
IOException

requestsInProgress

public int requestsInProgress()
                       throws IOException
Returns the current number of requests in progress over this connection. The value is guaranteed to not increase until the next invocation of the newRequest method.

Returns:
the number of requests in progress over this connection
Throws:
IOException - if the multiplexed connection is no longer active

shutdown

public void shutdown(String message)
Shuts down this multiplexed connection. Requests in progress will throw IOException for future I/O operations.

Parameters:
message - reason for shutdown to be included in IOExceptions thrown from future I/O operations

populateContext

protected void populateContext(Collection context)
Populates the context collection with information representing this connection. This method should be overridden by subclasses to implement the desired behavior of the populateContext method for OutboundRequest instances generated for this connection.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.