Search in sources :

Example 36 with MapOperation

use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.

the class MapReplaceMessageTask method prepareOperation.

@Override
protected Operation prepareOperation() {
    MapOperationProvider operationProvider = getMapOperationProvider(parameters.name);
    MapOperation op = operationProvider.createReplaceOperation(parameters.name, parameters.key, parameters.value);
    op.setThreadId(parameters.threadId);
    return op;
}
Also used : MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 37 with MapOperation

use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.

the class MapProxySupport method deleteInternal.

protected void deleteInternal(Data key) {
    MapOperation operation = operationProvider.createDeleteOperation(name, key);
    invokeOperation(key, operation);
}
Also used : MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 38 with MapOperation

use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.

the class MapProxySupport method containsKeyInternal.

protected boolean containsKeyInternal(Data key) {
    int partitionId = partitionService.getPartitionId(key);
    MapOperation containsKeyOperation = operationProvider.createContainsKeyOperation(name, key);
    containsKeyOperation.setThreadId(ThreadUtil.getThreadId());
    containsKeyOperation.setServiceName(SERVICE_NAME);
    try {
        Future future = operationService.invokeOnPartition(SERVICE_NAME, containsKeyOperation, partitionId);
        return (Boolean) toObject(future.get());
    } catch (Throwable t) {
        throw rethrow(t);
    }
}
Also used : Future(java.util.concurrent.Future) InternalCompletableFuture(com.hazelcast.spi.InternalCompletableFuture) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 39 with MapOperation

use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.

the class MapProxySupport method executeOnKeyInternal.

public InternalCompletableFuture<Object> executeOnKeyInternal(Data key, EntryProcessor entryProcessor, ExecutionCallback<Object> callback) {
    int partitionId = partitionService.getPartitionId(key);
    MapOperation operation = operationProvider.createEntryOperation(name, key, entryProcessor);
    operation.setThreadId(ThreadUtil.getThreadId());
    try {
        if (callback == null) {
            return operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
        } else {
            return operationService.createInvocationBuilder(SERVICE_NAME, operation, partitionId).setExecutionCallback(new MapExecutionCallbackAdapter(callback)).invoke();
        }
    } catch (Throwable t) {
        throw rethrow(t);
    }
}
Also used : MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 40 with MapOperation

use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.

the class TransactionalMapProxySupport method putInternal.

public Data putInternal(Data key, Data value, long ttl, TimeUnit timeUnit) {
    VersionedValue versionedValue = lockAndGet(key, tx.getTimeoutMillis());
    long timeInMillis = getTimeInMillis(ttl, timeUnit);
    MapOperation operation = operationProvider.createTxnSetOperation(name, key, value, versionedValue.version, timeInMillis);
    tx.add(new MapTransactionLogRecord(name, key, getPartitionId(key), operation, versionedValue.version, tx.getOwnerUuid()));
    return versionedValue.value;
}
Also used : MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Aggregations

MapOperation (com.hazelcast.map.impl.operation.MapOperation)80 MapOperationProvider (com.hazelcast.map.impl.operation.MapOperationProvider)25 Data (com.hazelcast.internal.serialization.Data)23 Future (java.util.concurrent.Future)16 Data (com.hazelcast.nio.serialization.Data)6 ArrayList (java.util.ArrayList)5 InternalCompletableFuture (com.hazelcast.spi.impl.InternalCompletableFuture)4 SerializationService (com.hazelcast.internal.serialization.SerializationService)3 MapService (com.hazelcast.map.impl.MapService)3 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)3 InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)3 AbstractDistributedObject (com.hazelcast.spi.impl.AbstractDistributedObject)3 InitializingObject (com.hazelcast.spi.impl.InitializingObject)3 InternalCompletableFuture.newCompletedFuture (com.hazelcast.spi.impl.InternalCompletableFuture.newCompletedFuture)3 InvocationFuture (com.hazelcast.spi.impl.operationservice.impl.InvocationFuture)3 OperationServiceImpl (com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)3 List (java.util.List)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 EntryView (com.hazelcast.core.EntryView)2 EntryProcessor (com.hazelcast.map.EntryProcessor)2