• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java TimeSpan类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.skife.config.TimeSpan的典型用法代码示例。如果您正苦于以下问题:Java TimeSpan类的具体用法?Java TimeSpan怎么用?Java TimeSpan使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

TimeSpan类属于org.skife.config包,在下文中一共展示了TimeSpan类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: sendEmailForUpComingInvoice

点赞 3

import org.skife.config.TimeSpan; //导入依赖的package包/类
private void sendEmailForUpComingInvoice(final Account account, final ExtBusEvent killbillEvent, final TenantContext context) throws IOException, InvoiceApiException, EmailException, TenantApiException, EmailNotificationException {

        Preconditions.checkArgument(killbillEvent.getEventType() == ExtBusEventType.INVOICE_NOTIFICATION, String.format("Unexpected event %s", killbillEvent.getEventType()));

        final String dryRunTimePropValue = configProperties.getString(INVOICE_DRY_RUN_TIME_PROPERTY);
        Preconditions.checkArgument(dryRunTimePropValue != null, String.format("Cannot find property %s", INVOICE_DRY_RUN_TIME_PROPERTY));

        final TimeSpan span = new TimeSpan(dryRunTimePropValue);

        final DateTime now = clock.getClock().getUTCNow();
        final DateTime targetDateTime = now.plus(span.getMillis());

        final PluginCallContext callContext = new PluginCallContext(EmailNotificationActivator.PLUGIN_NAME, now, context.getTenantId());
        final Invoice invoice = osgiKillbillAPI.getInvoiceUserApi().triggerInvoiceGeneration(account.getId(), new LocalDate(targetDateTime, account.getTimeZone()), NULL_DRY_RUN_ARGUMENTS, callContext);
        if (invoice != null) {
            final EmailContent emailContent = templateRenderer.generateEmailForUpComingInvoice(account, invoice, context);
            sendEmail(account, emailContent, context);
        }
    }
 

开发者ID:killbill,
项目名称:killbill-email-notifications-plugin,
代码行数:20,
代码来源:EmailNotificationListener.java

示例2: create

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
private ExecutorService create() {
    Preconditions.checkArgument(config != null, "no config injected");

    Integer queueSize = Objects.firstNonNull(config.getQueueSize(), defaultQueueSize);
    Integer minThreads = Objects.firstNonNull(config.getMinThreads(), defaultMinThreads);
    Integer maxThreads = Objects.firstNonNull(config.getMaxThreads(), defaultMaxThreads);
    TimeSpan threadTimeout = Objects.firstNonNull(config.getThreadTimeout(), defaultTimeout);
    RejectedHandler rejectedHandlerEnum = config.getRejectedHandler();
    RejectedExecutionHandler rejectedHandler = rejectedHandlerEnum != null ? rejectedHandlerEnum.getHandler() : defaultRejectedHandler;

    final BlockingQueue<Runnable> queue;
    final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(threadPoolName + "-%d").build();

    if (queueSize == 0) {
        queue = new SynchronousQueue<Runnable>();
    } else {
        queue = new LinkedBlockingQueue<Runnable>(queueSize);
    }

    final ExecutorService result;

    if (maxThreads <= 0) {
        result = MoreExecutors.sameThreadExecutor();
        management = new GenericExecutorManagementBean(result, new SynchronousQueue<>());
    } else {
        ThreadPoolExecutor executor = new LoggingExecutor(
                minThreads,
                maxThreads,
                threadTimeout.getMillis(),
                TimeUnit.MILLISECONDS,
                queue,
                threadFactory,
                rejectedHandler);
        management = new ThreadPoolExecutorManagementBean(executor);
        result = executor;
    }

    return DecoratingExecutors.decorate(result, CallableWrappers.combine(wrappers));
}
 

开发者ID:NessComputing,
项目名称:components-ness-executors,
代码行数:40,
代码来源:NessThreadPoolModule.java

