Ejemplo n.º 1
0
  @Test
  public void testMemberLeftException_usingSimpleMember() throws Exception {
    String uuid = UuidUtil.newUnsecureUuidString();
    String host = "127.0.0.1";
    int port = 5000;

    Member member =
        new SimpleMemberImpl(MemberVersion.of("3.8.0"), uuid, new InetSocketAddress(host, port));
    testMemberLeftException(uuid, host, port, member);
  }
Ejemplo n.º 2
0
  @Test
  public void testMemberLeftException_usingMemberImpl() throws Exception {
    String uuid = UuidUtil.newUnsecureUuidString();
    String host = "127.0.0.1";
    int port = 5000;

    Member member =
        new MemberImpl(new Address(host, port), MemberVersion.of("3.8.0"), false, uuid, null);

    testMemberLeftException(uuid, host, port, member);
  }
 @Override
 public String registerListener(ListenerMessageCodec codec, EventHandler handler) {
   String userRegistrationId = UuidUtil.newUnsecureUuidString();
   synchronized (listenerRegLock) {
     ClientRegistrationKey registrationKey =
         new ClientRegistrationKey(userRegistrationId, handler, codec);
     registrations.put(registrationKey, new ConcurrentHashMap<Address, ClientEventRegistration>());
     try {
       for (Member member : this.members) {
         invoke(registrationKey, member.getAddress());
       }
     } catch (Exception e) {
       deregisterListener(userRegistrationId);
       throw new HazelcastException("Listener can not be added", e);
     }
     return userRegistrationId;
   }
 }