本文整理了Java中com.hazelcast.config.Config.findFlakeIdGeneratorConfig()
方法的一些代码示例,展示了Config.findFlakeIdGeneratorConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.findFlakeIdGeneratorConfig()
方法的具体详情如下:
包路径:com.hazelcast.config.Config
类名称:Config
方法名:findFlakeIdGeneratorConfig
[英]Returns a FlakeIdGeneratorConfig configuration for the given flake ID generator name.
The name is matched by pattern to the configuration and by stripping the partition ID qualifier from the given name. If there is no config found by the name, it will return the configuration with the name "default".
[中]返回给定薄片ID生成器名称的薄片ID生成器配置。
该名称通过模式与配置匹配,并从给定名称中剥离分区ID限定符。如果没有通过名称找到配置,它将返回名为“default”的配置。
代码示例来源:origin: hazelcast/hazelcast-jet
private int handleFlakeIdGenerator(MemberStateImpl memberState, int count, Config config,
Map<String, LocalFlakeIdGeneratorStats> flakeIdstats) {
for (Map.Entry<String, LocalFlakeIdGeneratorStats> entry : flakeIdstats.entrySet()) {
String name = entry.getKey();
if (config.findFlakeIdGeneratorConfig(name).isStatisticsEnabled()) {
LocalFlakeIdGeneratorStats stats = entry.getValue();
memberState.putLocalFlakeIdStats(name, stats);
++count;
}
}
return count;
}
代码示例来源:origin: com.hazelcast/hazelcast-all
private int handleFlakeIdGenerator(MemberStateImpl memberState, int count, Config config,
Map<String, LocalFlakeIdGeneratorStats> flakeIdstats) {
for (Map.Entry<String, LocalFlakeIdGeneratorStats> entry : flakeIdstats.entrySet()) {
String name = entry.getKey();
if (config.findFlakeIdGeneratorConfig(name).isStatisticsEnabled()) {
LocalFlakeIdGeneratorStats stats = entry.getValue();
memberState.putLocalFlakeIdStats(name, stats);
++count;
}
}
return count;
}
代码示例来源:origin: com.hazelcast/hazelcast-all
FlakeIdGeneratorProxy(String name, NodeEngine nodeEngine, FlakeIdGeneratorService service) {
super(nodeEngine, service);
this.name = name;
this.logger = nodeEngine.getLogger(getClass());
FlakeIdGeneratorConfig config = nodeEngine.getConfig().findFlakeIdGeneratorConfig(getName());
epochStart = EPOCH_START - (config.getIdOffset() >> (BITS_SEQUENCE + BITS_NODE_ID));
nodeIdOffset = config.getNodeIdOffset();
batcher = new AutoBatcher(config.getPrefetchCount(), config.getPrefetchValidityMillis(),
new AutoBatcher.IdBatchSupplier() {
@Override
public IdBatch newIdBatch(int batchSize) {
IdBatchAndWaitTime result = FlakeIdGeneratorProxy.this.newIdBatch(batchSize);
if (result.waitTimeMillis > 0) {
try {
Thread.sleep(result.waitTimeMillis);
} catch (InterruptedException e) {
currentThread().interrupt();
throw rethrow(e);
}
}
return result.idBatch;
}
});
if (logger.isFinestEnabled()) {
logger.finest("Created FlakeIdGeneratorProxy, name='" + name + "'");
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
FlakeIdGeneratorProxy(String name, NodeEngine nodeEngine, FlakeIdGeneratorService service) {
super(nodeEngine, service);
this.name = name;
this.logger = nodeEngine.getLogger(getClass());
FlakeIdGeneratorConfig config = nodeEngine.getConfig().findFlakeIdGeneratorConfig(getName());
epochStart = EPOCH_START - (config.getIdOffset() >> (BITS_SEQUENCE + BITS_NODE_ID));
nodeIdOffset = config.getNodeIdOffset();
batcher = new AutoBatcher(config.getPrefetchCount(), config.getPrefetchValidityMillis(),
new AutoBatcher.IdBatchSupplier() {
@Override
public IdBatch newIdBatch(int batchSize) {
IdBatchAndWaitTime result = FlakeIdGeneratorProxy.this.newIdBatch(batchSize);
if (result.waitTimeMillis > 0) {
try {
Thread.sleep(result.waitTimeMillis);
} catch (InterruptedException e) {
currentThread().interrupt();
throw rethrow(e);
}
}
return result.idBatch;
}
});
if (logger.isFinestEnabled()) {
logger.finest("Created FlakeIdGeneratorProxy, name='" + name + "'");
}
}
内容来源于网络,如有侵权,请联系作者删除!