void writeLine ( String line ) throws IOException { checkState ( isRunning ( ) , "Cannot read items from a %s StreamService" , state ( ) ) ; checkState ( socketWriter != null , "Attempted to write to the socket before it was opened." ) ; try { socketWriter . write ( line ) ; socketWriter . write ( ' ' ) ; // We need to flush since this is a back and forth lockstep protocol, buffering can cause // deadlock! socketWriter . flush ( ) ; } catch ( IOException e ) { Closeables . close ( socketWriter , true ) ; notifyFailed ( e ) ; throw e ; } }
Write a line of data to the worker process over the socket .