Examples of AlgorithmState


Examples of org.cishell.reference.app.service.scheduler.AlgorithmTask.AlgorithmState

        // Shaky method. Ideally this is done at a higher level. But still, here goes...
        ServiceReference reference = this.algorithmSchedulerTask.getServiceReference(algorithm);
        boolean canReschedule = false;

        try {
            AlgorithmState algorithmState =
              this.algorithmSchedulerTask.getAlgorithmState(algorithm);
           
            // Cannot reschedule running algorithms.
            if (algorithmState.equals(AlgorithmState.RUNNING)) {
                canReschedule = false;
            } else if (algorithmState.equals(AlgorithmState.STOPPED)) {
                this.algorithmSchedulerTask.purgeFinished();
                this.algorithmSchedulerTask.schedule(algorithm, reference, newTime);
                canReschedule = true;
            } else if (algorithmState.equals(AlgorithmState.NEW)) {
                this.algorithmSchedulerTask.cancel(algorithm);
                this.algorithmSchedulerTask.schedule(algorithm, reference, newTime);
            } else {
                throw new IllegalStateException("Encountered an invalid state: " + algorithmState);
            }
View Full Code Here

Examples of org.cishell.reference.app.service.scheduler.AlgorithmTask.AlgorithmState

    public synchronized final void schedule(Algorithm alg, ServiceReference ref, Calendar time) {
        AlgorithmTask task = this.tasksByAlgorithms.get(alg);
        // If alg already exists, do some checks...
        if (task != null) {
            AlgorithmState state = task.getState();
            // If its still running, we can't schedule it again.
            if (state.equals(AlgorithmState.RUNNING)) {
                throw new RuntimeException(
                        "Cannot schedule running algorithm. Check state of algorithm first.");
            }
            // If its new or waiting to run, we refuse to schedule it to force
            // user to explicitly
            // cancel and reschedule.
            else if (state.equals(AlgorithmState.NEW)) {
                throw new RuntimeException(
                        "Algorithm is already scheduled to run. Cancel existing schedule first.");
            }
            else if (state.equals(AlgorithmState.STOPPED)) {
                // If it was stopped but not cleaned up yet, clean it up
                purgeFinished();
            }
            else {
                throw new IllegalStateException(
View Full Code Here

Examples of org.cishell.reference.app.service.scheduler.AlgorithmTask.AlgorithmState

        return false;
      }
      if (!(obj instanceof AlgorithmState)) {
        return false;
      }
      AlgorithmState other = (AlgorithmState) obj;
      return Objects.equal(this.name, other.name);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.