genopt.simulation
Class ThreadedInputStream

java.lang.Object
  extended by java.lang.Thread
      extended by genopt.simulation.ThreadedInputStream
All Implemented Interfaces:
java.lang.Runnable

public class ThreadedInputStream
extends java.lang.Thread

Class to buffer the error stream. This class is needed to avoid a deadlock of waitFor(), which may happen if the simulation program writes a large message.

This project was carried out at:

and supported by

GenOpt Copyright (c) 1998-2011, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

Version:
GenOpt(R) 3.1.0 (December 8, 2011)

Author:
Michael Wetter

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  java.io.IOException ioExc
          The IOException stored by this thread
(package private)  java.io.InputStream is
          The buffered input stream
(package private)  java.lang.StringBuffer sb
          The string buffer that stores the output of the stream
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ThreadedInputStream(java.io.InputStream inputStream)
           
 
Method Summary
(package private)  java.lang.String getInputStream()
          Gets the output input stream that has been buffered
 void run()
          Runs this thread and buffers its output
 void throwStoredException()
          Throws all exceptions that have been catched when running run.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ioExc

protected java.io.IOException ioExc
The IOException stored by this thread


is

java.io.InputStream is
The buffered input stream


sb

java.lang.StringBuffer sb
The string buffer that stores the output of the stream

Constructor Detail

ThreadedInputStream

public ThreadedInputStream(java.io.InputStream inputStream)
Method Detail

run

public void run()
Runs this thread and buffers its output

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

throwStoredException

public void throwStoredException()
                          throws java.io.IOException
Throws all exceptions that have been catched when running run.

Throws:
java.io.IOException

getInputStream

java.lang.String getInputStream()
Gets the output input stream that has been buffered