@Override public void close() { esConnector.stop(); if (hzMember != null) { if (healthStateSharing != null) { healthStateSharing.stop(); } try { // Removing listeners operationalProcesses.removeEntryListener(operationalProcessListenerUUID); hzMember.getCluster().removeMembershipListener(nodeDisconnectedListenerUUID); // Removing the operationalProcess from the replicated map operationalProcesses.keySet().forEach( clusterNodeProcess -> { if (clusterNodeProcess.getNodeUuid().equals(hzMember.getUuid())) { operationalProcesses.remove(clusterNodeProcess); } }); // Shutdown Hazelcast properly hzMember.close(); } catch (HazelcastInstanceNotActiveException e) { // hazelcastCluster may be already closed by the shutdown hook LOGGER.debug("Unable to close Hazelcast cluster", e); } } }
@Override public void close() { if (hzMember != null) { if (healthStateSharing != null) { healthStateSharing.stop(); } try { // Removing listeners operationalProcesses.removeEntryListener(operationalProcessListenerUUID); hzMember.getCluster().removeMembershipListener(nodeDisconnectedListenerUUID); // Removing the operationalProcess from the replicated map operationalProcesses.keySet().forEach( clusterNodeProcess -> { if (clusterNodeProcess.getNodeUuid().equals(hzMember.getUuid())) { operationalProcesses.remove(clusterNodeProcess); } }); // Shutdown Hazelcast properly hzMember.close(); } catch (HazelcastInstanceNotActiveException e) { // hazelcastCluster may be already closed by the shutdown hook LOGGER.debug("Unable to close Hazelcast cluster", e); } } }
@Override protected void doStop() { if (this.distributedObject instanceof IMap) { ((IMap<?, ?>) this.distributedObject).removeEntryListener(getHazelcastRegisteredEventListenerId()); } else if (this.distributedObject instanceof MultiMap) { ((MultiMap<?, ?>) this.distributedObject).removeEntryListener(getHazelcastRegisteredEventListenerId()); } else if (this.distributedObject instanceof ReplicatedMap) { ((ReplicatedMap<?, ?>) this.distributedObject).removeEntryListener(getHazelcastRegisteredEventListenerId()); } else if (this.distributedObject instanceof IList) { ((IList<?>) this.distributedObject).removeItemListener(getHazelcastRegisteredEventListenerId()); } else if (this.distributedObject instanceof ISet) { ((ISet<?>) this.distributedObject).removeItemListener(getHazelcastRegisteredEventListenerId()); } else if (this.distributedObject instanceof IQueue) { ((IQueue<?>) this.distributedObject).removeItemListener(getHazelcastRegisteredEventListenerId()); } else if (this.distributedObject instanceof ITopic) { ((ITopic<?>) this.distributedObject).removeMessageListener(getHazelcastRegisteredEventListenerId()); } }