use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class TransactionManagerServiceImpl method pickBackupLogAddresses.
Address[] pickBackupLogAddresses(int durability) {
if (durability == 0) {
return EMPTY_ADDRESSES;
}
// This should be cleaned up because this is quite a complex approach since it depends on
// the number of members in the cluster and creates litter.
ClusterService clusterService = nodeEngine.getClusterService();
List<MemberImpl> members = new ArrayList<>(clusterService.getMemberImpls());
members.remove(nodeEngine.getLocalMember());
int c = Math.min(members.size(), durability);
shuffle(members);
Address[] addresses = new Address[c];
for (int i = 0; i < c; i++) {
addresses[i] = members.get(i).getAddress();
}
return addresses;
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class TimedMemberStateFactory method createTimedMemberState.
@Nonnull
public TimedMemberState createTimedMemberState() {
MemberStateImpl memberState = new MemberStateImpl();
Collection<StatisticsAwareService> services = instance.node.nodeEngine.getServices(StatisticsAwareService.class);
TimedMemberState timedMemberState = new TimedMemberState();
createMemberState(memberState, services);
timedMemberState.setMaster(instance.node.isMaster());
timedMemberState.setMemberList(new ArrayList<>());
Set<Member> memberSet = instance.getCluster().getMembers();
for (Member member : memberSet) {
MemberImpl memberImpl = (MemberImpl) member;
Address address = memberImpl.getAddress();
timedMemberState.getMemberList().add(address.getHost() + ":" + address.getPort());
}
timedMemberState.setMemberState(memberState);
timedMemberState.setClusterName(instance.getConfig().getClusterName());
SSLConfig sslConfig = getActiveMemberNetworkConfig(instance.getConfig()).getSSLConfig();
timedMemberState.setSslEnabled(sslConfig != null && sslConfig.isEnabled());
timedMemberState.setLite(instance.node.isLiteMember());
SocketInterceptorConfig interceptorConfig = getActiveMemberNetworkConfig(instance.getConfig()).getSocketInterceptorConfig();
timedMemberState.setSocketInterceptorEnabled(interceptorConfig != null && interceptorConfig.isEnabled());
ManagementCenterConfig managementCenterConfig = instance.node.getConfig().getManagementCenterConfig();
timedMemberState.setScriptingEnabled(managementCenterConfig.isScriptingEnabled());
timedMemberState.setConsoleEnabled(managementCenterConfig.isConsoleEnabled());
timedMemberState.setMcDataAccessEnabled(managementCenterConfig.isDataAccessEnabled());
return timedMemberState;
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class CacheSerializationTest method testCachePartitionEventData.
@Test
public void testCachePartitionEventData() throws UnknownHostException {
Address address = new Address("127.0.0.1", 5701);
Member member = new MemberImpl(address, MemberVersion.UNKNOWN, true);
CachePartitionEventData cachePartitionEventData = new CachePartitionEventData("test", 1, member);
CachePartitionEventData deserialized = service.toObject(cachePartitionEventData);
assertEquals(cachePartitionEventData, deserialized);
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MapPublisherCreateWithValueMessageTask method createPublishersAndGetSnapshotOf.
private List<Future> createPublishersAndGetSnapshotOf(Collection<MemberImpl> members) {
List<Future> futures = new ArrayList<Future>(members.size());
OperationServiceImpl operationService = nodeEngine.getOperationService();
for (MemberImpl member : members) {
Predicate predicate = serializationService.toObject(parameters.predicate);
AccumulatorInfo accumulatorInfo = AccumulatorInfo.toAccumulatorInfo(parameters.mapName, parameters.cacheName, predicate, parameters.batchSize, parameters.bufferSize, parameters.delaySeconds, true, parameters.populate, parameters.coalesce);
PublisherCreateOperation operation = new PublisherCreateOperation(accumulatorInfo);
operation.setCallerUuid(endpoint.getUuid());
Address address = member.getAddress();
InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(SERVICE_NAME, operation, address);
Future future = invocationBuilder.invoke();
futures.add(future);
}
return futures;
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MapPublisherCreateWithValueMessageTask method call.
@Override
protected Object call() throws Exception {
ClusterService clusterService = clientEngine.getClusterService();
Collection<MemberImpl> members = clusterService.getMemberImpls();
List<Future> snapshotFutures = createPublishersAndGetSnapshotOf(members);
return fetchMapSnapshotFrom(snapshotFutures);
}
Aggregations