Tabnine Logo
GridCompoundFuture.isCancelled
Code IndexAdd Tabnine to your IDE (free)

How to use
isCancelled
method
in
org.apache.ignite.internal.util.future.GridCompoundFuture

Best Java code snippets using org.apache.ignite.internal.util.future.GridCompoundFuture.isCancelled (Showing top 7 results out of 315)

origin: apache/ignite

/**
 * Adds a future to this compound future.
 *
 * @param fut Future to add.
 */
public final void add(IgniteInternalFuture<T> fut) {
  assert fut != null;
  synchronized (this) {
    if (futs == null)
      futs = fut;
    else if (futs instanceof IgniteInternalFuture) {
      Collection<IgniteInternalFuture> futs0 = new ArrayList<>(4);
      futs0.add((IgniteInternalFuture)futs);
      futs0.add(fut);
      futs = futs0;
    }
    else
      ((Collection<IgniteInternalFuture>)futs).add(fut);
  }
  fut.listen(this);
  if (isCancelled()) {
    try {
      fut.cancel();
    }
    catch (IgniteCheckedException e) {
      onDone(e);
    }
  }
}
origin: apache/ignite

  /** {@inheritDoc} */
  @Override public String toString() {
    return S.toString(GridCompoundFuture.class, this,
      "done", isDone(),
      "cancelled", isCancelled(),
      "err", error(),
      "futs",
      F.viewReadOnly(futures(), new C1<IgniteInternalFuture<T>, String>() {
        @Override public String apply(IgniteInternalFuture<T> f) {
          return Boolean.toString(f.isDone());
        }
      })
    );
  }
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testCompleteOnReducer() throws Exception {
  GridCompoundFuture<Boolean, Boolean> fut = new GridCompoundFuture<>(CU.boolReducer());
  List<GridFutureAdapter<Boolean>> futs = new ArrayList<>(5);
  for (int i = 0; i < 5; i++) {
    GridFutureAdapter<Boolean> part = new GridFutureAdapter<>();
    fut.add(part);
    futs.add(part);
  }
  fut.markInitialized();
  assertFalse(fut.isDone());
  assertFalse(fut.isCancelled());
  for (int i = 0; i < 3; i++) {
    futs.get(i).onDone(true);
    assertFalse(fut.isDone());
  }
  futs.get(3).onDone(false);
  assertTrue(fut.isDone());
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testCompleteOnException() throws Exception {
  GridCompoundFuture<Boolean, Boolean> fut = new GridCompoundFuture<>(CU.boolReducer());
  List<GridFutureAdapter<Boolean>> futs = new ArrayList<>(5);
  for (int i = 0; i < 5; i++) {
    GridFutureAdapter<Boolean> part = new GridFutureAdapter<>();
    fut.add(part);
    futs.add(part);
  }
  fut.markInitialized();
  assertFalse(fut.isDone());
  assertFalse(fut.isCancelled());
  for (int i = 0; i < 3; i++) {
    futs.get(i).onDone(true);
    assertFalse(fut.isDone());
  }
  futs.get(3).onDone(new IgniteCheckedException("Test message"));
  assertTrue(fut.isDone());
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testMarkInitialized() throws Exception {
  GridCompoundFuture<Boolean, Boolean> fut = new GridCompoundFuture<>();
  for (int i = 0; i < 5; i++) {
    IgniteInternalFuture<Boolean> part = new GridFinishedFuture<>(true);
    fut.add(part);
  }
  assertFalse(fut.isDone());
  assertFalse(fut.isCancelled());
  fut.markInitialized();
  assertTrue(fut.isDone());
}
origin: org.apache.ignite/ignite-core

/**
 * Adds a future to this compound future.
 *
 * @param fut Future to add.
 */
@SuppressWarnings("unchecked")
public final void add(IgniteInternalFuture<T> fut) {
  assert fut != null;
  synchronized (this) {
    if (futs == null)
      futs = fut;
    else if (futs instanceof IgniteInternalFuture) {
      Collection<IgniteInternalFuture> futs0 = new ArrayList<>(4);
      futs0.add((IgniteInternalFuture)futs);
      futs0.add(fut);
      futs = futs0;
    }
    else
      ((Collection<IgniteInternalFuture>)futs).add(fut);
  }
  fut.listen(this);
  if (isCancelled()) {
    try {
      fut.cancel();
    }
    catch (IgniteCheckedException e) {
      onDone(e);
    }
  }
}
origin: org.apache.ignite/ignite-core

  /** {@inheritDoc} */
  @Override public String toString() {
    return S.toString(GridCompoundFuture.class, this,
      "done", isDone(),
      "cancelled", isCancelled(),
      "err", error(),
      "futs",
      F.viewReadOnly(futures(), new C1<IgniteInternalFuture<T>, String>() {
        @Override public String apply(IgniteInternalFuture<T> f) {
          return Boolean.toString(f.isDone());
        }
      })
    );
  }
}
org.apache.ignite.internal.util.futureGridCompoundFutureisCancelled

Popular methods of GridCompoundFuture

  • <init>
  • add
    Adds a future to this compound future.
  • markInitialized
    Mark this future as initialized.
  • get
  • isDone
  • cancel
  • chain
  • checkComplete
    Check completeness of the future.
  • error
  • future
    Returns future at the specified position in this list.
  • futures
    Gets collection of futures.
  • futuresCount
  • futures,
  • futuresCount,
  • futuresCountNoLock,
  • ignoreFailure,
  • initialized,
  • listen,
  • logDebug,
  • logError,
  • logger

Popular in Java

  • Making http post requests using okhttp
  • findViewById (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • getResourceAsStream (ClassLoader)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • JOptionPane (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now