Source:
<code>public void testMultiMemberRestart() throws ExecutionException, InterruptedException { HazelcastInstance instance1 = hazelcastFactory.newHazelcastInstance(newConfig()); HazelcastInstance instance2 = hazelcastFactory.newHazelcastInstance(newConfig()); HazelcastInstance client = hazelcastFactory.newHazelcastClient(newClientConfig()); Member oldMember1 = instance1.getCluster().getLocalMember(); Member oldMember2 = instance2.getCluster().getLocalMember(); final CountDownLatch memberAdded = new CountDownLatch(2); final Set<Member> addedMembers = Collections.newSetFromMap(new ConcurrentHashMap<Member, Boolean>()); final CountDownLatch memberRemoved = new CountDownLatch(2); final Set<Member> removedMembers = Collections.newSetFromMap(new ConcurrentHashMap<Member, Boolean>()); client.getCluster().addMembershipListener(new MembershipListener() { @Override public void memberAdded(MembershipEvent membershipEvent) { addedMembers.add(membershipEvent.getMember()); memberAdded.countDown(); } @Override public void memberRemoved(MembershipEvent membershipEvent) { removedMembers.add(membershipEvent.getMember()); memberRemoved.countDown(); } @Override public void memberAttributeChanged(MemberAttributeEvent memberAttributeEvent) { } }); instance1.getCluster().shutdown(); <START> Future<HazelcastInstance> f1 = spawn(new Runnable() { <END> @Override public void run() { hazelcastFactory.newHazelcastInstance(newConfig()); } }); Future<HazelcastInstance> f2 = spawn(new Runnable() { @Override public void run() { hazelcastFactory.newHazelcastInstance(newConfig()); } }); instance1 = f1.get(); instance2 = f2.get(); Member newMember1 = instance1.getCluster().getLocalMember(); Member newMember2 = instance2.getCluster().getLocalMember(); assertOpenEventually(memberRemoved); assertEquals(2, removedMembers.size()); assertContains(removedMembers, oldMember1); assertContains(removedMembers, oldMember2); assertOpenEventually(memberAdded); assertEquals(2, addedMembers.size()); assertContains(addedMembers, newMember1); assertContains(addedMembers, newMember2); Set<Member> members = client.getCluster().getMembers(); assertContains(members, newMember1); assertContains(members, newMember2); assertEquals(2, members.size()); }</code><technical_language>this Callable return instance ref get NPE line 168</technical_language>

Target:
public void testMultiMemberRestart() throws ExecutionException, InterruptedException { HazelcastInstance instance1 = hazelcastFactory.newHazelcastInstance(newConfig()); HazelcastInstance instance2 = hazelcastFactory.newHazelcastInstance(newConfig()); HazelcastInstance client = hazelcastFactory.newHazelcastClient(newClientConfig()); Member oldMember1 = instance1.getCluster().getLocalMember(); Member oldMember2 = instance2.getCluster().getLocalMember(); final CountDownLatch memberAdded = new CountDownLatch(2); final Set<Member> addedMembers = Collections.newSetFromMap(new ConcurrentHashMap<Member, Boolean>()); final CountDownLatch memberRemoved = new CountDownLatch(2); final Set<Member> removedMembers = Collections.newSetFromMap(new ConcurrentHashMap<Member, Boolean>()); client.getCluster().addMembershipListener(new MembershipListener() { @Override public void memberAdded(MembershipEvent membershipEvent) { addedMembers.add(membershipEvent.getMember()); memberAdded.countDown(); } @Override public void memberRemoved(MembershipEvent membershipEvent) { removedMembers.add(membershipEvent.getMember()); memberRemoved.countDown(); } @Override public void memberAttributeChanged(MemberAttributeEvent memberAttributeEvent) { } }); instance1.getCluster().shutdown(); Future<HazelcastInstance> f1 = spawn(new Callable<HazelcastInstance>() { @Override public HazelcastInstance call() { return hazelcastFactory.newHazelcastInstance(newConfig()); } }); Future<HazelcastInstance> f2 = spawn(new Callable<HazelcastInstance>() { @Override public HazelcastInstance call() { return hazelcastFactory.newHazelcastInstance(newConfig()); } }); instance1 = f1.get(); instance2 = f2.get(); Member newMember1 = instance1.getCluster().getLocalMember(); Member newMember2 = instance2.getCluster().getLocalMember(); assertOpenEventually(memberRemoved); assertEquals(2, removedMembers.size()); assertContains(removedMembers, oldMember1); assertContains(removedMembers, oldMember2); assertOpenEventually(memberAdded); assertEquals(2, addedMembers.size()); assertContains(addedMembers, newMember1); assertContains(addedMembers, newMember2); Set<Member> members = client.getCluster().getMembers(); assertContains(members, newMember1); assertContains(members, newMember2); assertEquals(2, members.size()); }