/** * @param res Result to convert to finished future. */ private void save(Object res) { asyncRes = new IgniteFinishedFutureImpl<>(res); }
/** {@inheritDoc} */ @Override public IgniteFuture<?> mapFuture() { return new IgniteFinishedFutureImpl<>(null); }
@Override public IgniteFuture<?> mapFuture() { return new IgniteFinishedFutureImpl<Object>(); } };
/** {@inheritDoc} */ @Override public <R> IgniteFuture<R> future() { // Return fake future. Future should be called in the same place where operation done. return new IgniteFinishedFutureImpl<>(); }
/** * @return Client reconnect future. */ public IgniteFuture<?> clientReconnectFuture() { IgniteFuture<?> fut = cluster.clientReconnectFuture(); return fut != null ? fut : new IgniteFinishedFutureImpl<>(); }
/** {@inheritDoc} */ @Override public IgniteFuture<?> onDiscovery( int type, long topVer, ClusterNode node, Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>> topHist, @Nullable DiscoverySpiCustomMessage data ) { if (type == EVT_NODE_METRICS_UPDATED) isMetricsUpdate = true; return new IgniteFinishedFutureImpl<>(); } }
@SuppressWarnings({"NakedNotify"}) @Override public IgniteFuture<?> onDiscovery( int type, long topVer, ClusterNode node, Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>> topHist, @Nullable DiscoverySpiCustomMessage data ) { info("Discovery event [type=" + type + ", node=" + node + ']'); synchronized (mux) { mux.notifyAll(); } return new IgniteFinishedFutureImpl<>(); } });
@Override public void apply(IgniteServiceProcessor srvcProc) { srvcProc.onDisconnected(new IgniteFinishedFutureImpl<>()); } }
@Override public void apply(IgniteServiceProcessor srvcProc) { srvcProc.onDisconnected(new IgniteFinishedFutureImpl<>()); } },
return new IgniteFinishedFutureImpl<>(transitionRes); else { GridFutureAdapter<Void> fut = transitionFuts.get(globalState.transitionRequestId()); return new IgniteFinishedFutureImpl<>(globalState.baselineChanged()); return new IgniteFinishedFutureImpl<>(transitionRes); return new IgniteFinishedFutureImpl<>(globalState.active());
@Override public IgniteFuture<?> onDiscovery(int type, long topVer, ClusterNode node, Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>> topHist, @Nullable DiscoverySpiCustomMessage data) { // If METRICS_UPDATED came from local node if (type == EVT_NODE_METRICS_UPDATED && node.id().equals(spi.getLocalNode().id())) spiCnt.addAndGet(1); return new IgniteFinishedFutureImpl<>(); } };
/** {@inheritDoc} */ @Override public IgniteFuture<BitSet> checkConnection(List<ClusterNode> nodes) { CountDownLatch pingStartLatch = this.pingStartLatch; if (pingStartLatch != null) pingStartLatch.countDown(); CountDownLatch pingLatch = this.pingLatch; try { if (pingLatch != null) pingLatch.await(); } catch (InterruptedException e) { throw new IgniteException(e); } BitSet checkRes = this.checkRes; if (checkRes != null) { this.checkRes = null; return new IgniteFinishedFutureImpl<>(checkRes); } return super.checkConnection(nodes); } }
/** {@inheritDoc} */ @Override public IgniteFuture<?> onDiscovery( int type, long topVer, ClusterNode node, Collection<ClusterNode> topSnapshot, @Nullable Map<Long, Collection<ClusterNode>> topHist, @Nullable DiscoverySpiCustomMessage spiCustomMsg ) { DiscoveryCustomMessage customMsg = spiCustomMsg == null ? null : (DiscoveryCustomMessage) U.field(spiCustomMsg, "delegate"); if (customMsg != null) { //don't want to make this class public, using equality of class name instead of instanceof operator if ("MappingProposedMessage".equals(customMsg.getClass().getSimpleName())) { String conflClsName = U.field(customMsg, "conflictingClsName"); if (conflClsName != null && !conflClsName.isEmpty()) { rejectObserved = true; if (conflClsName.contains(Aa.class.getSimpleName())) bbClsRejected = true; else if (conflClsName.contains(BB.class.getSimpleName())) aaClsRejected = true; } } } if (delegate != null) return delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg); return new IgniteFinishedFutureImpl<>(); }
/** {@inheritDoc} */ @Override public IgniteFuture<?> indexReadyFuture() { GridCacheContext<K, V> ctx = getContextSafe(); IgniteInternalFuture fut = ctx.shared().database().indexRebuildFuture(ctx.cacheId()); if (fut == null) return new IgniteFinishedFutureImpl<>(); return new IgniteFutureImpl<>(fut); }
/** {@inheritDoc} */ @Override public IgniteFuture<BitSet> checkConnection(List<ClusterNode> nodes) { // Creates connections statuses according to failure matrix. BitSet bitSet = new BitSet(); ClusterNode locNode = getLocalNode(); int idx = 0; for (ClusterNode remoteNode : nodes) { if (locNode.id().equals(remoteNode.id())) bitSet.set(idx); else { if (matrix.hasConnection(locNode, remoteNode)) bitSet.set(idx); } idx++; } return new IgniteFinishedFutureImpl<>(bitSet); }
/** {@inheritDoc} */ @Override public IgniteFuture<?> onDiscovery( int type, long topVer, ClusterNode node, Collection<ClusterNode> topSnapshot, @Nullable Map<Long, Collection<ClusterNode>> topHist, @Nullable DiscoverySpiCustomMessage spiCustomMsg ) { if (EventType.EVT_NODE_METRICS_UPDATED == type) { log.info("Metrics update message catched from node " + node); assertFalse(locNode.isClient()); if (node.isClient()) clientMetricsUpdateCnt++; } if (delegate != null) return delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg); return new IgniteFinishedFutureImpl<>(); }
/** {@inheritDoc} */ @Override public IgniteFuture<?> onDiscovery( int type, long topVer, ClusterNode node, Collection<ClusterNode> topSnapshot, @Nullable Map<Long, Collection<ClusterNode>> topHist, @Nullable DiscoverySpiCustomMessage spiCustomMsg ) { DiscoveryCustomMessage customMsg = spiCustomMsg == null ? null : (DiscoveryCustomMessage) U.field(spiCustomMsg, "delegate"); if (customMsg != null) { //don't want to make this class public, using equality of class name instead of instanceof operator if ("MappingProposedMessage".equals(customMsg.getClass().getSimpleName())) { try { isDuplicateObserved = U.invoke(MappingProposedMessage.class, customMsg, "duplicated"); } catch (Exception e) { log().error("Error when examining MappingProposedMessage.", e); } } } if (delegate != null) return delegate.onDiscovery(type, topVer, node, topSnapshot, topHist, spiCustomMsg); return new IgniteFinishedFutureImpl<>(); }
/** * Check cluster state. * * @return Cluster state, {@code True} if cluster active, {@code False} if inactive. */ private IgniteFuture<Boolean> sendComputeCheckGlobalState() { AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx(); if (log.isInfoEnabled()) { log.info("Sending check cluster state request from node [id=" + ctx.localNodeId() + ", topVer=" + topVer + ", client=" + ctx.clientNode() + ", daemon" + ctx.isDaemon() + "]"); } ClusterGroupAdapter clusterGroupAdapter = (ClusterGroupAdapter)ctx.cluster().get().forServers(); if (F.isEmpty(clusterGroupAdapter.nodes())) return new IgniteFinishedFutureImpl<>(false); IgniteCompute comp = clusterGroupAdapter.compute(); return comp.callAsync(new IgniteCallable<Boolean>() { @IgniteInstanceResource private Ignite ig; @Override public Boolean call() throws Exception { return ig.active(); } }); }
return new IgniteFinishedFutureImpl<>("immediately");
/** * @param res Result to convert to finished future. */ private void save(Object res) { asyncRes = new IgniteFinishedFutureImpl<>(res); }