Esempio n. 1
0
  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();
    }
  }
Esempio n. 2
0
  public CommandWrapper(String name) throws StreamSpinnerException {
    super(name);

    table = new String[1];
    table[0] = "Command";

    String[] attrs = {table[0] + ".Timestamp", table[0] + ".Name", table[0] + ".Output"};
    String[] types = {DataTypes.LONG, DataTypes.STRING, DataTypes.STRING};
    schema = new Schema(table[0], attrs, types);
    schema.setTableType(Schema.STREAM);
  }