net.clackrouter.component.extension
Class FlowByteQueue

java.lang.Object
  extended by net.clackrouter.component.base.ClackComponent
      extended by net.clackrouter.component.base.Queue
          extended by net.clackrouter.component.extension.FlowByteQueue
All Implemented Interfaces:
Alarm

public class FlowByteQueue
extends Queue


Nested Class Summary
 
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent
ClackComponent.Waiter
 
Field Summary
static int AVG_INTERVAL_MSEC
           
static int DEFAULT_MAX_IDLE_TIME
           
static int DEFAULT_MAX_SIZE
           
protected  java.util.Hashtable m_flowsize_map
           
protected  ClackOccData m_occ_flowdata
           
protected  java.util.ArrayList m_queue
           
static int STALE_CHECK_INTERVAL
           
protected  java.util.Date startTime
           
static int UPDATE_INTERVAL_MSEC
           
static int VISIBLE_TIME_INTERVAL
           
 
Fields inherited from class net.clackrouter.component.base.Queue
DEFAULT_SIZE, m_max_size, m_recent_drop, m_total_drops, mQueueOccData, NUM_PORTS, PORT_HEAD, PORT_TAIL
 
Fields inherited from class net.clackrouter.component.base.ClackComponent
componentCell, m_has_error, m_log, m_name, m_num_ports, m_packetcount_in, m_packetcount_out, m_ports, mListeners, mRouter, pendingError, SIGNAL_ERROR_LEN_MSEC, UNIQUE_COUNT, view
 
Constructor Summary
FlowByteQueue(Router router, java.lang.String name)
           
FlowByteQueue(Router router, java.lang.String name, int max_bytes)
           
 
Method Summary
 void acceptPacket(VNSPacket packet, int port_number)
          Add packet to the queue if the additional bytes can be stored without exceeding max size, otherwise drop.
 void clearAllFlowInformation()
           
 ClackOccData getMultiSeriesOccData()
          Provides data of queue occupancy vs time for real-time graphs.
 int getOccupancy()
          The current occupancy of the queue
 javax.swing.JPanel getPropertiesView()
          Method for getting the properties view associated with this component Property views are used to display more detailed information about internal component state.
 java.util.Properties getSerializableProperties(boolean isTransient)
          Serialize the queue's size for reloading the router
 VNSPacket handlePullRequest(int port_number)
          Pull a packet from the head of the queue
 void initializeProperties(java.util.Properties props)
          Load the saved size value
protected  void packet_added(VNSPacket p, boolean is_drop)
          updates graph and GUI queue when packet has been added to the queue
protected  void packet_removed(VNSPacket p)
          updates graph and GUI queue when packet has been removed from the queue
 
Methods inherited from class net.clackrouter.component.base.Queue
getMaxOccupancy, getQueueOccData, getTotalDropped, getView, isModifying, queueOccupancyChanged, recentDropTest, setMaxOccupancy, setupPorts
 
Methods inherited from class net.clackrouter.component.base.ClackComponent
createCopy, createInputPullPort, createInputPushPort, createOutputPullPort, createOutputPushPort, error, fireListeners, getColor, getComponentCell, getHierarchicalView, getLog, getName, getNumPorts, getPacketCountIn, getPacketCountOut, getPendingError, getPort, getRouter, getTime, getTypeName, getUniqueCount, hasError, isHierarchical, log, notifyAlarm, poll, registerListener, sendOutPort, setAlarm, setComponentCell, setName, setPendingError, setView, showErrorDialog, signalError, try_repaint, unregisterListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_SIZE

public static int DEFAULT_MAX_SIZE

startTime

protected java.util.Date startTime

m_queue

protected java.util.ArrayList m_queue

m_occ_flowdata

protected ClackOccData m_occ_flowdata

m_flowsize_map

protected java.util.Hashtable m_flowsize_map

AVG_INTERVAL_MSEC

public static int AVG_INTERVAL_MSEC

UPDATE_INTERVAL_MSEC

public static int UPDATE_INTERVAL_MSEC

STALE_CHECK_INTERVAL

public static int STALE_CHECK_INTERVAL

DEFAULT_MAX_IDLE_TIME

public static int DEFAULT_MAX_IDLE_TIME

VISIBLE_TIME_INTERVAL

public static int VISIBLE_TIME_INTERVAL
Constructor Detail

FlowByteQueue

public FlowByteQueue(Router router,
                     java.lang.String name)

FlowByteQueue

public FlowByteQueue(Router router,
                     java.lang.String name,
                     int max_bytes)
Method Detail

acceptPacket

public void acceptPacket(VNSPacket packet,
                         int port_number)
Add packet to the queue if the additional bytes can be stored without exceeding max size, otherwise drop.

Overrides:
acceptPacket in class Queue
Parameters:
packet - The pushed packet
port_number - The number of the port that this packet is arriving on

handlePullRequest

public VNSPacket handlePullRequest(int port_number)
Pull a packet from the head of the queue

Overrides:
handlePullRequest in class Queue
Parameters:
port_number - The port that a packet is being requested on
Returns:
a single packet, or null if queue is empty

getOccupancy

public int getOccupancy()
Description copied from class: Queue
The current occupancy of the queue

Overrides:
getOccupancy in class Queue

packet_added

protected void packet_added(VNSPacket p,
                            boolean is_drop)
updates graph and GUI queue when packet has been added to the queue


packet_removed

protected void packet_removed(VNSPacket p)
updates graph and GUI queue when packet has been removed from the queue


getMultiSeriesOccData

public ClackOccData getMultiSeriesOccData()
Provides data of queue occupancy vs time for real-time graphs.


getPropertiesView

public javax.swing.JPanel getPropertiesView()
Description copied from class: ClackComponent
Method for getting the properties view associated with this component Property views are used to display more detailed information about internal component state. This method creates a default property view, and can be overriden to provide custom properties views

Overrides:
getPropertiesView in class Queue
Returns:
this component's property view

getSerializableProperties

public java.util.Properties getSerializableProperties(boolean isTransient)
Serialize the queue's size for reloading the router

Overrides:
getSerializableProperties in class Queue
Parameters:
isTransient - flag indicating if serialization is transient
Returns:
all property key-value pairs to serialize

initializeProperties

public void initializeProperties(java.util.Properties props)
Load the saved size value

Overrides:
initializeProperties in class Queue
Parameters:
props - all property values serialized for this component

clearAllFlowInformation

public void clearAllFlowInformation()