com.hazelcast.config.Config.getGroupConfig()方法的使用及代码示例

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

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

Config.getGroupConfig介绍

[英]Returns the configuration for hazelcast groups. Members of a cluster must share the same group configuration. Other instances that are reachable but don't have the same group configuration will form independent clusters.
[中]返回hazelcast组的配置。群集成员必须共享相同的组配置。其他可访问但不具有相同组配置的实例将形成独立的集群。

代码示例

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

config.getGroupConfig().setName("SonarQube");

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

private void handleGroup(Node node) {
  for (Node n : childElements(node)) {
    String value = getTextContent(n).trim();
    String nodeName = cleanNodeName(n);
    if ("name".equals(nodeName)) {
      config.getGroupConfig().setName(value);
    } else if ("password".equals(nodeName)) {
      config.getGroupConfig().setPassword(value);
    }
  }
}

代码示例来源:origin: hazelcast/hazelcast-jet

private void handleGroup(Node node) {
  for (Node n : childElements(node)) {
    String value = getTextContent(n).trim();
    String nodeName = cleanNodeName(n);
    if ("name".equals(nodeName)) {
      config.getGroupConfig().setName(value);
    } else if ("password".equals(nodeName)) {
      config.getGroupConfig().setPassword(value);
    }
  }
}

代码示例来源:origin: hazelcast/hazelcast-jet

public XAResourceImpl(NodeEngine nodeEngine, XAService service) {
  super(nodeEngine, service);
  GroupConfig groupConfig = nodeEngine.getConfig().getGroupConfig();
  groupName = groupConfig.getName();
  logger = nodeEngine.getLogger(getClass());
}

代码示例来源:origin: hazelcast/hazelcast-jet

private AuthenticationStatus authenticate(UsernamePasswordCredentials credentials) {
  GroupConfig groupConfig = nodeEngine.getConfig().getGroupConfig();
  String nodeGroupName = groupConfig.getName();
  boolean usernameMatch = nodeGroupName.equals(credentials.getUsername());
  return usernameMatch ? AUTHENTICATED : CREDENTIALS_FAILED;
}

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

private AuthenticationStatus authenticate(UsernamePasswordCredentials credentials) {
  GroupConfig groupConfig = nodeEngine.getConfig().getGroupConfig();
  String nodeGroupName = groupConfig.getName();
  boolean usernameMatch = nodeGroupName.equals(credentials.getUsername());
  return usernameMatch ? AuthenticationStatus.AUTHENTICATED : AuthenticationStatus.CREDENTIALS_FAILED;
}

代码示例来源:origin: fenix-framework/fenix-framework

public com.hazelcast.config.Config getHazelcastConfig() {
  System.setProperty("hazelcast.logging.type", "slf4j");
  com.hazelcast.config.Config hzlCfg = new ClasspathXmlConfig(getHazelcastConfigFile());
  hzlCfg.getGroupConfig().setName(HAZELCAST_FF_GROUP_NAME);
  return hzlCfg;
}

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

public XAResourceImpl(NodeEngine nodeEngine, XAService service) {
  super(nodeEngine, service);
  GroupConfig groupConfig = nodeEngine.getConfig().getGroupConfig();
  groupName = groupConfig.getName();
  logger = nodeEngine.getLogger(getClass());
}

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

private boolean checkCredentials(HttpPostCommand command) throws UnsupportedEncodingException {
  byte[] data = command.getData();
  final String[] strList = bytesToString(data).split("&");
  if (strList.length < 2) {
    return false;
  }
  final String groupName = URLDecoder.decode(strList[0], "UTF-8");
  final String groupPass = URLDecoder.decode(strList[1], "UTF-8");
  final GroupConfig groupConfig = textCommandService.getNode().getConfig().getGroupConfig();
  return groupConfig.getName().equals(groupName) && groupConfig.getPassword().equals(groupPass);
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public void run() {
  GroupConfig groupConfig = getNodeEngine().getConfig().getGroupConfig();
  if (!groupName.equals(groupConfig.getName())) {
    response = Boolean.FALSE;
  } else if (!groupPassword.equals(groupConfig.getPassword())) {
    response = Boolean.FALSE;
  }
}

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

@ManagedAnnotation("groupName")
@ManagedDescription("Group Name")
public String getGroupName() {
  return config.getGroupConfig().getName();
}

代码示例来源:origin: hazelcast/hazelcast-jet

@ManagedAnnotation("groupName")
@ManagedDescription("Group Name")
public String getGroupName() {
  return config.getGroupConfig().getName();
}

代码示例来源:origin: hazelcast/hazelcast-jet

private static Config defaultHazelcastConfig() {
    Config config = new Config();
    config.getNetworkConfig().getJoin().getMulticastConfig().setMulticastPort(DEFAULT_JET_MULTICAST_PORT);
    config.getGroupConfig().setName(DEFAULT_GROUP_NAME);
    config.getGroupConfig().setPassword(DEFAULT_GROUP_PASSWORD);
    return config;
  }
}

代码示例来源:origin: hazelcast/hazelcast-jet

private URL newGetTaskUrl() throws IOException {
  GroupConfig groupConfig = instance.getConfig().getGroupConfig();
  Address localAddress = instance.node.getClusterService().getLocalMember().getAddress();
  String urlString = cleanupUrl(managementCenterUrl) + "getTask.do?member=" + localAddress.getHost()
      + ":" + localAddress.getPort() + "&cluster=" + encode(groupConfig.getName(), "UTF-8");
  return new URL(urlString);
}

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

private URL newGetTaskUrl() throws IOException {
  GroupConfig groupConfig = instance.getConfig().getGroupConfig();
  Address localAddress = instance.node.getClusterService().getLocalMember().getAddress();
  String urlString = cleanupUrl(managementCenterUrl) + "getTask.do?member=" + localAddress.getHost()
      + ":" + localAddress.getPort() + "&cluster=" + encode(groupConfig.getName(), "UTF-8");
  return new URL(urlString);
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

protected static Config newProgrammaticConfig() {
  Config config = new Config();
  config.setProperty("hazelcast.merge.first.run.delay.seconds", "5");
  config.setProperty("hazelcast.merge.next.run.delay.seconds", "3");
  config.getGroupConfig().setName(generateRandomString(10));
  return config;
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

protected static Config newDeclarativeConfig() {
  try {
    Config config = new XmlConfigBuilder("src/main/resources/hazelcast-splitbrain.xml").build();
    config.setProperty("hazelcast.merge.first.run.delay.seconds", "5");
    config.setProperty("hazelcast.merge.next.run.delay.seconds", "3");
    config.getGroupConfig().setName(generateRandomString(10));
    return config;
  } catch (FileNotFoundException e) {
    throw ExceptionUtil.rethrow(e);
  }
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public void run() {
  JetService service = getService();
  HazelcastInstance instance = service.getJetInstance().getHazelcastInstance();
  Cluster cluster = instance.getCluster();
  String name = instance.getConfig().getGroupConfig().getName();
  response = new ClusterMetadata(name, cluster);
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

private static Config getConfigClusterB() {
    Config config = new Config();
    config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
    config.getGroupConfig().setName("clusterB").setPassword("clusterB-pass");
    config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
    config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("127.0.0.1:5702");
    return config;
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

private Config getConfigClusterB() {
  Config config = new Config();
  config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
  config.getGroupConfig().setName("clusterB").setPassword("clusterB-pass");
  config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
  config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("127.0.0.1:5702");
  config.setInstanceName("clusterB");
  config.getNetworkConfig().setPort(5702);
  config.setClassLoader(createCacheManagerClassLoader());
  return config;
}

相关文章

Config类方法