本文整理了Java中org.skife.config.TimeSpan.getMillis()
方法的一些代码示例,展示了TimeSpan.getMillis()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TimeSpan.getMillis()
方法的具体详情如下:
包路径:org.skife.config.TimeSpan
类名称:TimeSpan
方法名:getMillis
暂无
代码示例来源:origin: killbill/killbill
@Override
public SessionDAO get() {
final CachingSessionDAO sessionDao;
if (redisCacheConfig.isRedisCachingEnabled()) {
sessionDao = new RedisSessionDao();
} else {
sessionDao = new JDBCSessionDao(dbi, roDbi);
}
if (sessionManager instanceof DefaultSessionManager) {
final DefaultSessionManager defaultSessionManager = (DefaultSessionManager) sessionManager;
defaultSessionManager.setSessionDAO(sessionDao);
defaultSessionManager.setGlobalSessionTimeout(rbacConfig.getGlobalSessionTimeout().getMillis());
}
return sessionDao;
}
}
代码示例来源:origin: com.ning.billing/killbill-meter
public void runAggregationThread() {
aggregatorThread.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
getAndProcessTimelineAggregationCandidates();
}
},
config.getAggregationInterval().getMillis(),
config.getAggregationInterval().getMillis(),
TimeUnit.MILLISECONDS);
}
代码示例来源:origin: com.ning.billing/killbill-meter
public void startPurgeThread() {
purgeThread.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
purgeFilesAndAccumulators();
}
}, config.getTimelineLength().getMillis(),
config.getTimelineLength().getMillis(),
TimeUnit.MILLISECONDS);
}
代码示例来源:origin: com.nesscomputing.service.discovery/discovery-client
ServiceDiscoveryReader(final DiscoveryClientConfig discoveryConfig,
final ObjectMapper objectMapper,
final StateOfTheWorldHolder stateHolder)
{
super(discoveryConfig, objectMapper);
this.stateHolder = stateHolder;
this.penaltyTime = discoveryConfig.getPenaltyTime().getMillis() * 1000000L;
}
代码示例来源:origin: com.ning.billing/killbill-meter
public void runBackgroundWriteThread() {
if (!performForegroundWrites) {
backgroundWriteThread.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
maybePerformBackgroundWrites();
}
},
config.getBackgroundWriteCheckInterval().getMillis(),
config.getBackgroundWriteCheckInterval().getMillis(),
TimeUnit.MILLISECONDS);
}
}
代码示例来源:origin: com.opentable.components/otj-jaxrs-clientfactory-resteasy
private static RequestConfig customRequestConfig(JaxRsClientConfig config, RequestConfig.Builder base) {
base.setRedirectsEnabled(true);
if (config != null) {
base.setConnectionRequestTimeout((int) config.connectionPoolTimeout().getMillis())
.setConnectTimeout((int) config.connectTimeout().getMillis())
.setSocketTimeout((int) config.socketTimeout().getMillis());
}
return base.build();
}
代码示例来源:origin: com.nesscomputing.components/ness-jms
protected AbstractConsumer(@Nonnull final ConnectionFactory connectionFactory,
@Nonnull final JmsConfig jmsConfig,
@Nonnull final String topic,
@Nonnull final ConsumerCallback<Message> messageCallback)
{
super(connectionFactory, jmsConfig, topic);
this.messageCallback = messageCallback;
this.tickTimeout = getConfig().getTickTimeout().getMillis();
}
代码示例来源:origin: com.nesscomputing.components/ness-amqp
protected AbstractConsumer(@Nonnull final ConnectionFactory connectionFactory,
@Nonnull final AmqpConfig amqpConfig,
@Nonnull final String name,
@Nonnull final ConsumerCallback consumerCallback)
{
super(connectionFactory, amqpConfig, name);
this.consumerCallback = consumerCallback;
this.tickTimeout = getConfig().getTickTimeout().getMillis();
}
代码示例来源:origin: com.nesscomputing.service.discovery/discovery-client
ServiceDiscoveryRunnable(final String connectString,
final DiscoveryClientConfig discoveryConfig,
@Nonnull final Set<ServiceDiscoveryTask> visitors)
{
super(connectString, discoveryConfig.getTickInterval().getMillis());
this.visitors = visitors;
this.scanTicks = discoveryConfig.getScanInterval().getMillis() / discoveryConfig.getTickInterval().getMillis();
this.discoveryRoot = discoveryConfig.getRoot();
LOG.info("Scan Ticks is %d (Tick interval is %dms)", scanTicks, discoveryConfig.getTickInterval().getMillis());
}
代码示例来源:origin: com.nesscomputing.service.discovery/discovery-client
@Inject
public ZookeeperJobProcessor(@Named(DiscoveryClientModule.ZOOKEEPER_CONNECT_NAME) final String connectString,
final DiscoveryClientConfig discoveryClientConfig)
{
this.processingThread = new Thread(new JobProcessingRunnable(connectString, discoveryClientConfig.getTickInterval().getMillis()));
this.processingThread.setName("zookeeper-job-processor");
this.processingThread.setDaemon(true);
}
代码示例来源:origin: com.fasterxml.clustermate/clustermate-service
@Override
protected void init(SharedServiceStuff stuff,
Stores<?,?> stores,
ClusterViewByServer cluster,
AtomicBoolean shutdown)
{
super.init(stuff, stores, cluster, shutdown);
_fileManager = stuff.getFileManager();
// let's use max-TTL-plus-one-day
_maxTimeToLiveMsecs = stuff.getServiceConfig().cfgMaxMaxTTL.getMillis()
+ new TimeSpan("1d").getMillis();
}
代码示例来源:origin: org.kill-bill.commons/killbill-queue
private long getReapThreshold() {
final long threshold;
// if Claim time is greater than reap threshold
if (config.getClaimedTime().getMillis() >= config.getReapThreshold().getMillis()) {
// override reap threshold using claim time + 5 minutes
threshold = config.getClaimedTime().getMillis() + FIVE_MINUTES;
log.warn("{}: Reap threshold was mis-configured. Claim time [{}] is greater than reap threshold [{}]",
threadScheduledExecutorName, config.getClaimedTime().toString(), config.getReapThreshold().toString());
} else {
threshold = config.getReapThreshold().getMillis();
}
return threshold;
}
}
代码示例来源:origin: com.ning.billing/killbill-meter
private synchronized void purgeFilesAndAccumulators() {
this.purgeFilesAndAccumulators(new DateTime().minus(config.getTimelineLength().getMillis()), new DateTime().minus(2 * config.getTimelineLength().getMillis()));
}
代码示例来源:origin: com.ning.billing/killbill-meter
public TimelineSourceEventAccumulator getOrAddSourceEventAccumulator(final int sourceId, final int categoryId, final DateTime firstSampleTime) {
return this.getOrAddSourceEventAccumulator(sourceId, categoryId, firstSampleTime, (int) config.getTimelineLength().getMillis());
}
代码示例来源:origin: com.nesscomputing.components/ness-amqp
private void backoff(final Throwable t) throws InterruptedException
{
final long backoffTime = amqpConfig.getBackoffDelay().getMillis() * backoff;
LOG.warnDebug(t, "Could not connect to Broker, sleeping for %d ms...", backoffTime);
Thread.sleep(backoffTime);
if (backoff != 1 << amqpConfig.getMaxBackoffFactor()) {
backoff <<= 1;
}
channelDisconnect();
}
代码示例来源:origin: com.nesscomputing.components/ness-jms
private void backoff(final Throwable t) throws InterruptedException
{
final long backoffTime = jmsConfig.getBackoffDelay().getMillis() * backoff;
LOG.warnDebug(t, "Could not connect to Broker, sleeping for %d ms...", backoffTime);
Thread.sleep(backoffTime);
if (backoff != 1 << jmsConfig.getMaxBackoffFactor()) {
backoff <<= 1;
}
sessionDisconnect();
}
代码示例来源:origin: org.kill-bill.billing/killbill-payment
@Override
public PluginDispatcherReturnType<Void> call() throws Exception {
Thread.sleep(paymentConfig.getPaymentPluginTimeout().getMillis() + 100);
return null;
}
}, 100, TimeUnit.MILLISECONDS);
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
private boolean claimEntry(T entry) {
final Date nextAvailable = clock.getUTCNow().plus(config.getClaimedTime().getMillis()).toDate();
final boolean claimed = (sqlDao.claimEntry(entry.getRecordId(), clock.getUTCNow().toDate(), Hostname.get(), nextAvailable, config.getTableName()) == 1);
if (claimed && log.isDebugEnabled()) {
log.debug(DB_QUEUE_LOG_ID + "Claiming entry " + entry.getRecordId());
}
return claimed;
}
代码示例来源:origin: com.ning.billing/killbill-util
@Override
public JDBCSessionDao get() {
final JDBCSessionDao jdbcSessionDao = new JDBCSessionDao(dbi);
if (sessionManager instanceof DefaultSessionManager) {
final DefaultSessionManager defaultSessionManager = (DefaultSessionManager) sessionManager;
defaultSessionManager.setSessionDAO(jdbcSessionDao);
defaultSessionManager.setGlobalSessionTimeout(rbacConfig.getGlobalSessionTimeout().getMillis());
}
return jdbcSessionDao;
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-payment
@Test(groups = "slow")
public void testCreatePurchaseWithTimeout() throws Exception {
final BigDecimal requestedAmount = BigDecimal.TEN;
final String paymentExternalKey = "ohhhh";
final String transactionExternalKey = "naaahhh";
mockPaymentProviderPlugin.makePluginWaitSomeMilliseconds((int) (paymentConfig.getPaymentPluginTimeout().getMillis() + 100));
try {
paymentApi.createPurchase(account, account.getPaymentMethodId(), null, requestedAmount, Currency.AED, null,
paymentExternalKey, transactionExternalKey, ImmutableList.<PluginProperty>of(), callContext);
fail();
} catch (PaymentApiException e) {
assertEquals(e.getCode(), ErrorCode.PAYMENT_PLUGIN_TIMEOUT.getCode());
}
}
内容来源于网络,如有侵权,请联系作者删除!