本文整理匯總了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;
}
}