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

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

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

Config.getMapEventJournalConfig介绍

[英]Returns the map event journal config for the given name, creating one if necessary and adding it to the collection of known configurations.

The configuration is found by matching the configuration name pattern to the provided name without the partition qualifier (the part of the name after '@'). If no configuration matches, it will create one by cloning the "default" configuration and add it to the configuration collection.

If there is no default config as well, it will create one and disable the event journal by default. This method is intended to easily and fluently create and add configurations more specific than the default configuration without explicitly adding it by invoking #addEventJournalConfig(EventJournalConfig).

Because it adds new configurations if they are not already present, this method is intended to be used before this config is used to create a hazelcast instance. Afterwards, newly added configurations may be ignored.
[中]返回给定名称的映射事件日志配置,必要时创建一个,并将其添加到已知配置的集合中。
通过将配置名称模式与不带分区限定符的提供名称(名称中“@”之后的部分)匹配,可以找到配置。如果没有匹配的配置,它将通过克隆“默认”配置创建一个配置,并将其添加到配置集合中。
如果也没有默认配置,它将创建一个,并在默认情况下禁用事件日志。此方法旨在轻松流畅地创建和添加比默认配置更具体的配置,而无需通过调用#addEventJournalConfig(EventJournalConfig)显式添加。
因为如果新配置尚未出现,它会添加新配置,所以此方法将在使用此配置创建hazelcast实例之前使用。之后,可能会忽略新添加的配置。

代码示例

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

@Override
public EventJournalConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
  return staticConfig.getMapEventJournalConfig(name);
}

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

@Override
public EventJournalConfig getStaticConfig(@Nonnull Config staticConfig, @Nonnull String name) {
  return staticConfig.getMapEventJournalConfig(name);
}

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

public static void main(String[] args) throws Exception {
  System.setProperty("hazelcast.logging.type", "log4j");
  // Lower operation timeout to speed up job cancellation
  System.setProperty("hazelcast.operation.call.timeout.millis", "1000");
  JetConfig cfg = new JetConfig();
  cfg.getHazelcastConfig().getMapEventJournalConfig(TRADES).setEnabled(true);
  JetInstance jet = Jet.newJetInstance(cfg);
  Jet.newJetInstance(cfg);
  new Enrichment(jet).go();
}

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

private static JetConfig getJetConfig() {
  JetConfig cfg = new JetConfig();
  // Add an event journal config for map which has custom capacity of 1000 (default 10_000)
  // and time to live seconds as 10 seconds (default 0 which means infinite)
  cfg.getHazelcastConfig()
    .getMapEventJournalConfig(MAP_NAME)
    .setEnabled(true)
    .setCapacity(1000)
    .setTimeToLiveSeconds(10);
  return cfg;
}

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

/**
 * Returns a read-only map {@link EventJournal}
 * configuration for the given name.
 * <p>
 * The name is matched by pattern to the configuration and by stripping the
 * partition ID qualifier from the given {@code name}.
 * If there is no config found by the name, it will return the configuration
 * with the name {@code default}.
 *
 * @param name name of the map event journal config
 * @return the map event journal configuration
 * @throws ConfigurationException if ambiguous configurations are found
 * @see StringPartitioningStrategy#getBaseName(java.lang.String)
 * @see #setConfigPatternMatcher(ConfigPatternMatcher)
 * @see #getConfigPatternMatcher()
 * @see EvictionConfig#setSize(int)
 */
public EventJournalConfig findMapEventJournalConfig(String name) {
  name = getBaseName(name);
  final EventJournalConfig config = lookupByPattern(configPatternMatcher, mapEventJournalConfigs, name);
  if (config != null) {
    return config.getAsReadOnly();
  }
  return getMapEventJournalConfig("default").getAsReadOnly();
}

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

/**
 * Returns a read-only map {@link EventJournal}
 * configuration for the given name.
 * <p>
 * The name is matched by pattern to the configuration and by stripping the
 * partition ID qualifier from the given {@code name}.
 * If there is no config found by the name, it will return the configuration
 * with the name {@code default}.
 *
 * @param name name of the map event journal config
 * @return the map event journal configuration
 * @throws ConfigurationException if ambiguous configurations are found
 * @see StringPartitioningStrategy#getBaseName(java.lang.String)
 * @see #setConfigPatternMatcher(ConfigPatternMatcher)
 * @see #getConfigPatternMatcher()
 * @see EvictionConfig#setSize(int)
 */
public EventJournalConfig findMapEventJournalConfig(String name) {
  name = getBaseName(name);
  final EventJournalConfig config = lookupByPattern(configPatternMatcher, mapEventJournalConfigs, name);
  if (config != null) {
    return config.getAsReadOnly();
  }
  return getMapEventJournalConfig("default").getAsReadOnly();
}

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

public static void main(String[] args) throws Exception {
    System.setProperty("hazelcast.logging.type", "log4j");
    // All IMap partitions must receive updates for the watermark to advance
    // correctly. Since we use just a handful of keys in this sample, we set a
    // low partition count.
    System.setProperty("hazelcast.partition.count", "1");

    JetConfig cfg = new JetConfig();
    cfg.getHazelcastConfig().getMapEventJournalConfig("*").setEnabled(true);
    JetInstance jet = Jet.newJetInstance(cfg);
    ProducerTask producer = new ProducerTask(jet);

    try {
      // uncomment one of these
//            Pipeline p = aggregate();
//            Pipeline p = groupAndAggregate();
      Pipeline p = coGroup();
//            Pipeline p = coGroupWithBuilder();

      System.out.println("Running pipeline " + p);
      Job job = jet.newJob(p);
      Thread.sleep(5000);
      producer.stop();
      job.cancel();
    } finally {
      producer.stop();
      Jet.shutdownAll();
    }
  }

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

config.getHazelcastConfig().getMapEventJournalConfig("source").setEnabled(true);
JetInstance instance1 = Jet.newJetInstance(config);
JetInstance instance2 = Jet.newJetInstance(config);

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

config.getHazelcastConfig().getMapEventJournalConfig("source").setEnabled(true);
JetInstance instance1 = Jet.newJetInstance(config);
JetInstance instance2 = Jet.newJetInstance(config);

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

config.getHazelcastConfig().getMapEventJournalConfig("source").setEnabled(true);
JetInstance instance1 = Jet.newJetInstance(config);
JetInstance instance2 = Jet.newJetInstance(config);

相关文章

微信公众号

最新文章

更多

Config类方法