本文整理汇总了Java中com.typesafe.config.Config.getDuration方法的典型用法代码示例。如果您正苦于以下问题:Java Config.getDuration方法的具体用法?Java Config.getDuration怎么用?Java Config.getDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.typesafe.config.Config
的用法示例。
在下文中一共展示了Config.getDuration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WindowsEventlogInputConfiguration
import com.typesafe.config.Config; //导入方法依赖的package包/类
@Inject
public WindowsEventlogInputConfiguration(@Assisted String id,
@Assisted Config config,
WindowsEventlogInput.Factory inputFactory) {
super(id, config);
this.inputFactory = inputFactory;
if (config.hasPath("source-name")) {
this.sourceName = config.getString("source-name");
} else {
this.sourceName = "Application";
}
if (config.hasPath("poll-interval")) {
this.pollInterval = config.getDuration("poll-interval", TimeUnit.MILLISECONDS);
} else {
this.pollInterval = 1000L;
}
}
示例2: MetricServiceConfiguration
import com.typesafe.config.Config; //导入方法依赖的package包/类
@Inject
public MetricServiceConfiguration(Config config) {
if (config.hasPath("metrics")) {
final Config metrics = config.getConfig("metrics");
this.enableLog = metrics.hasPath("enable-logging") && metrics.getBoolean("enable-logging");
if (metrics.hasPath("log-duration")) {
this.reportDuration = new Duration(metrics.getDuration("log-duration", TimeUnit.MILLISECONDS));
}
}
}
示例3: MemoryReporterServiceConfiguration
import com.typesafe.config.Config; //导入方法依赖的package包/类
@Inject
public MemoryReporterServiceConfiguration(final Config config) {
if (config.hasPath("debug")) {
final Config debug = config.getConfig("debug");
if (debug.hasPath("memory-reporter")) {
this.enable = debug.getBoolean("memory-reporter");
}
if (debug.hasPath("memory-reporter-interval")) {
this.interval = debug.getDuration("memory-reporter-interval", TimeUnit.MILLISECONDS);
}
}
}
示例4: FileInputConfiguration
import com.typesafe.config.Config; //导入方法依赖的package包/类
@Inject
public FileInputConfiguration(@Assisted String id,
@Assisted Config config,
FileInput.Factory inputFactory) {
super(id, config);
this.inputFactory = inputFactory;
if (config.hasPath("path-glob-root") && config.hasPath("path-glob-pattern")) {
this.path = new GlobPathSet(config.getString("path-glob-root"), config.getString("path-glob-pattern"));
} else {
if (config.hasPath("path")) {
this.path = new SinglePathSet(config.getString("path"));
}
}
if (config.hasPath("content-splitter")) {
this.contentSplitter = config.getString("content-splitter").toUpperCase(Locale.getDefault());
} else {
this.contentSplitter = "NEWLINE";
}
if (config.hasPath("content-splitter-pattern")) {
this.contentSplitterPattern = config.getString("content-splitter-pattern");
} else {
this.contentSplitterPattern = "";
}
if (config.hasPath("charset")) {
this.charsetString = config.getString("charset");
} else {
this.charsetString = "UTF-8";
}
if (config.hasPath("reader-buffer-size")) {
this.readerBufferSize = config.getInt("reader-buffer-size");
} else {
this.readerBufferSize = 102400;
}
if (config.hasPath("reader-interval")) {
this.readerInterval = config.getDuration("reader-interval", TimeUnit.MILLISECONDS);
} else {
this.readerInterval = 100L;
}
}