當前位置: 首頁>>代碼示例>>Java>>正文


Java Config.getDuration方法代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:DevOpsStudio,項目名稱:Re-Collector,代碼行數:20,代碼來源:WindowsEventlogInputConfiguration.java

示例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));
        }
    }
}
 
開發者ID:DevOpsStudio,項目名稱:Re-Collector,代碼行數:13,代碼來源:MetricServiceConfiguration.java

示例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);
        }
    }
}
 
開發者ID:DevOpsStudio,項目名稱:Re-Collector,代碼行數:15,代碼來源:MemoryReporterServiceConfiguration.java

示例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;
    }
}
 
開發者ID:DevOpsStudio,項目名稱:Re-Collector,代碼行數:43,代碼來源:FileInputConfiguration.java


注:本文中的com.typesafe.config.Config.getDuration方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。