use of com.hazelcast.instance.Node in project hazelcast by hazelcast.
the class MemberInfoUpdateOperation method getConnectionEndpointOrThisAddress.
final Address getConnectionEndpointOrThisAddress() {
ClusterServiceImpl clusterService = getService();
NodeEngineImpl nodeEngine = clusterService.getNodeEngine();
Node node = nodeEngine.getNode();
Connection conn = getConnection();
return conn != null ? conn.getEndPoint() : node.getThisAddress();
}
use of com.hazelcast.instance.Node in project hazelcast by hazelcast.
the class TimedMemberStateFactory method createMemberState.
private void createMemberState(TimedMemberState timedMemberState, MemberStateImpl memberState, Collection<StatisticsAwareService> services) {
Node node = instance.node;
HashSet<ClientEndPointDTO> serializableClientEndPoints = new HashSet<ClientEndPointDTO>();
for (Client client : instance.node.clientEngine.getClients()) {
serializableClientEndPoints.add(new ClientEndPointDTO(client));
}
memberState.setClients(serializableClientEndPoints);
Address thisAddress = node.getThisAddress();
memberState.setAddress(thisAddress.getHost() + ":" + thisAddress.getPort());
TimedMemberStateFactoryHelper.registerJMXBeans(instance, memberState);
MemberPartitionStateImpl memberPartitionState = (MemberPartitionStateImpl) memberState.getMemberPartitionState();
InternalPartitionService partitionService = node.getPartitionService();
IPartition[] partitions = partitionService.getPartitions();
List<Integer> partitionList = memberPartitionState.getPartitions();
for (IPartition partition : partitions) {
if (partition.isLocal()) {
partitionList.add(partition.getPartitionId());
}
}
memberPartitionState.setMigrationQueueSize(partitionService.getMigrationQueueSize());
memberPartitionState.setMemberStateSafe(memberStateSafe);
memberState.setLocalMemoryStats(getMemoryStats());
memberState.setOperationStats(getOperationStats());
TimedMemberStateFactoryHelper.createRuntimeProps(memberState);
createMemState(timedMemberState, memberState, services);
createNodeState(memberState);
createHotRestartState(memberState);
createClusterHotRestartStatus(memberState);
createWanSyncState(memberState);
}
use of com.hazelcast.instance.Node in project hazelcast by hazelcast.
the class TriggerPartialStartRequest method writeResponse.
@Override
public void writeResponse(ManagementCenterService mcs, JsonObject out) throws Exception {
Node node = mcs.getHazelcastInstance().node;
final InternalHotRestartService hotRestartService = node.getNodeExtension().getInternalHotRestartService();
final boolean done = hotRestartService.triggerPartialStart();
String result = done ? SUCCESS_RESULT : FAILED_RESULT;
out.add("result", result);
}
use of com.hazelcast.instance.Node in project hazelcast by hazelcast.
the class BaseMigrationOperation method verifyClusterState.
private void verifyClusterState() {
final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
ClusterState clusterState = nodeEngine.getClusterService().getClusterState();
if (clusterState != ClusterState.ACTIVE) {
throw new IllegalStateException("Cluster state is not active! " + clusterState);
}
final Node node = nodeEngine.getNode();
if (!node.getNodeExtension().isStartCompleted()) {
throw new IllegalStateException("Migration operation is received before startup is completed. " + "Caller: " + getCallerAddress());
}
}
use of com.hazelcast.instance.Node in project hazelcast by hazelcast.
the class PartitionCorrectnessTestSupport method assertSizeAndData.
private void assertSizeAndData(boolean allowDirty) throws InterruptedException {
Collection<HazelcastInstance> instances = factory.getAllHazelcastInstances();
final int actualBackupCount = Math.min(backupCount, instances.size() - 1);
final int expectedSize = partitionCount * (actualBackupCount + 1);
int total = 0;
for (HazelcastInstance hz : instances) {
TestMigrationAwareService service = getService(hz);
total += service.size();
Node node = getNode(hz);
InternalPartitionService partitionService = node.getPartitionService();
InternalPartition[] partitions = partitionService.getInternalPartitions();
Address thisAddress = node.getThisAddress();
// find leaks
assertNoLeakingData(service, partitions, thisAddress);
// find missing
assertNoMissingData(service, partitions, thisAddress);
// check values
assertPartitionVersionsAndBackupValues(actualBackupCount, service, node, partitions, allowDirty);
assertMigrationEvents(service, thisAddress);
}
assertEquals("Missing data!", expectedSize, total);
}
Aggregations