/** Pass a string to kdb for evaluation. */ public void evaluate(SimpleEvaluationObject obj, String code) { try { kdbProcess.getErrorHandler().reset(obj); kdbProcess.getOutputHandler().reset(obj); Object result = kdbClient.execute(code); obj.finished(convert(result)); } catch (Exception e) { obj.error(e); } kdbProcess.getErrorHandler().reset(null); kdbProcess.getOutputHandler().reset(null); }
/** So long, farewell. */ public void exit() { try { kdbClient.close(); } catch (IOException e) { // } kdbProcess.interrupt(); try { kdbProcess.join(5000); } catch (InterruptedException e) { // } }
public KdbShell( String shellId, String sessionId, int corePort, BeakerObjectConverter objConv, String qh) throws Exception { this.shellId = shellId; this.sessionId = sessionId; this.corePort = corePort; this.objConv = objConv; kdbPort = getPortFromCore(); kdbProcess = new KdbProcess(sessionId, kdbPort, qh); kdbProcess.start(); kdbClient = new KdbClient("localhost", kdbPort); }