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

x33g5p2x  于2022-01-20 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(195)

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

Hazelcast.getCluster介绍

暂无

代码示例

代码示例来源:origin: apache/usergrid

public void init() {
  logger.info( "HazelcastLifecycleMonitor initializing..." );
  Hazelcast.addInstanceListener( this );
  Hazelcast.getCluster().addMembershipListener( this );
  logger.info( "HazelcastLifecycleMonitor initialized" );
}

代码示例来源:origin: apache/usergrid

@Test
public void doTest() {
  logger.info( "do test" );
  Hazelcast.addInstanceListener( this );
  ITopic<Object> topic = Hazelcast.getTopic( "default" );
  topic.addMessageListener( this );
  topic.publish( "my-message-object" );
  Collection<Instance> instances = Hazelcast.getInstances();
  for ( Instance instance : instances ) {
    logger.info( "ID: [" + instance.getId() + "] Type: [" + instance.getInstanceType() + "]" );
  }
  Set<Member> setMembers = Hazelcast.getCluster().getMembers();
  for ( Member member : setMembers ) {
    logger.info( "isLocalMember " + member.localMember() );
    logger.info( "member.inetsocketaddress " + member.getInetSocketAddress() );
  }
}

相关文章