FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.communication.MsgSizeMonitor Class Reference

Measures message sizes using serialization. More...

Inheritance diagram for frodo2.communication.MsgSizeMonitor:

Public Member Functions

 MsgSizeMonitor () throws IOException
 Constructor.
void close ()
 Closes the stream.
void run ()
long getMsgSize (Object dest, Message msg) throws IOException
 Computes the size of the input message.

Private Member Functions

PipedInputStream createNewDest (Object dest) throws IOException
 Creates a new message destination.

Private Attributes

Object currentDest
 Destination of the current message.
HashMap< Object, ObjectOutputStream > out = new HashMap<Object, ObjectOutputStream> ()
 The output streams to which messages are written, classified by destination.
HashMap< Object, PipedOutputStream > outRaw = new HashMap<Object, PipedOutputStream> ()
 The streams underlying out, classified by destination.
HashMap< Object, PipedInputStream > in = new HashMap<Object, PipedInputStream> ()
 The input streams from which bytes are read, classified by destination.
Thread writer
 The writer thread.
SynchronousQueue< Messagequeue = new SynchronousQueue<Message> ()
 Used by the reader to pass a message to the writer.
boolean doneWriting = false
 Used by the writer to tell the reader that it is done writing the message.
boolean wroteLastByte = false
 Used by the writer to tell the reader that it has written the additional closing byte.

Detailed Description

Measures message sizes using serialization.

Author
Thomas Leaute

Constructor & Destructor Documentation

◆ MsgSizeMonitor()

frodo2.communication.MsgSizeMonitor.MsgSizeMonitor ( ) throws IOException

Constructor.

Exceptions
IOExceptionif the constructor failed to create the streams

Member Function Documentation

◆ close()

void frodo2.communication.MsgSizeMonitor.close ( )

◆ createNewDest()

PipedInputStream frodo2.communication.MsgSizeMonitor.createNewDest ( Object dest) throws IOException
private

Creates a new message destination.

Parameters
destmessage destination
Returns
the new input stream
Exceptions
IOExceptionif an I/O error occurs

Referenced by getMsgSize().

◆ getMsgSize()

long frodo2.communication.MsgSizeMonitor.getMsgSize ( Object dest,
Message msg ) throws IOException

Computes the size of the input message.

Parameters
destthe message destination
msgthe message
Returns
the number of bytes necessary to serialize this message
Exceptions
IOExceptionif an error occurs

References createNewDest().

Referenced by frodo2.communication.Queue.recordStats(), and frodo2.communication.MsgSizeMonitorTest.test().

Here is the call graph for this function:

◆ run()

void frodo2.communication.MsgSizeMonitor.run ( )
See also
java.lang.Runnable#run()

References frodo2.communication.Message.writeExternal().

Here is the call graph for this function:

Member Data Documentation

◆ currentDest

Object frodo2.communication.MsgSizeMonitor.currentDest
private

Destination of the current message.

◆ doneWriting

boolean frodo2.communication.MsgSizeMonitor.doneWriting = false
private

Used by the writer to tell the reader that it is done writing the message.

◆ in

HashMap<Object, PipedInputStream> frodo2.communication.MsgSizeMonitor.in = new HashMap<Object, PipedInputStream> ()
private

The input streams from which bytes are read, classified by destination.

◆ out

HashMap<Object, ObjectOutputStream> frodo2.communication.MsgSizeMonitor.out = new HashMap<Object, ObjectOutputStream> ()
private

The output streams to which messages are written, classified by destination.

◆ outRaw

HashMap<Object, PipedOutputStream> frodo2.communication.MsgSizeMonitor.outRaw = new HashMap<Object, PipedOutputStream> ()
private

The streams underlying out, classified by destination.

◆ queue

SynchronousQueue<Message> frodo2.communication.MsgSizeMonitor.queue = new SynchronousQueue<Message> ()
private

Used by the reader to pass a message to the writer.

◆ writer

Thread frodo2.communication.MsgSizeMonitor.writer
private

The writer thread.

◆ wroteLastByte

boolean frodo2.communication.MsgSizeMonitor.wroteLastByte = false
private

Used by the writer to tell the reader that it has written the additional closing byte.


The documentation for this class was generated from the following file: