use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class MergeClustersOperation method run.
@Override
public void run() {
final Address caller = getCallerAddress();
final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
final Node node = nodeEngine.getNode();
final Address masterAddress = node.getMasterAddress();
final ILogger logger = node.loggingService.getLogger(this.getClass().getName());
boolean local = caller == null;
if (!local && !caller.equals(masterAddress)) {
logger.warning("Ignoring merge instruction sent from non-master endpoint: " + caller);
return;
}
logger.warning(node.getThisAddress() + " is merging to " + newTargetAddress + ", because: instructed by master " + masterAddress);
nodeEngine.getExecutionService().execute(ExecutionService.SYSTEM_EXECUTOR, new Runnable() {
@Override
public void run() {
node.getClusterService().merge(newTargetAddress);
}
});
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class LockClusterStateOperation method readInternal.
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
super.readInternal(in);
stateChange = in.readObject();
initiator = new Address();
initiator.readData(in);
txnId = in.readUTF();
leaseTime = in.readLong();
partitionStateVersion = in.readInt();
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class MasterConfirmationOperation method run.
@Override
public void run() {
final Address endpoint = getCallerAddress();
if (endpoint == null) {
return;
}
final ClusterServiceImpl clusterService = getService();
final ILogger logger = getLogger();
final MemberImpl member = clusterService.getMember(endpoint);
if (member == null) {
logger.warning("MasterConfirmation has been received from " + endpoint + ", but it is not a member of this cluster!");
OperationService operationService = getNodeEngine().getOperationService();
operationService.send(new MemberRemoveOperation(clusterService.getThisAddress()), endpoint);
} else {
if (clusterService.isMaster()) {
clusterService.getClusterHeartbeatManager().acceptMasterConfirmation(member, timestamp);
} else {
logger.warning(endpoint + " has sent MasterConfirmation, but this node is not master!");
}
}
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class MemberInfoUpdateOperation method run.
@Override
public void run() throws Exception {
checkLocalMemberUuid();
ClusterServiceImpl clusterService = getService();
Address callerAddress = getConnectionEndpointOrThisAddress();
if (clusterService.updateMembers(memberInfos, callerAddress)) {
processPartitionState();
}
}
use of com.hazelcast.nio.Address 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);
}
Aggregations