Search in sources :

Example 1 with ApplyOp

use of com.hazelcast.cp.internal.datastructures.atomicref.operation.ApplyOp in project hazelcast by hazelcast.

the class AtomicRefProxy method applyAsync.

@Override
public <R> InternalCompletableFuture<R> applyAsync(IFunction<T, R> function) {
    checkTrue(function != null, "Function cannot be null");
    RaftOp op = new ApplyOp(objectName, toData(function), RETURN_NEW_VALUE, false);
    return invocationManager.query(groupId, op, LINEARIZABLE);
}
Also used : RaftOp(com.hazelcast.cp.internal.RaftOp) ApplyOp(com.hazelcast.cp.internal.datastructures.atomicref.operation.ApplyOp)

Example 2 with ApplyOp

use of com.hazelcast.cp.internal.datastructures.atomicref.operation.ApplyOp in project hazelcast by hazelcast.

the class ApplyMessageTask method processMessage.

@Override
protected void processMessage() {
    ReturnValueType returnValueType = ReturnValueType.fromValue(parameters.returnValueType);
    CPGroupId groupId = parameters.groupId;
    RaftOp op = new ApplyOp(parameters.name, parameters.function, returnValueType, parameters.alter);
    if (parameters.alter) {
        invoke(groupId, op);
    } else {
        query(groupId, op, LINEARIZABLE);
    }
}
Also used : CPGroupId(com.hazelcast.cp.CPGroupId) ReturnValueType(com.hazelcast.cp.internal.datastructures.atomicref.operation.ApplyOp.ReturnValueType) RaftOp(com.hazelcast.cp.internal.RaftOp) ApplyOp(com.hazelcast.cp.internal.datastructures.atomicref.operation.ApplyOp)

Aggregations

RaftOp (com.hazelcast.cp.internal.RaftOp)2 ApplyOp (com.hazelcast.cp.internal.datastructures.atomicref.operation.ApplyOp)2 CPGroupId (com.hazelcast.cp.CPGroupId)1 ReturnValueType (com.hazelcast.cp.internal.datastructures.atomicref.operation.ApplyOp.ReturnValueType)1