示例3: createDecimatingSampleFilter

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
private DecimatingSampleFilter createDecimatingSampleFilter(final Integer outputCount, final DecimationMode decimationMode, final DateTime startTime, final DateTime endTime) {
    final DecimatingSampleFilter rangeSampleProcessor;
    if (outputCount == null) {
        rangeSampleProcessor = null;
    } else {
        // TODO Fix the polling interval
        rangeSampleProcessor = new DecimatingSampleFilter(startTime, endTime, outputCount, new TimeSpan("1s"), decimationMode, new CSVSampleProcessor());
    }

    return rangeSampleProcessor;
}
 

开发者ID:killbill,
项目名称:killbill-meter-plugin,
代码行数:12,
代码来源:DecimatingJsonSamplesOutputer.java

示例4: DecimatingSampleFilter

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
/**
 * Build a DecimatingSampleFilter on which you call processSamples()
 *
 * @param startTime       The start time we're considering values, or null, meaning all time
 * @param endTime         The end time we're considering values, or null, meaning all time
 * @param outputCount     The number of samples to generate
 * @param sampleCount     The number of samples to be scanned.  sampleCount must be >= outputCount
 * @param pollingInterval The polling interval, used to compute sample counts assuming no gaps
 * @param decimationMode  The decimation mode determines how samples will be combined to crate an output point.
 * @param sampleProcessor The implementor of the TimeRangeSampleProcessor abstract class
 */
public DecimatingSampleFilter(final DateTime startTime, final DateTime endTime, final int outputCount, final int sampleCount,
                              final TimeSpan pollingInterval, final DecimationMode decimationMode, final TimeRangeSampleProcessor sampleProcessor) {
    super(startTime, endTime);
    if (outputCount <= 0 || sampleCount <= 0 || outputCount > sampleCount) {
        throw new IllegalArgumentException(String.format("In DecimatingSampleFilter, outputCount is %d but sampleCount is %d", outputCount, sampleCount));
    }
    this.outputCount = outputCount;
    this.pollingInterval = pollingInterval;
    this.decimationMode = decimationMode;
    this.sampleProcessor = sampleProcessor;
    initializeFilterHistory(sampleCount);
}
 

开发者ID:killbill,
项目名称:killbill-meter-plugin,
代码行数:24,
代码来源:DecimatingSampleFilter.java

示例5: getForwardBankInterval

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
@Description("The time interval at which funds will be forwarded to the bank")
@Config("org.killbill.billing.plugin.bitcoin.forward.interval")
@Default("1h")
public TimeSpan getForwardBankInterval();
 

开发者ID:killbill,
项目名称:killbill-bitcoin-plugin,
代码行数:5,
代码来源:BitcoinConfig.java

示例6: main

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
public static void main(String[] args) throws InsufficientMoneyException {

        final BitcoinConfig config = new BitcoinConfig() {
            @Override
            public boolean shouldGenerateKey() {
                return false;
            }

            @Override
            public int getConfidenceBlockDepth() {
                return 1;
            }

            @Override
            public String getInstallDirectory() {
                return DEFAULT_INSTALL_DIR;
            }

            @Override
            public String getNetworkName() {
                return NETWORK;
            }

            @Override
            public List<String> getKillbillBitcoinPlugins() {
                return Collections.singletonList("killbill-coinbase");
            }

            @Override
            public String getForwardBankHash() {
                return null;
            }

            @Override
            public Long getMinForwardBalance() {
                return null;
            }

            @Override
            public TimeSpan getForwardBankInterval() {
                return null;
            }

        };
        final TestBitcoinListener test = new TestBitcoinListener(config);
        test.initializeBitcoinListener();
        test.makePaymentTo();
    }
 

开发者ID:killbill,
项目名称:killbill-bitcoin-plugin,
代码行数:49,
代码来源:TestBitcoinListener.java

示例7: idleTimeout

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
@Config("basic.server.idle-timeout")
@Default("30000ms")
TimeSpan idleTimeout();
 

开发者ID:benhardy,
项目名称:lilrest,
代码行数:4,
代码来源:JaxRsServerConfig.java

示例8: getThreadTimeout

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
/**
 * How long a thread may remain totally idle before the pool shrinks.
 */
@Config("timeout")
@DefaultNull // (DEFAULT_TIMEOUT)
TimeSpan getThreadTimeout();
 

开发者ID:NessComputing,
项目名称:components-ness-executors,
代码行数:7,
代码来源:ThreadPoolConfiguration.java

示例9: setKeepAliveTime

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
@Override
@Managed
public void setKeepAliveTime(String keepAliveTime)
{
    setKeepAliveTime(new TimeSpan(keepAliveTime).getMillis());
}
 

开发者ID:NessComputing,
项目名称:components-ness-executors,
代码行数:7,
代码来源:ThreadPoolExecutorManagementBean.java

示例10: withDefaultThreadTimeout

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
/**
 * Set the default worker thread idle timeout.
 */
public NessThreadPoolModule withDefaultThreadTimeout(long duration, TimeUnit units)
{
    defaultTimeout = new TimeSpan(duration, units);
    return this;
}
 

开发者ID:NessComputing,
项目名称:components-ness-executors,
代码行数:9,
代码来源:NessThreadPoolModule.java

示例11: getTimelineLength

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
@Config("org.killbill.billing.plugin.meter.timelines.length")
@Description("How long to buffer data in memory before flushing it to the database")
@Default("60m")
TimeSpan getTimelineLength();
 

开发者ID:killbill,
项目名称:killbill-meter-plugin,
代码行数:5,
代码来源:MeterConfig.java

示例12: getPollingInterval

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
@Config("org.killbill.billing.plugin.meter.timelines.pollingInterval")
@Description("How long to between attribute polling.  This constant should be replaced by a flexible mechanism")
@Default("30s")
TimeSpan getPollingInterval();
 

开发者ID:killbill,
项目名称:killbill-meter-plugin,
代码行数:5,
代码来源:MeterConfig.java

示例13: getBackgroundWriteCheckInterval

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
@Config("org.killbill.billing.plugin.meter.timelines.backgroundWriteCheckInterval")
@Description("The time interval between checks to see if we should perform background writes")
@Default("1s")
TimeSpan getBackgroundWriteCheckInterval();
 

开发者ID:killbill,
项目名称:killbill-meter-plugin,
代码行数:5,
代码来源:MeterConfig.java

示例14: getBackgroundWriteMaxDelay

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
@Config("org.killbill.billing.plugin.meter.timelines.backgroundWriteMaxDelay")
@Description("The maximum timespan after pending chunks are added before we perform background writes")
@Default("1m")
TimeSpan getBackgroundWriteMaxDelay();
 

开发者ID:killbill,
项目名称:killbill-meter-plugin,
代码行数:5,
代码来源:MeterConfig.java

示例15: getAggregationInterval

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
@Config("org.killbill.billing.plugin.meter.timelines.aggregationInterval")
@Description("How often to check to see if there are timelines ready to be aggregated")
@Default("2h")
TimeSpan getAggregationInterval();
 

开发者ID:killbill,
项目名称:killbill-meter-plugin,
代码行数:5,
代码来源:MeterConfig.java

示例16: getAggregationSleepBetweenBatches

点赞 2

import org.skife.config.TimeSpan; //导入依赖的package包/类
@Config("org.killbill.billing.plugin.meter.timelines.aggregationSleepBetweenBatches")
@Description("How long to sleep between aggregation batches")
@Default("50ms")
TimeSpan getAggregationSleepBetweenBatches();
 

开发者ID:killbill,
项目名称:killbill-meter-plugin,
代码行数:5,
代码来源:MeterConfig.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)