use of com.hazelcast.cp.CPGroupId 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);
}
}
use of com.hazelcast.cp.CPGroupId in project hazelcast by hazelcast.
the class SemaphoreService method provideDynamicMetrics.
@Override
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) {
MetricDescriptor root = descriptor.withPrefix("cp.semaphore");
for (CPGroupId groupId : getGroupIdSet()) {
SemaphoreRegistry registry = getRegistryOrNull(groupId);
for (Semaphore sema : registry.getAllSemaphores()) {
MetricDescriptor desc = root.copy().withDiscriminator("id", sema.getName() + "@" + groupId.getName()).withTag(CP_TAG_NAME, sema.getName()).withTag("group", groupId.getName());
context.collect(desc.copy().withMetric("initialized"), sema.isInitialized() ? 1 : 0);
context.collect(desc.copy().withUnit(ProbeUnit.COUNT).withMetric("available"), sema.getAvailable());
}
}
}
use of com.hazelcast.cp.CPGroupId in project hazelcast by hazelcast.
the class RaftNodeImpl method printMemberState.
public void printMemberState() {
CPGroupId groupId = state.groupId();
StringBuilder sb = new StringBuilder("\n\nCP Group Members {").append("groupId: ").append(groupId.getName()).append("(").append(groupId.getId()).append(")").append(", size:").append(state.memberCount()).append(", term:").append(state.term()).append(", logIndex:").append(state.membersLogIndex()).append("} [");
for (RaftEndpoint member : state.members()) {
CPMember cpMember = raftIntegration.getCPMember(member);
sb.append("\n\t").append(cpMember != null ? cpMember : member);
if (state.localEndpoint().equals(member)) {
sb.append(" - ").append(state.role()).append(" this");
} else if (member.equals(state.leader())) {
sb.append(" - ").append(LEADER);
}
}
sb.append("\n]\n");
logger.info(sb.toString());
}
use of com.hazelcast.cp.CPGroupId in project hazelcast by hazelcast.
the class UnsafeSnapshotReplicationOp method run.
@Override
public void run() throws Exception {
SnapshotAwareService service = getService();
for (Entry<CPGroupId, Object> entry : snapshots.entrySet()) {
CPGroupId groupId = entry.getKey();
service.restoreSnapshot(groupId, 0, entry.getValue());
}
}
use of com.hazelcast.cp.CPGroupId in project hazelcast by hazelcast.
the class TerminateRaftNodesOp method writeInternal.
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeInt(groupIds.size());
for (CPGroupId groupId : groupIds) {
out.writeObject(groupId);
}
}
Aggregations