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

java.lang.Object
  extended by com.sun.jini.jeri.internal.mux.Session

final class Session
extends Object

A Session represents a single session of a multiplexed connection, for either client-side and server-side perspective. The particular role (CLIENT or SERVER) is indicated at construction time.

Author:
Sun Microsystems, Inc.

Nested Class Summary
private  class Session.MuxInputStream
          Output stream returned by OutboundRequests and InboundRequests for a session of a multiplexed connection.
private  class Session.MuxOutputStream
          Output stream returned by OutboundRequests and InboundRequests for a session of a multiplexed connection.
 
Field Summary
private  Collection ackListeners
           
(package private) static int CLIENT
           
private  boolean fakeOKtoWrite
           
private static int FINISHED
           
private static int IDLE
           
private  InputStream in
           
private  int inBufPos
           
private  LinkedList inBufQueue
           
private  int inBufRemaining
           
private  boolean inClosed
           
private  boolean inEOF
           
private  int inRation
           
private  boolean inRationInfinite
           
private  int inState
           
private static Logger logger
          mux logger
private  Mux mux
           
private static int OPEN
           
private  OutputStream out
           
private  int outRation
           
private  boolean outRationInfinite
           
private  int outState
           
private  boolean partialDeliveryStatus
           
private  boolean receivedAcknowledgment
           
private  boolean receivedAckRequired
           
private  boolean removeLater
           
private  int role
           
private  boolean sentAcknowledgment
           
private  boolean sentAckRequired
           
(package private) static int SERVER
           
private  boolean sessionDown
           
private  Throwable sessionDownCause
           
private  String sessionDownMessage
           
private  int sessionID
           
private  Object sessionLock
          lock guarding all mutable instance state (below)
private static String[] stateNames
           
private static Executor systemThreadPool
          pool of threads for executing tasks in system thread group: used for I/O (reader and writer) threads and other asynchronous tasks
private static int TERMINATED
           
 
Constructor Summary
Session(Mux mux, int sessionID, int role)
           
 
Method Summary
(package private)  void abort()
           
(package private)  InboundRequest getInboundRequest()
           
(package private)  OutboundRequest getOutboundRequest()
           
(package private)  void handleAbort(boolean partial)
           
(package private)  void handleAcknowledgment()
           
(package private)  void handleClose()
           
(package private)  void handleData(ByteBuffer data, boolean eof, boolean close, boolean ackRequired)
           
(package private)  void handleIncrementRation(int increment)
           
(package private)  void handleOpen()
           
private  void notifyAcknowledgmentListeners(boolean received)
           
(package private)  void setDown(String message, Throwable cause)
           
private  void setInState(int newState)
           
private  void setOutState(int newState)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLIENT

static final int CLIENT
See Also:
Constant Field Values

SERVER

static final int SERVER
See Also:
Constant Field Values

IDLE

private static final int IDLE
See Also:
Constant Field Values

OPEN

private static final int OPEN
See Also:
Constant Field Values

FINISHED

private static final int FINISHED
See Also:
Constant Field Values

TERMINATED

private static final int TERMINATED
See Also:
Constant Field Values

stateNames

private static final String[] stateNames

systemThreadPool

private static final Executor systemThreadPool
pool of threads for executing tasks in system thread group: used for I/O (reader and writer) threads and other asynchronous tasks


logger

private static final Logger logger
mux logger


mux

private final Mux mux

sessionID

private final int sessionID

role

private final int role

out

private final OutputStream out

in

private final InputStream in

sessionLock

private final Object sessionLock
lock guarding all mutable instance state (below)


sessionDown

private boolean sessionDown

sessionDownMessage

private String sessionDownMessage

sessionDownCause

private Throwable sessionDownCause

outState

private int outState

outRation

private int outRation

outRationInfinite

private final boolean outRationInfinite

partialDeliveryStatus

private boolean partialDeliveryStatus

inState

private int inState

inRation

private int inRation

inRationInfinite

private final boolean inRationInfinite

inBufRemaining

private int inBufRemaining

inBufQueue

private final LinkedList inBufQueue

inBufPos

private int inBufPos

inEOF

private boolean inEOF

inClosed

private boolean inClosed

fakeOKtoWrite

private boolean fakeOKtoWrite

removeLater

private boolean removeLater

receivedAckRequired

private boolean receivedAckRequired

sentAcknowledgment

private boolean sentAcknowledgment

ackListeners

private Collection ackListeners

sentAckRequired

private boolean sentAckRequired

receivedAcknowledgment

private boolean receivedAcknowledgment
Constructor Detail

Session

Session(Mux mux,
        int sessionID,
        int role)
Method Detail

getOutboundRequest

OutboundRequest getOutboundRequest()

getInboundRequest

InboundRequest getInboundRequest()

abort

void abort()

setDown

void setDown(String message,
             Throwable cause)

handleIncrementRation

void handleIncrementRation(int increment)
                     throws ProtocolException
Throws:
ProtocolException

handleAbort

void handleAbort(boolean partial)
           throws ProtocolException
Throws:
ProtocolException

handleClose

void handleClose()
           throws ProtocolException
Throws:
ProtocolException

handleAcknowledgment

void handleAcknowledgment()
                    throws ProtocolException
Throws:
ProtocolException

handleData

void handleData(ByteBuffer data,
                boolean eof,
                boolean close,
                boolean ackRequired)
          throws ProtocolException
Throws:
ProtocolException

handleOpen

void handleOpen()
          throws ProtocolException
Throws:
ProtocolException

setOutState

private void setOutState(int newState)

setInState

private void setInState(int newState)

notifyAcknowledgmentListeners

private void notifyAcknowledgmentListeners(boolean received)


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