public String addEventListener(
     EventListener entryListener, EventFilter eventFilter, String mapName) {
   if (config.isLiteMember()) {
     throw new ReplicatedMapCantBeCreatedOnLiteMemberException(nodeEngine.getThisAddress());
   }
   EventRegistration registration =
       eventService.registerLocalListener(SERVICE_NAME, mapName, eventFilter, entryListener);
   return registration.getId();
 }
 public boolean removeEventListener(String mapName, String registrationId) {
   if (config.isLiteMember()) {
     throw new ReplicatedMapCantBeCreatedOnLiteMemberException(nodeEngine.getThisAddress());
   }
   if (registrationId == null) {
     throw new IllegalArgumentException("registrationId cannot be null");
   }
   return eventService.deregisterListener(SERVICE_NAME, mapName, registrationId);
 }
  @Test
  public void testNonLiteMemberConfig() {
    String xml = HAZELCAST_START_TAG + "    <lite-member enabled=\"false\"/>\n" + "</hazelcast>";

    ByteArrayInputStream bis = new ByteArrayInputStream(xml.getBytes());
    XmlConfigBuilder configBuilder = new XmlConfigBuilder(bis);
    final Config config = configBuilder.build();
    assertFalse(config.isLiteMember());
  }
Esempio n. 4
0
  @Test
  public void testNonLiteMemberConfig() {
    String xml =
        "<hazelcast xmlns=\"http://www.hazelcast.com/schema/config\">\n"
            + "    <lite-member enabled=\"false\"/>\n"
            + "</hazelcast>";

    ByteArrayInputStream bis = new ByteArrayInputStream(xml.getBytes());
    XmlConfigBuilder configBuilder = new XmlConfigBuilder(bis);
    final Config config = configBuilder.build();
    assertFalse(config.isLiteMember());
  }