@Throws(InterpreterException::class) private fun waitForRScriptInitialized() { synchronized(rScriptInitializeNotifier) { val startTime = System.nanoTime() while (rScriptInitialized === false && rScriptRunning && System.nanoTime() - startTime < 10L * 1000 * 1000000) { try { rScriptInitializeNotifier.wait(1000) } catch (e: InterruptedException) { logger.error(e.message, e) } } } var errorMessage = "" try { initialOutput.flush() errorMessage = String(initialOutput.toByteArray()) } catch (e: IOException) { e.printStackTrace() } if (rScriptInitialized === false) { throw InterpreterException("sparkr is not responding $errorMessage") } }
Wait until src/main/resources/R/zeppelin_sparkr.R is initialized and call onScriptInitialized ( )