Package org.japura.task.event

Examples of org.japura.task.event.TaskEventMessage


  return session;
  }

  protected void fireBefore(Task task) {
  Application.getMessageManager().publish(false,
    new TaskEventMessage(task, getTaskSession(), TaskEventType.BEFORE));
  Application.getTaskManager().fireTaskExecutionUIs(
    TaskManagerEvent.BEFORE_EXECUTE, task);
  }
View Full Code Here


    TaskManagerEvent.BEFORE_EXECUTE, task);
  }

  protected void fireAfter(Task task) {
  Application.getMessageManager().publish(false,
    new TaskEventMessage(task, getTaskSession(), TaskEventType.AFTER));
  Application.getTaskManager().fireTaskExecutionUIs(
    TaskManagerEvent.AFTER_EXECUTE, task);
  }
View Full Code Here

    @Override
    public void run() {
      Application.getMessageManager()
        .publish(
          false,
          new TaskEventMessage(task, getTaskSession(),
            TaskEventType.ERROR));
      task.handleException(getTaskSession(), task.getException(),
        discardedTasks);
    }
    };
  } else if (task.getStatus().equals(TaskStatus.DONE)) {
    runnable = new Runnable() {
    @Override
    public void run() {
      Application.getMessageManager().publish(false,
        new TaskEventMessage(task, getTaskSession(), TaskEventType.DONE));
      task.done(getTaskSession());
    }
    };
  } else if (task.getStatus().equals(TaskStatus.CANCELED)) {
    runnable = new Runnable() {
    @Override
    public void run() {
      Application.getMessageManager().publish(
        false,
        new TaskEventMessage(task, getTaskSession(),
          TaskEventType.CANCELED));
      task.canceled(getTaskSession());
    }
    };
  }
View Full Code Here

    || task.getStatus().equals(TaskStatus.ERROR)) {
    return;
  }

  long startTime = System.currentTimeMillis();
  TaskEventMessage msg =
    new TaskEventMessage(task, getTaskSession(),
      TaskEventType.DO_IN_BACKGROUND);
  Application.getMessageManager().publish(false, msg);
  task.registerStatus(TaskStatus.EXECUTING);
  try {
    task.doInBackground(getTaskSession());
  } catch (Exception e) {
    task.registerException(e);
  }

  if (task.getStatus().equals(TaskStatus.EXECUTING)) {
    task.registerStatus(TaskStatus.DONE);
  }
  task.registerBackgroundTimeSpent(System.currentTimeMillis() - startTime);
  msg.getTaskEvent().setTimeSpent(task.getBackgroundTimeSpent());
  }
View Full Code Here

    task.registerStatus(TaskStatus.CANCELED);
    Application.getHandlerExceptionManager().handle(e);
    }

    Application.getMessageManager().publish(false,
      new TaskEventMessage(task, session, TaskEventType.SUBMIT));
    Application.getTaskManager().fireTaskExecutionUIs(
      TaskManagerEvent.SUBMITTED, task);
  }
  }
View Full Code Here

    for (Task discardedTask : discardedTasks) {
      fireBefore(discardedTask);
      fireAfter(discardedTask);
      Application.getMessageManager().publish(
        false,
        new TaskEventMessage(discardedTask, getTaskSession(),
          TaskEventType.DISCARDED));
      Application.getMessageManager().publish(
        false,
        new TaskExecutionMessage(false, getTaskSession(), discardedTask,
          previousTaskId));
View Full Code Here

TOP

Related Classes of org.japura.task.event.TaskEventMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.