Class ModelStorage

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----ModelStorage

public class ModelStorage
extends Thread
Provides the storage and distribution mechanisms used for ModelUpdate objects.

Version:
$Revision: 1.10 $, $Date: 2000/10/31 20:32:03 $
Author:
Mike Spengler, Joseph Thomas

Variable Index

 o msv
Pointer to the ModelServer which owns us
 o muQ
The FIFO queue of ModelUpdates waiting to be processed
 o oos
Pointer to the output stream
 o outName
The name of the output file if writing to a file
 o qpause
Number of milliseconds to pause between update queue runs
 o rcount
The reference count for number of objects "written"

Constructor Index

 o ModelStorage(ConfigMgr)
Class constructor.

Method Index

 o closeOut()
Closes the ModelUpdate save file.
 o enqueueUpdate(ModelUpdate)
Queues the specified ModelUpdate to our internal processing queue(s).
 o finalize()
Ensures that all ModelUpdate streams are closed.
 o openOut(ConfigMgr)
Opens the ModelUpdate save file, if specified.
 o queueSize()
Gets the number of components currently on the processing queue.
 o run()
Processes the entries on our internal processing queue.
 o writeMU(ModelUpdate)
Writes the supplied ModelUpdate object to the save file, if one was specified.

Variables

 o qpause
 private static final int qpause
Number of milliseconds to pause between update queue runs

 o outName
 public String outName
The name of the output file if writing to a file

 o muQ
 private FIFO muQ
The FIFO queue of ModelUpdates waiting to be processed

 o oos
 private ObjectOutputStream oos
Pointer to the output stream

 o msv
 private ModelServer msv
Pointer to the ModelServer which owns us

 o rcount
 private int rcount
The reference count for number of objects "written"

Constructors

 o ModelStorage
 public ModelStorage(ConfigMgr cm) throws IOException
Class constructor.

Parameters:
cm - the configuration manager containing all configuration information for this run
Throws: IOException
if any files couldn't be opened

Methods

 o run
 public void run()
Processes the entries on our internal processing queue.

Overrides:
run in class Thread
 o enqueueUpdate
 public void enqueueUpdate(ModelUpdate update)
Queues the specified ModelUpdate to our internal processing queue(s). On entry, the ATMNetwork object lock must be held - thus making it safe to walk the worker list.

Parameters:
update - the ModelUpdate to be queued
 o queueSize
 public int queueSize()
Gets the number of components currently on the processing queue.

Returns:
the count of components on the processing queue
 o openOut
 private void openOut(ConfigMgr cm) throws IOException
Opens the ModelUpdate save file, if specified.

Parameters:
cm - the configuration manager containing all configuration information for this run
Throws: IOException
if the save file couldn't be opened
 o writeMU
 public void writeMU(ModelUpdate mu) throws IOException
Writes the supplied ModelUpdate object to the save file, if one was specified.

Parameters:
mu - the ModelUpdate object to be written
Throws: IOException
if an I/O error occurs
 o closeOut
 private void closeOut() throws IOException
Closes the ModelUpdate save file.

Throws: IOException
if an I/O error occurs
 o finalize
 protected void finalize() throws IOException
Ensures that all ModelUpdate streams are closed.

Throws: IOException
if an I/O error occurs
Overrides:
finalize in class Object