Search in sources :

Example 1 with Invocation

use of com.hazelcast.spi.impl.operationservice.impl.Invocation in project hazelcast by hazelcast.

the class InvocationPlugin method runCurrent.

private void runCurrent(DiagnosticsLogWriter writer, long now) {
    writer.startSection("Pending");
    int count = 0;
    boolean maxPrinted = false;
    for (Invocation invocation : invocationRegistry) {
        long durationMs = now - invocation.firstInvocationTimeMillis;
        String operationDesc = toOperationDesc(invocation.op);
        occurrences.add(operationDesc, 1);
        if (durationMs < thresholdMillis) {
            // short invocation, lets move on to the next.
            continue;
        }
        // it is a slow invocation.
        count++;
        if (count < maxCount) {
            writer.writeEntry(invocation.toString() + " duration=" + durationMs + " ms");
        } else if (!maxPrinted) {
            maxPrinted = true;
            writer.writeEntry("max number of invocations to print reached.");
        }
        slowOccurrences.add(operationDesc, 1);
    }
    writer.endSection();
}
Also used : Invocation(com.hazelcast.spi.impl.operationservice.impl.Invocation)

Example 2 with Invocation

use of com.hazelcast.spi.impl.operationservice.impl.Invocation in project hazelcast by hazelcast.

the class RaftInvocationManager method invoke.

public <T> InternalCompletableFuture<T> invoke(CPGroupId groupId, RaftOp raftOp, boolean deserializeResponse) {
    if (cpSubsystemEnabled) {
        Operation operation = new DefaultRaftReplicateOp(groupId, raftOp);
        Invocation invocation = new RaftInvocation(operationService.getInvocationContext(), raftInvocationContext, groupId, operation, invocationMaxRetryCount, invocationRetryPauseMillis, operationCallTimeout, deserializeResponse);
        return invocation.invoke();
    }
    return invokeOnPartition(new UnsafeRaftReplicateOp(groupId, raftOp), deserializeResponse);
}
Also used : RaftInvocation(com.hazelcast.spi.impl.operationservice.impl.RaftInvocation) Invocation(com.hazelcast.spi.impl.operationservice.impl.Invocation) RaftInvocation(com.hazelcast.spi.impl.operationservice.impl.RaftInvocation) Operation(com.hazelcast.spi.impl.operationservice.Operation) DefaultRaftReplicateOp(com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp) UnsafeRaftReplicateOp(com.hazelcast.cp.internal.operation.unsafe.UnsafeRaftReplicateOp)

Example 3 with Invocation

use of com.hazelcast.spi.impl.operationservice.impl.Invocation in project hazelcast by hazelcast.

the class RaftInvocationManager method destroy.

public InternalCompletableFuture<Object> destroy(CPGroupId groupId) {
    InternalCompletableFuture<Object> completedFuture = completeExceptionallyIfCPSubsystemNotAvailable();
    if (completedFuture != null) {
        return completedFuture;
    }
    Operation operation = new DestroyRaftGroupOp(groupId);
    Invocation invocation = new RaftInvocation(operationService.getInvocationContext(), raftInvocationContext, groupId, operation, invocationMaxRetryCount, invocationRetryPauseMillis, operationCallTimeout);
    return invocation.invoke();
}
Also used : DestroyRaftGroupOp(com.hazelcast.cp.internal.operation.DestroyRaftGroupOp) RaftInvocation(com.hazelcast.spi.impl.operationservice.impl.RaftInvocation) Invocation(com.hazelcast.spi.impl.operationservice.impl.Invocation) RaftInvocation(com.hazelcast.spi.impl.operationservice.impl.RaftInvocation) Operation(com.hazelcast.spi.impl.operationservice.Operation)

Example 4 with Invocation

use of com.hazelcast.spi.impl.operationservice.impl.Invocation in project hazelcast by hazelcast.

the class RaftInvocationManager method changeMembership.

