Ejemplo n.º 1
0
  @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();
  }
Ejemplo n.º 2
0
 public ThreadScheduling(LocalManagerAgent agent) {
   this.agentPeixeEspada = agent;
   this.deadLine = agent.getInitDate().getTime() - System.currentTimeMillis();
 }