public HazelcastInstance build() { Config config = new Config(); if (listener != null) { SetConfig setConfig = new SetConfig(); setConfig.setName(PUBLISHED_SERVICES); setConfig.addItemListenerConfig(new ItemListenerConfig(listener, true)); config.addSetConfig(setConfig); } config.setInstanceName(UUID.randomUUID().toString()); return Hazelcast.newHazelcastInstance(config); }
private void initializeListeners() { for (ItemListenerConfig lc : queueConfig.getItemListenerConfigs()) { try { node.listenerManager.createAndAddListenerItem(name, lc, Instance.InstanceType.QUEUE); for (MemberImpl member : node.clusterManager.getMembers()) { mapListeners.put(member.getAddress(), lc.isIncludeValue()); } } catch (Exception e) { logger.log(Level.SEVERE, e.getMessage(), e); } } }