use of com.hazelcast.cluster.Member in project hazelcast by hazelcast.
the class InternalPartitionServiceImpl method checkClusterPartitionRuntimeStates.
void checkClusterPartitionRuntimeStates() {
if (!partitionStateManager.isInitialized()) {
return;
}
if (!isLocalMemberMaster()) {
return;
}
if (!areMigrationTasksAllowed()) {
// migration is disabled because of a member leave, wait till enabled!
return;
}
long stamp = getPartitionStateStamp();
if (logger.isFineEnabled()) {
logger.fine("Checking partition state, stamp: " + stamp);
}
OperationService operationService = nodeEngine.getOperationService();
Collection<Member> members = node.clusterService.getMembers();
for (Member member : members) {
if (!member.localMember()) {
PartitionStateCheckOperation op = new PartitionStateCheckOperation(stamp);
InvocationFuture<Boolean> future = operationService.invokeOnTarget(SERVICE_NAME, op, member.getAddress());
future.whenCompleteAsync((response, throwable) -> {
if (throwable == null) {
if (!Boolean.TRUE.equals(response)) {
logger.fine(member + " has a stale partition state. Will send the most recent partition state now.");
sendPartitionRuntimeState(member.getAddress());
}
} else {
logger.fine("Failure while checking partition state on " + member, throwable);
sendPartitionRuntimeState(member.getAddress());
}
});
}
}
}
use of com.hazelcast.cluster.Member in project hazelcast by hazelcast.
the class PartitionServiceProxy method isClusterSafe.
@Override
public boolean isClusterSafe() {
Collection<Member> members = nodeEngine.getClusterService().getMembers();
if (members == null || members.isEmpty()) {
return true;
}
final Collection<Future<Boolean>> futures = new ArrayList<>(members.size());
for (Member member : members) {
final Address target = member.getAddress();
final Operation operation = new SafeStateCheckOperation();
final Future<Boolean> future = nodeEngine.getOperationService().invokeOnTarget(InternalPartitionService.SERVICE_NAME, operation, target);
futures.add(future);
}
// todo this max wait is appropriate?
final int maxWaitTime = getMaxWaitTime();
Collection<Boolean> results = FutureUtil.returnWithDeadline(futures, maxWaitTime, TimeUnit.SECONDS, exceptionHandler);
if (results.size() != futures.size()) {
return false;
}
for (Boolean result : results) {
if (!result) {
return false;
}
}
return true;
}
use of com.hazelcast.cluster.Member in project hazelcast by hazelcast.
the class MapEventPublishingService method dispatchMapPartitionLostEventData.
private void dispatchMapPartitionLostEventData(MapPartitionEventData eventData, ListenerAdapter listener) {
Member member = getMember(eventData);
MapPartitionLostEvent event = createMapPartitionLostEventData(eventData, member);
callListener(listener, event);
}
use of com.hazelcast.cluster.Member in project hazelcast by hazelcast.
the class MapEventPublishingService method dispatchMapEventData.
private void dispatchMapEventData(MapEventData mapEventData, ListenerAdapter listener) {
Member member = getMember(mapEventData);
MapEvent event = createMapEvent(mapEventData, member);
callListener(listener, event);
}
use of com.hazelcast.cluster.Member in project hazelcast by hazelcast.
the class NodeQueryCacheEndToEndConstructor method madePublishable.
private void madePublishable(String mapName, String cacheId) {
InvokerWrapper invokerWrapper = context.getInvokerWrapper();
Collection<Member> memberList = context.getMemberList();
List<Future> futures = new ArrayList<>(memberList.size());
for (Member member : memberList) {
Operation operation = new MadePublishableOperation(mapName, cacheId);
Future future = invokerWrapper.invokeOnTarget(operation, member);
futures.add(future);
}
waitWithDeadline(futures, OPERATION_WAIT_TIMEOUT_MINUTES, MINUTES);
}
Aggregations