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

x33g5p2x  于2022-01-25 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(118)

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

Member.setStringAttribute介绍

[英]Defines a key-value pair string attribute for this member available to other cluster members.
[中]定义此成员的键值对字符串属性,该属性可供其他集群成员使用。

代码示例

代码示例来源:origin: org.apache.karaf.cellar/org.apache.karaf.cellar.hazelcast

public void setNodeAlias(String alias) {
  Cluster cluster = instance.getCluster();
  if (cluster != null) {
    Member member = cluster.getLocalMember();
    member.setStringAttribute("alias", alias);
  }
}

代码示例来源:origin: apache/karaf-cellar

public void setNodeAlias(String alias) {
  Cluster cluster = instance.getCluster();
  if (cluster != null) {
    Member member = cluster.getLocalMember();
    member.setStringAttribute("alias", alias);
  }
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public Boolean call() throws Exception {
  logger.trace("call.enter;");
  HazelcastInstance hzInstance = findSystemInstance();
  Member member = hzInstance.getCluster().getLocalMember();
  boolean result = false;
  for (String key: options.stringPropertyNames()) {
    String oldValue = member.getStringAttribute(key);
    String newValue = options.getProperty(key);
    if (!(newValue.equals(oldValue))) {
      member.setStringAttribute(key, newValue);
      result = true;
    }
  }
    
  // now flush node properties no its props file
  String propsPath = System.getProperty(pn_config_path);
  String propsName = System.getProperty(pn_config_properties_file);
  if (propsName != null) {
    storeOptions(propsPath + "/" + propsName);
  } else {
    logger.warn("call; properties file name not specified; can't persist them");
  }
  logger.trace("call.exit; returning: {}", result);
  return result;
}

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

public static void testMembershipEvent(final HazelcastInstance instance,
    final PollableChannel channel, final String key, final String value) {
  Member member = instance.getCluster().getMembers().iterator().next();
  member.setStringAttribute(key, value);
  Message<?> msg = channel.receive(TIMEOUT);
  verifyMembershipEvent(msg, MembershipEvent.MEMBER_ATTRIBUTE_CHANGED);
}

相关文章