ostore.network
Class MultiplexedNetwork

java.lang.Object
  |
  +--ostore.network.MultiplexedNetwork
All Implemented Interfaces:
EventHandlerIF, ProfilableIF

public class MultiplexedNetwork
extends Object
implements EventHandlerIF, ProfilableIF

A stage that supports multiple virtual OceanStore nodes in a single JVM instance. A single instance of this stage can be used to provide network support for N virtual OceanStore nodes, in place of using N separtate ostore.network.Network stages to acheive the same goal. Lock Dependency Graph:

Version:
$Id: MultiplexedNetwork.java,v 1.8 2002/09/08 03:33:33 srhea Exp $
Author:
Sean C. Rhea

Nested Class Summary
protected  class MultiplexedNetwork.ConnectionState
          All the state we need about a connection to another node.
protected  class MultiplexedNetwork.DelayWrapper
           
 
Field Summary
protected  PriorityQueue close_me
          Connections which we want to close.
protected  Map conn_to_connstate
          Maps ATcpConnection objects to ConnectionState objects;
protected static boolean DEBUG
           
protected static boolean DEBUG_SERIALIZATION
           
protected  Classifier delay_classifier
          The Classifier for node_id_0, used to dispatch DelayWrappers to.
protected  LinkedList local_nodeids
          A list of NodeIds within this JVM.
protected  NodeId lowest_nodeid
          The NodeId for node_id_0, used to get Alarms on.
protected  PriorityQueue mystery_connections
          Used to time out connections without IdentityMessages.
protected  Map node_id_to_vertex
          For emulation of large networks.
protected  Map nodeid_to_classifier
          Maps NodeIds to the Classifiers within this JVM.
protected  Map nodeid_to_connstate
          Maps NodeId objects to the ConnectionState objects in whose ids_represented sets they reside.
protected  int open_connections
          For debugging.
protected  Object open_connections_lock
           
protected  String TAG
           
protected  SinkIF this_sink
           
protected  soss.network.TransitStub ts
          For emulation of large networks.
 
Constructor Summary
MultiplexedNetwork()
           
 
Method Summary
protected static void BUG(String msg)
          For convenience.
 void destroy()
           
protected  void enqueue_msg(ATcpConnection conn, NetworkMessage msg)
           
protected  void handle_alarm()
          Generally, we don't want to close sinks immediately, as there may be data still on the wire; instead, we just put them in this close_me priority queue, and they will be closed sometime after the time equal to their priority has passed.
protected  void handle_atcp_connect_failed_event(ATcpConnectFailedEvent failure)
           
protected  void handle_atcp_connection(ATcpConnection conn)
           
protected  void handle_atcp_inpacket(ATcpInPacket packet)
           
protected  void handle_closed_connection(ATcpConnection conn)
           
protected  void handle_identity_msg(IdentityMessage ident, MultiplexedNetwork.ConnectionState connstate, ATcpConnection conn)
           
protected  void handle_outbound_network_message(NetworkMessage msg, boolean delay)
           
protected  void handle_sink_closed_event(SinkClosedEvent sce)
           
 void handleEvent(QueueElementIF item)
           
 void handleEvents(QueueElementIF[] items)
           
 void init(ConfigDataIF config)
          Set things up.
 int profileSize()
          Defined by ProfilableIF
protected  void read_topology_info(String topology_graph, String topology_mapping)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG

protected String TAG

DEBUG

protected static final boolean DEBUG
See Also:
Constant Field Values

DEBUG_SERIALIZATION

protected static final boolean DEBUG_SERIALIZATION
See Also:
Constant Field Values

nodeid_to_classifier

protected Map nodeid_to_classifier
Maps NodeIds to the Classifiers within this JVM.


local_nodeids

protected LinkedList local_nodeids
A list of NodeIds within this JVM.


delay_classifier

protected Classifier delay_classifier
The Classifier for node_id_0, used to dispatch DelayWrappers to.


lowest_nodeid

protected NodeId lowest_nodeid
The NodeId for node_id_0, used to get Alarms on.


conn_to_connstate

protected Map conn_to_connstate
Maps ATcpConnection objects to ConnectionState objects;


nodeid_to_connstate

protected Map nodeid_to_connstate
Maps NodeId objects to the ConnectionState objects in whose ids_represented sets they reside.


this_sink

protected SinkIF this_sink

mystery_connections

protected PriorityQueue mystery_connections
Used to time out connections without IdentityMessages.


close_me

protected PriorityQueue close_me
Connections which we want to close.


node_id_to_vertex

protected Map node_id_to_vertex
For emulation of large networks.


ts

protected soss.network.TransitStub ts
For emulation of large networks.


open_connections

protected int open_connections
For debugging.


open_connections_lock

protected Object open_connections_lock
Constructor Detail

MultiplexedNetwork

public MultiplexedNetwork()
Method Detail

init

public void init(ConfigDataIF config)
          throws Exception
Set things up.

Specified by:
init in interface EventHandlerIF
Exception

handleEvent

public void handleEvent(QueueElementIF item)
                 throws EventHandlerException
Specified by:
handleEvent in interface EventHandlerIF
EventHandlerException

handleEvents

public void handleEvents(QueueElementIF[] items)
                  throws EventHandlerException
Specified by:
handleEvents in interface EventHandlerIF
EventHandlerException

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface EventHandlerIF
Exception

read_topology_info

protected void read_topology_info(String topology_graph,
                                  String topology_mapping)
                           throws IOException
IOException

handle_outbound_network_message

protected void handle_outbound_network_message(NetworkMessage msg,
                                               boolean delay)

enqueue_msg

protected void enqueue_msg(ATcpConnection conn,
                           NetworkMessage msg)

handle_atcp_connection

protected void handle_atcp_connection(ATcpConnection conn)

handle_atcp_inpacket

protected void handle_atcp_inpacket(ATcpInPacket packet)

handle_identity_msg

protected void handle_identity_msg(IdentityMessage ident,
                                   MultiplexedNetwork.ConnectionState connstate,
                                   ATcpConnection conn)

handle_sink_closed_event

protected void handle_sink_closed_event(SinkClosedEvent sce)

handle_closed_connection

protected void handle_closed_connection(ATcpConnection conn)

handle_atcp_connect_failed_event

protected void handle_atcp_connect_failed_event(ATcpConnectFailedEvent failure)

profileSize

public int profileSize()
Defined by ProfilableIF

Specified by:
profileSize in interface ProfilableIF

BUG

protected static final void BUG(String msg)
For convenience.


handle_alarm

protected void handle_alarm()
Generally, we don't want to close sinks immediately, as there may be data still on the wire; instead, we just put them in this close_me priority queue, and they will be closed sometime after the time equal to their priority has passed.