Search in sources :

Example 46 with CPGroupId

use of com.hazelcast.cp.CPGroupId in project hazelcast by hazelcast.

the class MetadataRaftGroupManager method completeDestroyRaftGroup.

private void completeDestroyRaftGroup(CPGroupInfo group) {
    CPGroupId groupId = group.id();
    if (group.setDestroyed()) {
        logger.info(groupId + " is destroyed.");
        sendTerminateRaftNodeOpsForDestroyedGroup(group);
    } else if (logger.isFineEnabled()) {
        logger.fine(groupId + " is already destroyed.");
    }
}
Also used : CPGroupId(com.hazelcast.cp.CPGroupId)

Example 47 with CPGroupId

use of com.hazelcast.cp.CPGroupId in project hazelcast by hazelcast.

the class MetadataRaftGroupManager method addRaftGroup.

private void addRaftGroup(CPGroupInfo group) {
    CPGroupId groupId = group.id();
    if (groups.containsKey(groupId)) {
        String msg = group + " already exists!";
        if (logger.isFineEnabled()) {
            logger.warning(msg);
        }
        throw new IllegalStateException(msg);
    }
    groups.put(groupId, group);
}
Also used : CPGroupId(com.hazelcast.cp.CPGroupId)

Example 48 with CPGroupId

use of com.hazelcast.cp.CPGroupId in project hazelcast by hazelcast.

the class AtomicLongService method provideDynamicMetrics.

@Override
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) {
    MetricDescriptor root = descriptor.withPrefix("cp.atomiclong");
    for (AtomicLong value : atomicValues.values()) {
        CPGroupId groupId = value.groupId();
        MetricDescriptor desc = root.copy().withDiscriminator("id", value.name() + "@" + groupId.getName()).withTag(CP_TAG_NAME, value.name()).withTag("group", groupId.getName()).withMetric("value");
        context.collect(desc, value.value());
    }
}
Also used : CPGroupId(com.hazelcast.cp.CPGroupId) MetricDescriptor(com.hazelcast.internal.metrics.MetricDescriptor) IAtomicLong(com.hazelcast.cp.IAtomicLong)

Example 49 with CPGroupId

use of com.hazelcast.cp.CPGroupId in project hazelcast by hazelcast.

the class AddAndGetMessageTask method processMessage.

@Override
protected void processMessage() {
    CPGroupId groupId = parameters.groupId;
    long delta = parameters.delta;
    RaftOp op = new AddAndGetOp(parameters.name, delta);
    if (delta == 0) {
        query(groupId, op, LINEARIZABLE);
    } else {
        invoke(groupId, op);
    }
}
Also used : CPGroupId(com.hazelcast.cp.CPGroupId) AddAndGetOp(com.hazelcast.cp.internal.datastructures.atomiclong.operation.AddAndGetOp) RaftOp(com.hazelcast.cp.internal.RaftOp)

Example 50 with CPGroupId

use of com.hazelcast.cp.CPGroupId in project hazelcast by hazelcast.

the class AtomicRefService method provideDynamicMetrics.

@Override
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) {
    MetricDescriptor root = descriptor.withPrefix("cp.atomicref");
    for (AtomicRef value : atomicValues.values()) {
        CPGroupId groupId = value.groupId();
        MetricDescriptor desc = root.copy().withDiscriminator("id", value.name() + "@" + groupId.getName()).withTag(CP_TAG_NAME, value.name()).withTag("group", groupId.getName()).withMetric("dummy");
        context.collect(desc, 0);
    }
}
Also used : CPGroupId(com.hazelcast.cp.CPGroupId) MetricDescriptor(com.hazelcast.internal.metrics.MetricDescriptor)

Aggregations

CPGroupId (com.hazelcast.cp.CPGroupId)81 Test (org.junit.Test)50 HazelcastInstance (com.hazelcast.core.HazelcastInstance)42 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)37 QuickTest (com.hazelcast.test.annotation.QuickTest)31 CPGroup (com.hazelcast.cp.CPGroup)14 CPMember (com.hazelcast.cp.CPMember)13 RaftEndpoint (com.hazelcast.cp.internal.raft.impl.RaftEndpoint)11 RaftNodeImpl (com.hazelcast.cp.internal.raft.impl.RaftNodeImpl)9 ArrayList (java.util.ArrayList)8 MetricDescriptor (com.hazelcast.internal.metrics.MetricDescriptor)7 CountDownLatch (java.util.concurrent.CountDownLatch)7 ExecutionException (java.util.concurrent.ExecutionException)7 HazelcastInstanceFactory.newHazelcastInstance (com.hazelcast.instance.impl.HazelcastInstanceFactory.newHazelcastInstance)6 SlowTest (com.hazelcast.test.annotation.SlowTest)6 IndeterminateOperationStateException (com.hazelcast.core.IndeterminateOperationStateException)5 MemberLeftException (com.hazelcast.core.MemberLeftException)5 StaleAppendRequestException (com.hazelcast.cp.exception.StaleAppendRequestException)5 DefaultRaftReplicateOp (com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp)5 CallerNotMemberException (com.hazelcast.spi.exception.CallerNotMemberException)5