Examples of Cancelable


Examples of com.opengamma.util.async.Cancelable

  public void testCancelStoppingJobs() {
    final AtomicBoolean canceled = new AtomicBoolean();
    final JobDispatcher dispatcher = new JobDispatcher() {
      @Override
      public Cancelable dispatchJob(final CalculationJob job, final JobResultReceiver receiver) {
        return new Cancelable() {
          @Override
          public boolean cancel(final boolean mayInterruptIfRunning) {
            assertTrue(mayInterruptIfRunning);
            canceled.set(true);
            return true;
View Full Code Here

Examples of com.opengamma.util.async.Cancelable

    // No third job
    assertNull(dispatcher.pollResult());
  }

  public void testCancelDuringDispatch() {
    final Cancelable handle = Mockito.mock(Cancelable.class);
    final AtomicReference<PlanExecutor> executor = new AtomicReference<PlanExecutor>();
    final JobDispatcher dispatcher = new JobDispatcher() {
      @Override
      public Cancelable dispatchJob(final CalculationJob job, final JobResultReceiver receiver) {
        executor.get().cancel(true);
View Full Code Here

Examples of com.opengamma.util.async.Cancelable

    s_logger.info("testJobCancel");
    final JobDispatcher jobDispatcher = new JobDispatcher();
    jobDispatcher.setMaxJobExecutionTime(2 * TIMEOUT);
    jobDispatcher.setMaxJobAttempts(1);
    final TestJobResultReceiver result = new TestJobResultReceiver();
    Cancelable job = jobDispatcher.dispatchJob(createTestJob(), result);
    assertNotNull(job);
    assertNull(result.getResult());
    final BlockingJobInvoker blockingInvoker = new BlockingJobInvoker(TIMEOUT);
    jobDispatcher.registerJobInvoker(blockingInvoker);
    assertTrue (job.cancel (false));
    assertTrue (blockingInvoker.isCancelled ());
  }
View Full Code Here

Examples of com.opengamma.util.async.Cancelable

      _executing.put(job.getSpecification(), executing);
      if (job.getTail() != null) {
        storeTailJobs(job);
      }
    }
    final Cancelable handle = getCycle().getViewProcessContext().getComputationJobDispatcher().dispatchJob(job, this);
    executing.setCancel(handle);
    synchronized (this) {
      if (_executing == null) {
        // Completed or cancelled during the submission
        handle.cancel(true);
        return;
      }
      if (job.getTail() != null) {
        cancelableTailJobs(job, handle);
      }
View Full Code Here

Examples of com.opengamma.util.async.Cancelable

    // Cancelable

    @Override
    public boolean cancel(final boolean mayInterruptedIfRunning) {
      Cancelable cancel = getCancel();
      if (cancel != null) {
        s_logger.debug("Cancelling {} for job {}", _cancel, _job);
        return cancel.cancel(mayInterruptedIfRunning);
      } else {
        return false;
      }
    }
View Full Code Here

Examples of edu.indiana.extreme.xbaya.gui.Cancelable

        }
      }

      this.notifier.workflowTerminated();
      if (this.mode == GUI_MODE) {
        final WaitDialog waitDialog = new WaitDialog(new Cancelable() {
          @Override
          public void cancel() {
            // Do nothing
          }
        }, "Stop Workflow", "Cleaning up resources for Workflow", this.engine);
View Full Code Here

Examples of edu.indiana.extreme.xbaya.gui.Cancelable

     * @throws InterruptedException
     *
     */
    public void testShowHide() throws InterruptedException {
        XBayaEngine engine = new XBayaEngine(this.configuration);
        Cancelable cancelable = new Cancelable() {
            public void cancel() {
                // Nothing
            }
        };
        final WaitDialog dialog = new WaitDialog(cancelable, "title",
View Full Code Here

Examples of edu.indiana.extreme.xbaya.gui.Cancelable

     * @throws InterruptedException
     *
     */
    public void testShowShowHide() throws InterruptedException {
        XBayaEngine engine = new XBayaEngine(this.configuration);
        Cancelable cancelable = new Cancelable() {
            public void cancel() {
                // Nothing
            }
        };
        final WaitDialog dialog = new WaitDialog(cancelable, "title",
View Full Code Here

Examples of edu.indiana.extreme.xbaya.gui.Cancelable

     * @throws InterruptedException
     *
     */
    public void testShowHideShowHide() throws InterruptedException {
        XBayaEngine engine = new XBayaEngine(this.configuration);
        Cancelable cancelable = new Cancelable() {
            public void cancel() {
                // Nothing
            }
        };
        final WaitDialog dialog = new WaitDialog(cancelable, "title",
View Full Code Here

Examples of edu.indiana.extreme.xbaya.gui.Cancelable

    /**
     * @throws InterruptedException
     */
    public void testShowHideHide() throws InterruptedException {
        XBayaEngine engine = new XBayaEngine(this.configuration);
        Cancelable cancelable = new Cancelable() {
            public void cancel() {
                // Nothing
            }
        };
        final WaitDialog dialog = new WaitDialog(cancelable, "title",
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.