/** {@inheritDoc} */ @Override public void suspend() { suspendFut = new GridFutureAdapter<>(); }
/** {@inheritDoc} */ @Override public void onReconnected() { startFut = new GridFutureAdapter<>(); }
/** * Initiate request processing. * @param req Request. * @return Future to track request processing. */ GridFutureAdapter<ClientListenerResponse> process(OdbcRequest req) { GridFutureAdapter<ClientListenerResponse> fut = new GridFutureAdapter<>(); queue.add(new T2<>(req, fut)); return fut; } }
/** * Initiate request processing. * @param req Request. * @return Future to track request processing. */ GridFutureAdapter<ClientListenerResponse> process(JdbcRequest req) { GridFutureAdapter<ClientListenerResponse> fut = new GridFutureAdapter<>(); queue.add(new T2<>(req, fut)); return fut; } }
/** * @param grp Cache group. */ public GridDhtPreloader(CacheGroupContext grp) { super(grp); top = grp.topology(); startFut = new GridFutureAdapter<>(); }
/** * Await specific schema update. * @param typeId Type id. * @param schemaId Schema id. * @return Future which will be completed when schema is received. */ GridFutureAdapter<?> awaitSchemaUpdate(int typeId, int schemaId) { GridFutureAdapter<Object> fut = new GridFutureAdapter<>(); // Use version for schemaId. GridFutureAdapter<?> oldFut = schemaWaitFuts.putIfAbsent(new SyncKey(typeId, schemaId), fut); return oldFut == null ? fut : oldFut; }
/** * Gracefully stops worker by adding STOP_INFO to queue. */ private void stop() { delReqs.offer(F.t(new GridFutureAdapter<>(), stopInfo)); }
/** * @param info File info to delete. * @return Future which completes when entry is actually removed. */ private IgniteInternalFuture<Object> deleteAsync(IgfsEntryInfo info) { GridFutureAdapter<Object> fut = new GridFutureAdapter<>(); delReqs.offer(F.t(fut, info)); return fut; }
/** * For test use only. */ public IgniteInternalFuture<Void> enableCheckpoints(boolean enable) { GridFutureAdapter<Void> fut = new GridFutureAdapter<>(); enableChangeApplied = fut; checkpointsEnabled = enable; wakeupForCheckpoint("enableCheckpoints()"); return fut; }
/** * Creates a new index rebuild future that should be completed later after exchange is done. The future * has to be created before exchange is initialized to guarantee that we will capture a correct future * after activation or restore completes. * If there was an old future for the given ID, it will be completed. * * @param cacheId Cache ID. */ private void prepareIndexRebuildFuture(int cacheId) { GridFutureAdapter<Void> old = idxRebuildFuts.put(cacheId, new GridFutureAdapter<>()); if (old != null) old.onDone(); }
/** * Creates data load future and register its as active future. * @return Data load future. */ @NotNull protected IgniteCacheFutureImpl createDataLoadFuture() { GridFutureAdapter internalFut0 = new GridFutureAdapter(); IgniteCacheFutureImpl fut = new IgniteCacheFutureImpl(internalFut0); internalFut0.listen(rmvActiveFut); activeFuts.add(internalFut0); return fut; }
/** * Formats the file system removing all existing entries from it. * * @return Future. */ IgniteInternalFuture<?> clearAsync0() { GridFutureAdapter<?> fut = new GridFutureAdapter<>(); Thread t = new Thread(new FormatRunnable(fut), "igfs-format-" + cfg.getName() + "-" + FORMAT_THREAD_IDX_GEN.incrementAndGet()); t.setDaemon(true); t.start(); return fut; }
/** * Future wrapper which ignores any underlying future errors. * * @param f Underlying future. * @return Future wrapper which ignore any underlying future errors. */ private IgniteInternalFuture ignoreErrors(IgniteInternalFuture<?> f) { GridFutureAdapter<?> wrapper = new GridFutureAdapter(); f.listen(future -> wrapper.onDone()); return wrapper; }
/** * Basically the same as {@link #startWrite(String, byte[])} but for CAS operations. */ private boolean startCas(String key, byte[] expValBytes, byte[] newValBytes) throws IgniteCheckedException { UUID reqId = UUID.randomUUID(); GridFutureAdapter<Boolean> fut = new GridFutureAdapter<>(); updateFuts.put(reqId, fut); DiscoveryCustomMessage msg = new DistributedMetaStorageCasMessage(reqId, key, expValBytes, newValBytes); ctx.discovery().sendCustomEvent(msg); return fut.get(); }
/** * @param ctx Cache context. * @param qry Query. */ public GridCacheLocalFieldsQueryFuture(GridCacheContext<?, ?> ctx, GridCacheQueryBean qry) { super((GridCacheContext<Object, Object>)ctx, qry); metaFut = new GridFutureAdapter<>(); if (!qry.query().includeMetadata()) metaFut.onDone(); }
/** */ RebalanceBlockingSPI() { resumeRebalanceFutures.put(CU.cacheId(GROUP_1), new GridFutureAdapter()); resumeRebalanceFutures.put(CU.cacheId(GROUP_2), new GridFutureAdapter()); suspendRebalanceInMiddleLatch.put(CU.cacheId(GROUP_1), new CountDownLatch(3)); suspendRebalanceInMiddleLatch.put(CU.cacheId(GROUP_2), new CountDownLatch(3)); }
@Override public Object call() throws Exception { GridFutureAdapter<String> fut = new GridFutureAdapter<>(); fut.onCancelled(); return fut.get(); } }, IgniteFutureCancelledCheckedException.class, null);
/** {@inheritDoc} */ @Override public IgniteInternalFuture<?> removeAllAsync() { GridFutureAdapter<Void> opFut = new GridFutureAdapter<>(); AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion(); CacheOperationContext opCtx = ctx.operationContextPerCall(); removeAllAsync(opFut, topVer, opCtx != null && opCtx.skipStore(), opCtx != null && opCtx.isKeepBinary()); return opFut; }
@Override public Object call() throws Exception { GridFutureAdapter<String> fut = new GridFutureAdapter<>(); fut.onCancelled(); fut.onDone(); return fut.get(); } }, IgniteFutureCancelledCheckedException.class, null);
/** * @throws Exception If failed. */ @Test public void testFutureGet() throws Exception { GridFutureAdapter<String> fut0 = new GridFutureAdapter<>(); IgniteFutureImpl<String> fut = createFuture(fut0); assertFalse(fut.isDone()); U.sleep(100); fut0.onDone("test"); assertEquals("test", fut.get()); assertTrue(fut.isDone()); }