@Override
  public void run() {

    while (deadLine > 0) {
      try {
        sleep(SLEEP_TIME);
        deadLine -= SLEEP_TIME;
      } catch (InterruptedException ex) {
        Logger.getLogger(ThreadScheduling.class.getName()).log(Level.SEVERE, null, ex);
        ex.printStackTrace();
      }
    }

    Thread threadSupervisioned = new Thread(agentPeixeEspada);

    threadSupervisioned.start();

    deadLine = agentPeixeEspada.getEndDate().getTime() - agentPeixeEspada.getInitDate().getTime();
    ThreadDeadLine td = new ThreadDeadLine(threadSupervisioned, deadLine, agentPeixeEspada);
    td.start();
  }
 public ThreadScheduling(LocalManagerAgent agent) {
   this.agentPeixeEspada = agent;
   this.deadLine = agent.getInitDate().getTime() - System.currentTimeMillis();
 }