use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class ScheduledExecutorServiceBasicTest method scheduleOnMember.
@Test
public void scheduleOnMember() throws Exception {
int delay = 1;
HazelcastInstance[] instances = createClusterWithCount(2);
IScheduledExecutorService executorService = getScheduledExecutor(instances, ANY_EXECUTOR_NAME);
MemberImpl member = getNodeEngineImpl(instances[0]).getLocalMember();
IScheduledFuture<Double> future = executorService.scheduleOnMember(new PlainCallableTask(), member, delay, SECONDS);
assertTrue(future.getHandler().isAssignedToMember());
assertEquals(25.0, future.get(), 0);
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class RestMultiendpointTest method assertAdvancedNetworkInUse.
@Test
public void assertAdvancedNetworkInUse() {
int numberOfEndpointsInConfig = instance.getConfig().getAdvancedNetworkConfig().getEndpointConfigs().size();
MemberImpl local = getNode(instance).getClusterService().getLocalMember();
assertTrue(local.getAddressMap().size() == numberOfEndpointsInConfig);
assertFalse(local.getSocketAddress(EndpointQualifier.REST).equals(local.getSocketAddress(EndpointQualifier.MEMBER)));
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MembershipUpdateTest method memberListOrder_shouldBeSame_whenMemberRestartedWithSameIdentity.
@Test
public void memberListOrder_shouldBeSame_whenMemberRestartedWithSameIdentity() {
ruleStaleJoinPreventionDuration.setOrClearProperty("5");
Config configMaster = new Config();
configMaster.setProperty(ClusterProperty.MEMBER_LIST_PUBLISH_INTERVAL_SECONDS.getName(), "5");
HazelcastInstance hz1 = factory.newHazelcastInstance(configMaster);
HazelcastInstance hz2 = factory.newHazelcastInstance();
HazelcastInstance hz3 = factory.newHazelcastInstance();
HazelcastInstance hz4 = factory.newHazelcastInstance();
assertClusterSizeEventually(4, hz2, hz3);
rejectOperationsBetween(hz1, hz2, F_ID, singletonList(MEMBER_INFO_UPDATE));
MemberImpl member3 = getNode(hz3).getLocalMember();
hz3.getLifecycleService().terminate();
assertClusterSizeEventually(3, hz1, hz4);
assertClusterSize(4, hz2);
hz3 = newHazelcastInstance(initOrCreateConfig(new Config()), randomName(), new StaticMemberNodeContext(factory, member3));
assertClusterSizeEventually(4, hz1, hz4);
resetPacketFiltersFrom(hz1);
assertMemberViewsAreSame(getMemberMap(hz1), getMemberMap(hz3));
assertMemberViewsAreSame(getMemberMap(hz1), getMemberMap(hz4));
assertTrueEventually(() -> assertMemberViewsAreSame(getMemberMap(hz1), getMemberMap(hz2)));
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MembershipFailureTest method slave_heartbeat_removes_suspicion.
@Test
public void slave_heartbeat_removes_suspicion() {
Config config = smallInstanceConfig().setProperty(MAX_NO_HEARTBEAT_SECONDS.getName(), "15").setProperty(HEARTBEAT_INTERVAL_SECONDS.getName(), "1");
HazelcastInstance master = newHazelcastInstance(config);
HazelcastInstance slave1 = newHazelcastInstance(config);
HazelcastInstance slave2 = newHazelcastInstance(config);
assertClusterSize(3, master, slave2);
assertClusterSizeEventually(3, slave1);
dropOperationsBetween(slave2, slave1, F_ID, singletonList(HEARTBEAT));
MembershipManager membershipManager = getNode(slave1).getClusterService().getMembershipManager();
assertTrueEventually(() -> {
Member localMember = slave2.getCluster().getLocalMember();
assertTrue(membershipManager.isMemberSuspected((MemberImpl) localMember));
});
resetPacketFiltersFrom(slave2);
assertTrueEventually(() -> {
Member localMember = slave2.getCluster().getLocalMember();
assertFalse(membershipManager.isMemberSuspected((MemberImpl) localMember));
});
}
use of com.hazelcast.cluster.impl.MemberImpl in project hazelcast by hazelcast.
the class MemberMapTest method tailMemberSet_exclusive.
@Test
public void tailMemberSet_exclusive() {
MemberImpl[] members = newMembers(7);
MemberMap map = MemberMap.createNew(members);
MemberImpl member = members[3];
Set<MemberImpl> set = map.tailMemberSet(member, false);
assertEquals(3, set.size());
int k = 4;
for (MemberImpl m : set) {
assertEquals(members[k++], m);
}
}
Aggregations