Search in sources :

Example 11 with InternalCompletableFuture

use of com.hazelcast.spi.InternalCompletableFuture in project hazelcast by hazelcast.

the class MapProxyImpl method submitToKey.

@Override
public ICompletableFuture submitToKey(K key, EntryProcessor entryProcessor) {
    checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
    MapService service = getService();
    Data keyData = toData(key, partitionStrategy);
    InternalCompletableFuture f = executeOnKeyInternal(keyData, entryProcessor, null);
    return new DelegatingFuture(f, service.getMapServiceContext().getNodeEngine().getSerializationService());
}
Also used : InternalCompletableFuture(com.hazelcast.spi.InternalCompletableFuture) Data(com.hazelcast.nio.serialization.Data) MapService(com.hazelcast.map.impl.MapService) DelegatingFuture(com.hazelcast.util.executor.DelegatingFuture)

Example 12 with InternalCompletableFuture

use of com.hazelcast.spi.InternalCompletableFuture in project hazelcast by hazelcast.

the class MemberMapMetaDataFetcher method scanMembers.

@Override
protected List<InternalCompletableFuture> scanMembers(List<String> names) {
    Collection<Member> members = clusterService.getMembers(DATA_MEMBER_SELECTOR);
    List<InternalCompletableFuture> futures = new ArrayList<InternalCompletableFuture>(members.size());
    for (Member member : members) {
        Operation operation = new MapGetInvalidationMetaDataOperation(names);
        Address address = member.getAddress();
        try {
            futures.add(operationService.invokeOnTarget(SERVICE_NAME, operation, address));
        } catch (Exception e) {
            if (logger.isWarningEnabled()) {
                logger.warning("Cant fetch invalidation meta-data from address + " + address + " + [" + e.getMessage() + "]");
            }
        }
    }
    return futures;
}
Also used : Address(com.hazelcast.nio.Address) InternalCompletableFuture(com.hazelcast.spi.InternalCompletableFuture) ArrayList(java.util.ArrayList) Operation(com.hazelcast.spi.Operation) MapGetInvalidationMetaDataOperation(com.hazelcast.map.impl.operation.MapGetInvalidationMetaDataOperation) MapGetInvalidationMetaDataOperation(com.hazelcast.map.impl.operation.MapGetInvalidationMetaDataOperation) Member(com.hazelcast.core.Member) TimeoutException(java.util.concurrent.TimeoutException) ExecutionException(java.util.concurrent.ExecutionException)

Example 13 with InternalCompletableFuture

use of com.hazelcast.spi.InternalCompletableFuture in project hazelcast by hazelcast.

the class InvocationBuilderImpl method invoke.

@Override
public InternalCompletableFuture invoke() {
    op.setServiceName(serviceName);
    Invocation invocation;
    if (target == null) {
        op.setPartitionId(partitionId).setReplicaIndex(replicaIndex);
        invocation = new PartitionInvocation(context, op, doneCallback, tryCount, tryPauseMillis, callTimeout, resultDeserialized);
    } else {
        invocation = new TargetInvocation(context, op, target, doneCallback, tryCount, tryPauseMillis, callTimeout, resultDeserialized);
    }
    InternalCompletableFuture future = invocation.invoke();
    if (executionCallback != null) {
        future.andThen(executionCallback);
    }
    return future;
}
Also used : InternalCompletableFuture(com.hazelcast.spi.InternalCompletableFuture)

Example 14 with InternalCompletableFuture

use of com.hazelcast.spi.InternalCompletableFuture in project hazelcast by hazelcast.

the class CountDownLatchProxy method countDown.

@Override
public void countDown() {
    Operation op = new CountDownOperation(name).setPartitionId(partitionId);
    InternalCompletableFuture f = invokeOnPartition(op);
    f.join();
}
Also used : CountDownOperation(com.hazelcast.concurrent.countdownlatch.operations.CountDownOperation) InternalCompletableFuture(com.hazelcast.spi.InternalCompletableFuture) CountDownOperation(com.hazelcast.concurrent.countdownlatch.operations.CountDownOperation) Operation(com.hazelcast.spi.Operation) GetCountOperation(com.hazelcast.concurrent.countdownlatch.operations.GetCountOperation) AwaitOperation(com.hazelcast.concurrent.countdownlatch.operations.AwaitOperation) SetCountOperation(com.hazelcast.concurrent.countdownlatch.operations.SetCountOperation)

Example 15 with InternalCompletableFuture

use of com.hazelcast.spi.InternalCompletableFuture in project hazelcast by hazelcast.

the class ConditionImpl method signal.

private void signal(boolean all) {
    long threadId = ThreadUtil.getThreadId();
    Data key = lockProxy.getKeyData();
    SignalOperation op = new SignalOperation(namespace, key, threadId, conditionId, all);
    InternalCompletableFuture f = invoke(op);
    f.join();
}
Also used : SignalOperation(com.hazelcast.concurrent.lock.operations.SignalOperation) InternalCompletableFuture(com.hazelcast.spi.InternalCompletableFuture) Data(com.hazelcast.nio.serialization.Data)

Aggregations

InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)17 Operation (com.hazelcast.spi.Operation)6 Data (com.hazelcast.nio.serialization.Data)5 ArrayList (java.util.ArrayList)5 ExecutionException (java.util.concurrent.ExecutionException)5 TimeoutException (java.util.concurrent.TimeoutException)5 Member (com.hazelcast.core.Member)4 Address (com.hazelcast.nio.Address)3 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)2 ClientInvocation (com.hazelcast.client.spi.impl.ClientInvocation)2 InvocationBuilder (com.hazelcast.spi.InvocationBuilder)2 OperationService (com.hazelcast.spi.OperationService)2 CacheCreateConfigOperation (com.hazelcast.cache.impl.operation.CacheCreateConfigOperation)1 AwaitOperation (com.hazelcast.concurrent.countdownlatch.operations.AwaitOperation)1 CountDownOperation (com.hazelcast.concurrent.countdownlatch.operations.CountDownOperation)1 GetCountOperation (com.hazelcast.concurrent.countdownlatch.operations.GetCountOperation)1 SetCountOperation (com.hazelcast.concurrent.countdownlatch.operations.SetCountOperation)1 BeforeAwaitOperation (com.hazelcast.concurrent.lock.operations.BeforeAwaitOperation)1 SignalOperation (com.hazelcast.concurrent.lock.operations.SignalOperation)1 AcquireOperation (com.hazelcast.concurrent.semaphore.operations.AcquireOperation)1