disciple.connections
Class TcpConnection

java.lang.Object
  |
  +--disciple.core.Connection
        |
        +--disciple.connections.TcpConnection
All Implemented Interfaces:
java.lang.Runnable

public class TcpConnection
extends Connection
implements java.lang.Runnable

Implements a tcp based connection.

Needs more work on reestablishing the socket connection if broken.

Copyright (c) 2002 Rutgers, The State University of New Jersey

Since:
Disciple v3.0

Field Summary
protected  java.io.ObjectInputStream in_
           
protected  java.io.ObjectOutputStream out_
           
protected  java.lang.Thread readThread_
           
protected  disciple.connections.TcpConnection.WriteThread writeThread_
           
 
Fields inherited from class disciple.core.Connection
CONNECTED, CONNECTING, destination_, localId_, NOT_CONNECTED, state_
 
Constructor Summary
TcpConnection(int priorityLevels, java.net.Socket socket)
          Constructor creating a TcpConnection.
 
Method Summary
protected  void panic()
           
 void run()
          Receive loop for the connection.
 void send(Command cmd, int priority)
          Sends a command to the connections peer.
protected  void send(ControlMessage msg)
           
 void setLocalId(java.lang.Object localId)
           
 void setQoSParameters(org.w3c.dom.Node parameters)
          Sets the QoS parameters for this connection.
 
Methods inherited from class disciple.core.Connection
addCommandListener, addConnectionListener, fireCommand, fireConnectionChanged, getDestination, getLocalId, getPriorityLevels, getState, removeCommandListener, removeConnectionListener, setDestination, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

readThread_

protected java.lang.Thread readThread_

writeThread_

protected disciple.connections.TcpConnection.WriteThread writeThread_

in_

protected java.io.ObjectInputStream in_

out_

protected java.io.ObjectOutputStream out_
Constructor Detail

TcpConnection

public TcpConnection(int priorityLevels,
                     java.net.Socket socket)
Constructor creating a TcpConnection.

Parameters:
priorityLevels - the number of priority levels for the commands
socket - the communication socket to be used
Since:
Disciple v3.0
Rose:
3D08E67A031A
Method Detail

setLocalId

public void setLocalId(java.lang.Object localId)
Overrides:
setLocalId in class Connection

send

public void send(Command cmd,
                 int priority)
Sends a command to the connections peer.

Specified by:
send in class Connection
Parameters:
cmd - - The command to be sent.
priority - - The priority of the command.

send

protected void send(ControlMessage msg)
Specified by:
send in class Connection

setQoSParameters

public void setQoSParameters(org.w3c.dom.Node parameters)
Sets the QoS parameters for this connection. E.g. the maximum bandwidth, burst length etc.

Specified by:
setQoSParameters in class Connection
Parameters:
parameters -

run

public void run()
Receive loop for the connection.

Specified by:
run in interface java.lang.Runnable

panic

protected void panic()


Copyright (c) 2003 Rutgers, The State University of New Jersey