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
-
msv
- Pointer to the ModelServer which owns us
-
muQ
- The FIFO queue of ModelUpdates waiting to be processed
-
oos
- Pointer to the output stream
-
outName
- The name of the output file if writing to a file
-
qpause
- Number of milliseconds to pause between update queue runs
-
rcount
- The reference count for number of objects "written"
-
ModelStorage(ConfigMgr)
- Class constructor.
-
closeOut()
- Closes the
ModelUpdate save file.
-
enqueueUpdate(ModelUpdate)
- Queues the specified
ModelUpdate to our internal
processing queue(s).
-
finalize()
- Ensures that all
ModelUpdate streams are closed.
-
openOut(ConfigMgr)
- Opens the
ModelUpdate save file, if specified.
-
queueSize()
- Gets the number of components currently on the processing queue.
-
run()
- Processes the entries on our internal processing queue.
-
writeMU(ModelUpdate)
- Writes the supplied
ModelUpdate object to the save
file, if one was specified.
qpause
private static final int qpause
- Number of milliseconds to pause between update queue runs
outName
public String outName
- The name of the output file if writing to a file
muQ
private FIFO muQ
- The FIFO queue of ModelUpdates waiting to be processed
oos
private ObjectOutputStream oos
- Pointer to the output stream
msv
private ModelServer msv
- Pointer to the ModelServer which owns us
rcount
private int rcount
- The reference count for number of objects "written"
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
run
public void run()
- Processes the entries on our internal processing queue.
- Overrides:
- run in class Thread
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
queueSize
public int queueSize()
- Gets the number of components currently on the processing queue.
- Returns:
- the count of components on the processing queue
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
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
closeOut
private void closeOut() throws IOException
- Closes the
ModelUpdate save file.
- Throws: IOException
- if an I/O error occurs
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