use of com.hazelcast.spi.impl.InternalCompletableFuture in project hazelcast by hazelcast.
the class CacheCreateConfigMessageTask method processMessage.
@Override
protected void processMessage() {
// parameters.cacheConfig is not nullable by protocol definition, hence no need for null check
CacheConfig cacheConfig = parameters.cacheConfig.asCacheConfig(serializationService);
CacheService cacheService = getService(CacheService.SERVICE_NAME);
SplitBrainMergePolicyProvider mergePolicyProvider = nodeEngine.getSplitBrainMergePolicyProvider();
checkCacheConfig(cacheConfig, mergePolicyProvider);
InternalCompletableFuture future = cacheService.createCacheConfigOnAllMembersAsync(PreJoinCacheConfig.of(cacheConfig));
future.whenCompleteAsync(this);
}
use of com.hazelcast.spi.impl.InternalCompletableFuture in project hazelcast by hazelcast.
the class TransferLeadershipOp method call.
@Override
public CallStatus call() throws Exception {
RaftService service = getService();
InternalCompletableFuture future = service.transferLeadership(groupId, (CPMemberInfo) destination);
future.whenCompleteAsync(this);
return CallStatus.VOID;
}
use of com.hazelcast.spi.impl.InternalCompletableFuture in project hazelcast by hazelcast.
the class RaftNodeImpl method query.
@Override
public InternalCompletableFuture query(Object operation, QueryPolicy queryPolicy) {
InternalCompletableFuture resultFuture = raftIntegration.newCompletableFuture();
raftIntegration.execute(new QueryTask(this, operation, queryPolicy, resultFuture));
return resultFuture;
}
use of com.hazelcast.spi.impl.InternalCompletableFuture in project hazelcast by hazelcast.
the class RaftNodeImpl method invalidateFuturesFrom.
/**
* Invalidates futures registered with indexes {@code >= entryIndex}. Note that {@code entryIndex} is inclusive.
* {@link LeaderDemotedException} is set a result to futures.
*/
public void invalidateFuturesFrom(long entryIndex) {
int count = 0;
Iterator<Entry<Long, InternalCompletableFuture>> iterator = futures.entrySet().iterator();
while (iterator.hasNext()) {
Entry<Long, InternalCompletableFuture> entry = iterator.next();
long index = entry.getKey();
if (index >= entryIndex) {
entry.getValue().completeExceptionally(new LeaderDemotedException(state.localEndpoint(), state.leader()));
iterator.remove();
count++;
}
}
if (count > 0) {
logger.warning("Invalidated " + count + " futures from log index: " + entryIndex);
}
}
use of com.hazelcast.spi.impl.InternalCompletableFuture in project hazelcast by hazelcast.
the class RaftNodeImpl method replicate.
@Override
public InternalCompletableFuture replicate(Object operation) {
InternalCompletableFuture resultFuture = raftIntegration.newCompletableFuture();
execute(new ReplicateTask(this, operation, resultFuture));
return resultFuture;
}
Aggregations