/// Terminate the sending of tuples
  public void terminate() {
    if (state == RUNNING || state == END || state == PAUSED) timer.cancel();

    synchronized (this) {
      state = TERMINATED;
    }

    try {
      socket.close();
    } catch (IOException e) {
      System.out.println("Error closing socket");
    }
  }
  public void start() {
    assert (state == START);

    numTuplesSent = 0;
    startTime = System.currentTimeMillis();

    state = RUNNING;
    intervalStartTime = startTime;
    intervalNumTuplesSent = 0;

    lastOutputTs = 0;

    sendSchema();

    timer = new Timer();
    timer.schedule(new FeederTask(), 1, SLEEP_TIME);
  }