<T> InternalCompletableFuture<T> changeMembership(CPGroupId groupId, long membersCommitIndex, RaftEndpoint member, MembershipChangeMode membershipChangeMode) {
    InternalCompletableFuture<T> completedFuture = completeExceptionallyIfCPSubsystemNotAvailable();
    if (completedFuture != null) {
        return completedFuture;
    }
    Operation operation = new ChangeRaftGroupMembershipOp(groupId, membersCommitIndex, member, membershipChangeMode);
    Invocation invocation = new RaftInvocation(operationService.getInvocationContext(), raftInvocationContext, groupId, operation, invocationMaxRetryCount, invocationRetryPauseMillis, operationCallTimeout);
    return invocation.invoke();
}
Also used : RaftInvocation(com.hazelcast.spi.impl.operationservice.impl.RaftInvocation) ChangeRaftGroupMembershipOp(com.hazelcast.cp.internal.operation.ChangeRaftGroupMembershipOp) DEFAULT_DESERIALIZE_RESULT(com.hazelcast.spi.impl.operationservice.InvocationBuilder.DEFAULT_DESERIALIZE_RESULT) Invocation(com.hazelcast.spi.impl.operationservice.impl.Invocation) RaftInvocation(com.hazelcast.spi.impl.operationservice.impl.RaftInvocation) Operation(com.hazelcast.spi.impl.operationservice.Operation)

Example 5 with Invocation

use of com.hazelcast.spi.impl.operationservice.impl.Invocation in project hazelcast by hazelcast.

the class RaftInvocationManager method query.

public <T> InternalCompletableFuture<T> query(CPGroupId groupId, RaftOp raftOp, QueryPolicy queryPolicy, boolean deserializeResponse) {
    if (cpSubsystemEnabled) {
        RaftQueryOp operation = new RaftQueryOp(groupId, raftOp, queryPolicy);
        Invocation invocation = new RaftInvocation(operationService.getInvocationContext(), raftInvocationContext, groupId, operation, invocationMaxRetryCount, invocationRetryPauseMillis, operationCallTimeout, deserializeResponse);
        return invocation.invoke();
    }
    return invokeOnPartition(new UnsafeRaftQueryOp(groupId, raftOp), deserializeResponse);
}
Also used : RaftInvocation(com.hazelcast.spi.impl.operationservice.impl.RaftInvocation) Invocation(com.hazelcast.spi.impl.operationservice.impl.Invocation) RaftInvocation(com.hazelcast.spi.impl.operationservice.impl.RaftInvocation) UnsafeRaftQueryOp(com.hazelcast.cp.internal.operation.unsafe.UnsafeRaftQueryOp) RaftQueryOp(com.hazelcast.cp.internal.operation.RaftQueryOp) UnsafeRaftQueryOp(com.hazelcast.cp.internal.operation.unsafe.UnsafeRaftQueryOp)

Aggregations

Invocation (com.hazelcast.spi.impl.operationservice.impl.Invocation)7 RaftInvocation (com.hazelcast.spi.impl.operationservice.impl.RaftInvocation)4 Operation (com.hazelcast.spi.impl.operationservice.Operation)3 ChangeRaftGroupMembershipOp (com.hazelcast.cp.internal.operation.ChangeRaftGroupMembershipOp)1 DefaultRaftReplicateOp (com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp)1 DestroyRaftGroupOp (com.hazelcast.cp.internal.operation.DestroyRaftGroupOp)1 RaftQueryOp (com.hazelcast.cp.internal.operation.RaftQueryOp)1 UnsafeRaftQueryOp (com.hazelcast.cp.internal.operation.unsafe.UnsafeRaftQueryOp)1 UnsafeRaftReplicateOp (com.hazelcast.cp.internal.operation.unsafe.UnsafeRaftReplicateOp)1 PromoteLiteMemberOp (com.hazelcast.internal.cluster.impl.operations.PromoteLiteMemberOp)1 IMap (com.hazelcast.map.IMap)1 DEFAULT_DESERIALIZE_RESULT (com.hazelcast.spi.impl.operationservice.InvocationBuilder.DEFAULT_DESERIALIZE_RESULT)1 InvocationRegistry (com.hazelcast.spi.impl.operationservice.impl.InvocationRegistry)1 OperationServiceImpl (com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)1 Map (java.util.Map)1