com.hazelcast.core.Cluster.removeMembershipListener()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中com.hazelcast.core.Cluster.removeMembershipListener()方法的一些代码示例,展示了Cluster.removeMembershipListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cluster.removeMembershipListener()方法的具体详情如下:
包路径:com.hazelcast.core.Cluster
类名称:Cluster
方法名:removeMembershipListener

Cluster.removeMembershipListener介绍

[英]Removes the specified MembershipListener.

If the same MembershipListener is registered multiple times, it needs to be removed multiple times. This method can safely be called multiple times for the same registration ID; subsequent calls are ignored.
[中]删除指定的MembershipListener。
如果同一MembershipListener已注册多次,则需要将其删除多次。对于相同的注册ID,可以安全地多次调用此方法;随后的调用将被忽略。

代码示例

代码示例来源:origin: SonarSource/sonarqube

@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);
  }
 }
}

代码示例来源:origin: com.atlassian.cache/atlassian-cache-hazelcast

void destroy()
{
  cluster.removeMembershipListener(membershipListenerId);
  topic.removeMessageListener(topicListenerId);
}

代码示例来源:origin: com.atlassian.cache/atlassian-cache-hazelcast

void destroy()
{
  cluster.removeMembershipListener(membershipListenerId);
  topic.removeMessageListener(topicListenerId);
}

代码示例来源:origin: com.atlassian.cache/atlassian-cache-hazelcast

/**
 * De-registers listeners. This method must be called when the bean is no longer required.
 */
@PreDestroy
public void destroy()
{
  mapSettings.removeEntryListener(mapSettingsAddedListenerId);
  mapSettings.removeEntryListener(mapSettingsUpdatedListenerId);
  hazelcast.getCluster().removeMembershipListener(membershipListenerId);
}

代码示例来源:origin: spring-projects/spring-integration-extensions

@Override
protected void doStop() {
  if (this.hazelcastInstance.getLifecycleService().isRunning()) {
    String id = this.hazelcastRegisteredListenerIdMap.remove(ClusterMonitorType.MEMBERSHIP);
    if (id != null) {
      this.hazelcastInstance.getCluster().removeMembershipListener(id);
    }
    id = this.hazelcastRegisteredListenerIdMap.remove(ClusterMonitorType.DISTRIBUTED_OBJECT);
    if (id != null) {
      this.hazelcastInstance.removeDistributedObjectListener(id);
    }
    id = this.hazelcastRegisteredListenerIdMap.remove(ClusterMonitorType.MIGRATION);
    if (id != null) {
      this.hazelcastInstance.getPartitionService().removeMigrationListener(id);
    }
    id = this.hazelcastRegisteredListenerIdMap.remove(ClusterMonitorType.LIFECYCLE);
    if (id != null) {
      this.hazelcastInstance.getLifecycleService().removeLifecycleListener(id);
    }
    id = this.hazelcastRegisteredListenerIdMap.remove(ClusterMonitorType.CLIENT);
    if (id != null) {
      this.hazelcastInstance.getClientService().removeClientListener(id);
    }
  }
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-main

@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);
  }
 }
}

代码示例来源:origin: org.neo4j/neo4j-causal-clustering

@Override
public void stop()
{
  log.info( String.format( "HazelcastCoreTopologyService stopping and unbinding from %s",
      config.get( discovery_listen_address ) ) );
  // Interrupt the starting thread. Not really necessary, just cleaner exit
  startingThread.interrupt();
  // Flag to notify waiters
  stopped = true;
  if ( refreshJob != null )
  {
    refreshJob.cancel( true );
  }
  if ( hazelcastInstance != null && membershipRegistrationId != null )
  {
    try
    {
      hazelcastInstance.getCluster().removeMembershipListener( membershipRegistrationId );
      hazelcastInstance.getLifecycleService().shutdown();
    }
    catch ( Throwable e )
    {
      log.warn( "Failed to stop Hazelcast", e );
    }
  }
}

代码示例来源:origin: io.snamp/internal-services

hazelcastInstance.getCluster().removeMembershipListener(membershipListenerRegistration);
} catch (HazelcastInstanceNotActiveException e) {
  OLogManager.instance().error(this, "Hazelcast is already down", e);

代码示例来源:origin: org.neo4j/neo4j-core-edge

@Override
public void stop()
{
  log.info( String.format( "HazelcastCoreTopologyService stopping and unbinding from %s",
      config.get( CoreEdgeClusterSettings.discovery_listen_address ) ) );
  try
  {
    hazelcastInstance.getCluster().removeMembershipListener( membershipRegistrationId );
    hazelcastInstance.getMap( EDGE_SERVER_BOLT_ADDRESS_MAP_NAME ).removeEntryListener( mapRegistrationId );
    hazelcastInstance.getLifecycleService().terminate();
  }
  catch ( Throwable e )
  {
    log.warn( "Failed to stop Hazelcast", e );
  }
  finally
  {
    jobHandle.cancel( true );
  }
}

相关文章