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

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

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

Config.setProperty介绍

[英]Sets the value of a named property.
[中]设置命名属性的值。

代码示例

代码示例来源:origin: paascloud/paascloud-master

/**
 * Hazelcast config config.
 *
 * @return the config
 */
@Bean
public Config hazelcastConfig() {
  return new Config().setProperty("hazelcast.jmx", "true")
      .addMapConfig(new MapConfig("spring-boot-admin-application-store").setBackupCount(1)
          .setEvictionPolicy(EvictionPolicy.NONE))
      .addListConfig(new ListConfig("spring-boot-admin-event-store").setBackupCount(1)
          .setMaxSize(1000));
}

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

.setProperty("hazelcast.tcp.join.port.try.count", "10")
.setProperty("hazelcast.socket.bind.any", "false")
.setProperty("hazelcast.phone.home.enabled", "false")
.setProperty("hazelcast.logging.type", "slf4j");

代码示例来源:origin: stackoverflow.com

Config config = new Config(); 
config.setProperty("hazelcast.initial.min.cluster.size","3");

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

@Bean
public HazelcastInstance hazelcastInstance() {
  return Hazelcast.newHazelcastInstance(new Config().setProperty("hazelcast.logging.type", "slf4j"));
}

代码示例来源:origin: com.sitewhere/sitewhere-core

/**
 * Override properties.
 * 
 * @param config
 */
public static void performPropertyOverrides(Config config) {
config.setProperty(GroupProperties.PROP_LOGGING_TYPE, "log4j2");
config.setProperty(GroupProperties.PROP_REST_ENABLED, "true");
config.setProperty(GroupProperties.PROP_SHUTDOWNHOOK_ENABLED, "false");
}

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

@Override
public Config setProperty(String name, String value) {
  return staticConfig.setProperty(name, value);
}

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

@Override
public Config setProperty(String name, String value) {
  return staticConfig.setProperty(name, value);
}

代码示例来源:origin: org.apache.camel/camel-hazelcast

public static HazelcastInstance newInstance() {
  Config cfg = new XmlConfigBuilder().build();
  // hazelcast.version.check.enabled is deprecated
  cfg.setProperty(
    "hazelcast.phone.home.enabled",
    System.getProperty("hazelcast.phone.home.enabled", "false")
  );
  cfg.setProperty(
    "hazelcast.logging.type",
    System.getProperty("hazelcast.logging.type", "slf4j")
  );
  return newInstance(cfg);
}

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

public static void main(String[] args) throws Exception {
    Config config = new Config();
    config.setProperty("hazelcast.rest.enabled", "true");
    HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
    Person person = new Person("Joe");

    IMap<String, String> hzSimpleMap = hz.getMap("simple");
    hzSimpleMap.set("key1", "value1");

    IMap<String, Person> hzObjectMap = hz.getMap("object");
    hzObjectMap.set("key1", person);
  }
}

代码示例来源: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

public static void main(String[] args) {
  Config config = new Config();
  config.setProperty("hazelcast.map.entry.filtering.natural.event.types", "true");
  HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
  IMap<String, String> map = hz.getMap("map");
  map.addEntryListener(new MyEntryListener(),
      new SqlPredicate("name=peter"), true);
  System.out.println("EntryListener registered");
}

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

public static void applyMetricsConfig(Config hzConfig, MetricsConfig metricsConfig) {
  if (metricsConfig.isEnabled()) {
    hzConfig.setProperty(Diagnostics.METRICS_LEVEL.getName(), ProbeLevel.INFO.name());
    if (metricsConfig.isMetricsForDataStructuresEnabled()) {
      hzConfig.setProperty(Diagnostics.METRICS_DISTRIBUTED_DATASTRUCTURES.getName(), "true");
    }
  }
}

代码示例来源: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: io.skullabs.kikaha/kikaha-hazelcast

/**
   * Configure a connection as a cluster node.
   *
   * @return ClientConfig
   */
  private com.hazelcast.config.Config loadConfig() throws Exception {
    final String configFile = config.getString("server.hazelcast.config");
    final com.hazelcast.config.Config config = new XmlConfigBuilder( configFile ).build();
    config.setProperty( "hazelcast.logging.type", "slf4j" );
    return config;
  }
}

代码示例来源:origin: stackoverflow.com

Config config = new Config();
config.setProperty("hazelcast.shutdownhook.enabled", "false");
NetworkConfig network = config.getNetworkConfig();
network.getJoin().getTcpIpConfig().setEnabled(false);
network.getJoin().getMulticastConfig().setEnabled(false);
HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);

代码示例来源:origin: io.vertx/vertx-hazelcast

private Config createConfig() {
 return new Config()
  .setProperty("hazelcast.wait.seconds.before.join", "0")
  .setProperty("hazelcast.local.localAddress", "127.0.0.1")
  .setGroupConfig(new GroupConfig()
   .setName(System.getProperty("vertx.hazelcast.test.group.name"))
   .setPassword(System.getProperty("vertx.hazelcast.test.group.password")));
}

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

private static Config createConfig() {
  Config config = new Config();
  config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
  config.setProperty("hazelcast.wait.seconds.before.join", "0");
  SocketInterceptorConfig interceptorConfig = new SocketInterceptorConfig();
  interceptorConfig.setEnabled(true).setClassName(MySocketInterceptor.class.getName());
  config.getNetworkConfig().setSocketInterceptorConfig(interceptorConfig);
  return config;
}

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

private static Config createConfig() {
  Config config = new Config();
  config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
  config.setProperty("hazelcast.wait.seconds.before.join", "0");
  SocketInterceptorConfig interceptorConfig = new SocketInterceptorConfig();
  interceptorConfig.setEnabled(true).setClassName(MySocketInterceptor.class.getName());
  config.getNetworkConfig().setSocketInterceptorConfig(interceptorConfig);
  return config;
}

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

private static Config createConfig() {
  Config config = new Config();
  config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
  config.setProperty("hazelcast.wait.seconds.before.join", "0");
  SecurityInterceptorConfig securityInterceptorConfig = new SecurityInterceptorConfig();
  securityInterceptorConfig.setClassName(MySecurityInterceptor.class.getName());
  SecurityConfig securityConfig = config.getSecurityConfig();
  securityConfig.setEnabled(true).addSecurityInterceptorConfig(securityInterceptorConfig);
  // when you enable security all client requests are denied, so we need to give permission first
  // security-interceptor will be run after checking this permission
  PermissionConfig permissionConfig = new PermissionConfig(PermissionConfig.PermissionType.ALL, "", null);
  securityConfig.addClientPermissionConfig(permissionConfig);
  return config;
}

代码示例来源:origin: mokies/ratelimitj

static HazelcastInstance newStandaloneHazelcastInstance() {
    Config config = new Config();
    config.setProperty("hazelcast.logging.type", "slf4j");
    config.setProperty("hazelcast.shutdownhook.enabled", "false");
    NetworkConfig network = config.getNetworkConfig();
    network.getJoin().getTcpIpConfig().setEnabled(false);
    network.getJoin().getMulticastConfig().setEnabled(false);
    return Hazelcast.newHazelcastInstance(config);
  }
}

相关文章

微信公众号

最新文章

更多

Config类方法