public void run() { try { Thread ct = Thread.currentThread(); Thread.sleep(shift); while (monitor != null && monitor.equals(ct)) { long executiontime = System.currentTimeMillis(); OnMemoryTupleSet ts = new OnMemoryTupleSet(schema); Tuple t = new Tuple(schema.size()); t.setTimestamp(table[0], executiontime); t.setLong(0, executiontime); t.setString(1, command); t.setString(2, getCommandOutput()); ts.appendTuple(t); ts.beforeFirst(); deliverTupleSet(executiontime, table[0], ts); Thread.sleep(interval); } } catch (Exception e) { e.printStackTrace(); } }
public void start() throws StreamSpinnerException { if (interval <= 0) throw new StreamSpinnerException("interval is not set"); monitor = new Thread(this); monitor.start(); }