use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class ReplicaSyncRequest method createReplicationOperations.
private List<Operation> createReplicationOperations() {
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
Collection<ServiceInfo> services = nodeEngine.getServiceInfos(MigrationAwareService.class);
PartitionReplicationEvent event = new PartitionReplicationEvent(getPartitionId(), getReplicaIndex());
List<Operation> tasks = new LinkedList<Operation>();
for (ServiceInfo serviceInfo : services) {
MigrationAwareService service = (MigrationAwareService) serviceInfo.getService();
Operation op = service.prepareReplicationOperation(event);
if (op != null) {
op.setServiceName(serviceInfo.getName());
tasks.add(op);
}
}
return tasks;
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class MasterClaimOperation method run.
@Override
public void run() {
final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
Node node = nodeEngine.getNode();
Joiner joiner = node.getJoiner();
final ILogger logger = node.getLogger(getClass().getName());
if (joiner instanceof TcpIpJoiner) {
TcpIpJoiner tcpIpJoiner = (TcpIpJoiner) joiner;
final Address endpoint = getCallerAddress();
final Address masterAddress = node.getMasterAddress();
approvedAsMaster = !tcpIpJoiner.isClaimingMaster() && !node.isMaster() && (masterAddress == null || masterAddress.equals(endpoint));
} else {
approvedAsMaster = false;
logger.warning("This node requires MulticastJoin strategy!");
}
if (logger.isFineEnabled()) {
logger.fine("Sending '" + approvedAsMaster + "' for master claim of node: " + getCallerAddress());
}
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class MemberInfoUpdateOperation method checkLocalMemberUuid.
final void checkLocalMemberUuid() {
ClusterServiceImpl clusterService = getService();
NodeEngineImpl nodeEngine = clusterService.getNodeEngine();
Node node = nodeEngine.getNode();
if (!node.getThisUuid().equals(targetUuid)) {
String msg = "targetUuid: " + targetUuid + " is different than this node's uuid: " + node.getThisUuid();
throw new IllegalStateException(msg);
}
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class BeforeJoinCheckFailureOperation method run.
@Override
public void run() {
final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
final Node node = nodeEngine.getNode();
if (node.joined()) {
throw new IllegalStateException("Node is already joined but received a termination message! " + "Reason: " + failReasonMsg);
}
final ILogger logger = nodeEngine.getLogger("com.hazelcast.security");
logger.severe("Node could not join cluster. Before join check failed node is going to shutdown now!");
logger.severe("Reason of failure for node join : " + failReasonMsg);
node.shutdown(true);
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class FinalizeJoinOperation method sendPostJoinOperations.
private void sendPostJoinOperations() {
final ClusterServiceImpl clusterService = getService();
final NodeEngineImpl nodeEngine = clusterService.getNodeEngine();
// Post join operations must be lock free; means no locks at all;
// no partition locks, no key-based locks, no service level locks!
final Operation[] postJoinOperations = nodeEngine.getPostJoinOperations();
final OperationService operationService = nodeEngine.getOperationService();
if (postJoinOperations != null && postJoinOperations.length > 0) {
final Collection<Member> members = clusterService.getMembers();
for (Member member : members) {
if (!member.localMember()) {
PostJoinOperation operation = new PostJoinOperation(postJoinOperations);
operationService.createInvocationBuilder(ClusterServiceImpl.SERVICE_NAME, operation, member.getAddress()).setTryCount(POST_JOIN_TRY_COUNT).invoke();
}
}
}
}
Aggregations