use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class MemberImplTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
HazelcastInstance instance = new TestHazelcastInstanceFactory().newHazelcastInstance();
hazelcastInstance = getHazelcastInstanceImpl(instance);
address = new Address("127.0.0.1", 5701);
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class MemberImplTest method testSerialization_whenMultiAddress.
@Test
public void testSerialization_whenMultiAddress() throws Exception {
Map<EndpointQualifier, Address> addressMap = new HashMap<EndpointQualifier, Address>();
addressMap.put(EndpointQualifier.MEMBER, address);
addressMap.put(EndpointQualifier.REST, new Address("127.0.0.1", 8080));
MemberImpl member = new MemberImpl.Builder(addressMap).version(MemberVersion.of("3.12.0")).build();
testSerialization(member);
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class CPLiteMemberTest method liteMembers_canBePromotedToCPMember_afterPromotedToDataMember.
@Test
public void liteMembers_canBePromotedToCPMember_afterPromotedToDataMember() throws Exception {
Config config = createConfig(3, 3);
HazelcastInstance hz1 = factory.newHazelcastInstance(config);
HazelcastInstance hz2 = factory.newHazelcastInstance(config);
HazelcastInstance hz3 = factory.newHazelcastInstance(config);
HazelcastInstance hz_lite = factory.newHazelcastInstance(createConfig(3, 3).setLiteMember(true));
assertTrue(awaitUntilDiscoveryCompleted(hz1, 60));
assertTrue(awaitUntilDiscoveryCompleted(hz_lite, 60));
hz_lite.getCluster().promoteLocalLiteMember();
hz_lite.getCPSubsystem().getCPSubsystemManagementService().promoteToCPMember().toCompletableFuture().get();
Collection<CPMember> cpMembers = hz1.getCPSubsystem().getCPSubsystemManagementService().getCPMembers().toCompletableFuture().get();
assertEquals(4, cpMembers.size());
Set<Address> cpAddresses = cpMembers.stream().map(CPMember::getAddress).collect(Collectors.toSet());
assertThat(cpAddresses, hasItem(getAddress(hz_lite)));
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class MetadataRaftGroupTest method when_clusterStartsWithNonCPNodes_then_metadataClusterIsInitialized.
@Test
public void when_clusterStartsWithNonCPNodes_then_metadataClusterIsInitialized() {
int cpNodeCount = 3;
instances = newInstances(cpNodeCount, cpNodeCount, 2);
List<Address> raftAddresses = new ArrayList<>();
for (int i = 0; i < cpNodeCount; i++) {
raftAddresses.add(getAddress(instances[i]));
}
assertTrueEventually(() -> {
for (HazelcastInstance instance : instances) {
if (raftAddresses.contains(getAddress(instance))) {
assertNotNull(getRaftNode(instance, getMetadataGroupId(instance)));
}
}
});
assertTrueAllTheTime(() -> {
for (HazelcastInstance instance : instances) {
if (!raftAddresses.contains(getAddress(instance))) {
assertNull(getRaftNode(instance, getMetadataGroupId(instance)));
}
}
}, 10);
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class MapEvictAllMessageTask method reduce.
@Override
protected Object reduce(Map<Integer, Object> map) {
MapService mapService = getService(MapService.SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
int evictedTotal = 0;
for (Object result : map.values()) {
Integer size = (Integer) mapServiceContext.toObject(result);
evictedTotal += size;
}
if (evictedTotal > 0) {
Address thisAddress = mapServiceContext.getNodeEngine().getThisAddress();
MapEventPublisher mapEventPublisher = mapServiceContext.getMapEventPublisher();
mapEventPublisher.publishMapEvent(thisAddress, parameters, EVICT_ALL, evictedTotal);
}
return null;
}
Aggregations