private void waitForRScriptInitialized() throws InterpreterException {
synchronized (rScriptInitializeNotifier) {
    long startTime=System.nanoTime();
    while (rScriptInitialized == false && rScriptRunning && System.nanoTime() - startTime < 10L * 1000 * 1000000) {
      try {
        rScriptInitializeNotifier.wait(1000);
      }
 catch (      InterruptedException e) {
        logger.error(e.getMessage(),e);
      }
    }
  }
  String errorMessage="";
  try {
    initialOutput.flush();
    errorMessage=new String(initialOutput.toByteArray());
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  if (rScriptInitialized == false) {
    throw new InterpreterException("sparkr is not responding " + errorMessage);
  }
}

private void waitForRScriptInitialized ( ) throws InterpreterException { synchronized ( rScriptInitializeNotifier ) { long startTime = System . nanoTime ( ) ; while ( rScriptInitialized == false && rScriptRunning && System . nanoTime ( ) - startTime < 10L * 1000 * 1000000 ) { try { rScriptInitializeNotifier . wait ( 1000 ) ; } catch ( InterruptedException e ) { logger . error ( e . getMessage ( ) , e ) ; } } } String errorMessage = "" ; try { initialOutput . flush ( ) ; errorMessage = new String ( initialOutput . toByteArray ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } if ( rScriptInitialized == false ) { throw new InterpreterException ( "sparkr is not responding " + errorMessage ) ; } }
wait until src / main / resources / r / zeppelin_sparkr . r is initialized and call onscriptinitialized ( )
