@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; } }
@Override public TimeSpan apply(final String input) { return new TimeSpan(input); } };
public void start() { final TimeUnit pendingRateUnit = tenantConfig.getTenantBroadcastServiceRunningRate().getUnit(); final long pendingPeriod = tenantConfig.getTenantBroadcastServiceRunningRate().getPeriod(); tenantExecutor.scheduleAtFixedRate(new TenantCacheInvalidationRunnable(this, broadcastDao, tenantDao), pendingPeriod, pendingPeriod, pendingRateUnit); }
@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(); }
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; } }
string span = "P18DT5H"; IFormatProvider formatProvider = System.Globalization.CultureInfo.InvariantCulture; TimeSpan timeSpan = TimeSpan.ParseExact(span, "'P'd'DT'h'H'", formatProvider); int hours = (int)Math.Floor(timeSpan.TotalHours); int minutes = (int)Math.Round(timeSpan.Subtract(new TimeSpan(hours, 0, 0)).TotalMinutes, 0, MidpointRounding.AwayFromZero); Console.WriteLine("{0} hours, {1} minutes", hours, minutes);
Date reapingDate = clock.getUTCNow().minusMinutes((int) config.getReapThreshold().getPeriod()).toDate(); queue.reapEntries(reapingDate);
Date reapingDate = clock.getUTCNow().minusMinutes((int) config.getReapThreshold().getPeriod()).toDate(); queue.reapEntries(reapingDate);
public DeferredDeleteConfig(int minQueueLength, int maxQueueLength, TimeSpan queueTargetDelayMsecs, TimeSpan queueMaxDelayMsecs) { if (minQueueLength > maxQueueLength) { throw new IllegalArgumentException("minQueueLength ("+minQueueLength+") can not exceed maxQueueLength ("+maxQueueLength+")"); } this.minQueueLength = minQueueLength; this.maxQueueLength = maxQueueLength; if (queueTargetDelayMsecs.getMillis() > queueMaxDelayMsecs.getMillis()) { throw new IllegalArgumentException("queueTargetDelayMsecs ("+queueTargetDelayMsecs+") can not exceed queueMaxDelayMsecs ("+queueMaxDelayMsecs+")"); } this.queueTargetDelayMsecs = queueTargetDelayMsecs; this.queueMaxDelayMsecs = queueMaxDelayMsecs; } }
WebDriver _driver = new WebDriver(); WebDriverWait _wait = new WebDriverWait(_driver, new TimeSpan(0, 1, 0)); _wait.Until(d => d.FindElement(By.Id("Id_Your_UIElement"));
@LifecycleHandlerType(LifecycleHandlerType.LifecycleLevel.START_SERVICE) public void start() { final TimeUnit pendingRateUnit = broadcastConfig.getBroadcastServiceRunningRate().getUnit(); final long pendingPeriod = broadcastConfig.getBroadcastServiceRunningRate().getPeriod(); broadcastExecutor.scheduleAtFixedRate(new BroadcastServiceRunnable(this, broadcastDao, eventBus), pendingPeriod, pendingPeriod, pendingRateUnit); }
protected void Calendar1_SelectionChanged(object sender, EventArgs e) { DateTime input = Calendar1.SelectedDate; int delta = DayOfWeek.Sunday - input.DayOfWeek; DateTime firstDay = input.AddDays(delta); for (int i = 0; i < 7; i++) Label1.Text += ((DateTime)(firstDay.Add(new TimeSpan(i, 0, 0, 0)))).ToShortDateString() + " -- "; }
public boolean offerWithTimeout(@Nonnull final T data) { Preconditions.checkNotNull(data, "the message can not be null!"); try { return messageQueue.offer(data, transmitTimeout.getPeriod(), transmitTimeout.getUnit()); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); return false; } }
public DeferredDeleteConfig() { this(5, 100, DEFAULT_TARGET_DELAY, new TimeSpan(2500, TimeUnit.MILLISECONDS) // !!! TEST // new TimeSpan(1000, TimeUnit.MILLISECONDS) ); }
ServiceDiscoveryReader(final DiscoveryClientConfig discoveryConfig, final ObjectMapper objectMapper, final StateOfTheWorldHolder stateHolder) { super(discoveryConfig, objectMapper); this.stateHolder = stateHolder; this.penaltyTime = discoveryConfig.getPenaltyTime().getMillis() * 1000000L; }
interface ISixty { DateTime SixtyDaysFromNow(); } public class Foo : ISixty { public DateTime SixtyDaysFromNow() { return DateTime.Now + new TimeSpan(60,0,0,0); } }