use of com.hazelcast.internal.cluster.ClusterService in project hazelcast by hazelcast.
the class PartitionReplicaStateChecker method hasOnGoingMigrationMaster.
boolean hasOnGoingMigrationMaster(Level level) {
ClusterService clusterService = node.getClusterService();
Address masterAddress = clusterService.getMasterAddress();
if (masterAddress == null) {
return clusterService.isJoined();
}
Operation operation = new HasOngoingMigration();
OperationService operationService = nodeEngine.getOperationService();
InvocationFuture<Boolean> future = operationService.createInvocationBuilder(SERVICE_NAME, operation, masterAddress).setTryCount(INVOCATION_TRY_COUNT).setTryPauseMillis(INVOCATION_TRY_PAUSE_MILLIS).invoke();
try {
return future.joinInternal();
} catch (Exception e) {
logger.log(level, "Could not get a response from master about migrations! -> " + e.toString());
}
return false;
}
use of com.hazelcast.internal.cluster.ClusterService in project hazelcast by hazelcast.
the class ShutdownRequestOperation method run.
@Override
public void run() {
InternalPartitionServiceImpl partitionService = getService();
ILogger logger = getLogger();
Address caller = getCallerAddress();
if (partitionService.isLocalMemberMaster()) {
ClusterService clusterService = getNodeEngine().getClusterService();
Member member = clusterService.getMember(caller);
if (member != null) {
if (logger.isFinestEnabled()) {
logger.finest("Received shutdown request from " + caller);
}
partitionService.onShutdownRequest(member);
} else {
logger.warning("Ignoring shutdown request from " + caller + " because it is not a member");
}
} else {
logger.warning("Received shutdown request from " + caller + " but this node is not master.");
}
}
use of com.hazelcast.internal.cluster.ClusterService in project hazelcast by hazelcast.
the class MemberSchemaService method getAsync.
public CompletableFuture<Schema> getAsync(long schemaId) {
if (!nodeEngine.getClusterService().getClusterVersion().isEqualTo(Versions.V5_2)) {
throw new UnsupportedOperationException("The BETA compact format can only be used with 5.2 cluster");
}
Schema schema = getLocal(schemaId);
if (schema != null) {
return CompletableFuture.completedFuture(schema);
}
if (logger.isFinestEnabled()) {
logger.finest("Could not find schema id " + schemaId + " locally, will search on the cluster" + schemaId);
}
ClusterService cluster = nodeEngine.getClusterService();
OperationService operationService = nodeEngine.getOperationService();
Set<Member> members = cluster.getMembers();
Iterator<Member> iterator = members.iterator();
return searchClusterAsync(schemaId, iterator, operationService);
}
use of com.hazelcast.internal.cluster.ClusterService in project hazelcast by hazelcast.
the class ClassLocator method fetchBytecodeFromRemote.
// called while holding class lock
private ClassData fetchBytecodeFromRemote(String className) {
ClusterService cluster = nodeEngine.getClusterService();
ClassData classData;
boolean interrupted = false;
for (Member member : cluster.getMembers()) {
if (!isCandidateMember(member)) {
continue;
}
try {
classData = tryToFetchClassDataFromMember(className, member);
if (classData != null) {
if (logger.isFineEnabled()) {
logger.finest("Loaded class " + className + " from " + member);
}
return classData;
}
} catch (InterruptedException e) {
// question: should we give up on loading at this point and simply throw ClassNotFoundException?
interrupted = true;
} catch (Exception e) {
if (logger.isFinestEnabled()) {
logger.finest("Unable to get class data for class " + className + " from member " + member, e);
}
}
}
if (interrupted) {
Thread.currentThread().interrupt();
}
return null;
}
use of com.hazelcast.internal.cluster.ClusterService in project hazelcast by hazelcast.
the class ClusterServiceMemberListTest method verifySizeFromDataMember.
private void verifySizeFromDataMember(final HazelcastInstance instance) {
final ClusterService clusterService = getClusterService(instance);
assertEquals(1, clusterService.getSize(MemberSelectors.LITE_MEMBER_SELECTOR));
assertEquals(2, clusterService.getSize(MemberSelectors.DATA_MEMBER_SELECTOR));
assertEquals(1, clusterService.getSize(MemberSelectors.and(DATA_MEMBER_SELECTOR, NON_LOCAL_MEMBER_SELECTOR)));
assertEquals(2, clusterService.getSize(MemberSelectors.or(LITE_MEMBER_SELECTOR, LOCAL_MEMBER_SELECTOR)));
}
Aggregations