private long now() { return clock.getCurrentDate().getTime(); } }
public CompositeHealthStatus(final Application application, final String documentation, Clock clock) { this.application = application; this.documentation = documentation; this.healthy = true; this.time = clock.getCurrentDate().getTime(); }
private long now() { return clock.getCurrentDate().getTime(); }
/** * Consult the clock to get the current date. * * @return the current date as per the clock set in #setClock, or new Date() if * no clock is set */ public Date getCurrentDate() { if (clock != null) return clock.getCurrentDate(); return new Date(); }
/** * Consult the clock to get the current date. * * @return the current date as per the clock set in #setClock, or new Date() if * no clock is set */ public Date getCurrentDate() { if (clock != null) return clock.getCurrentDate(); return new Date(); }
final long getCurrentTime() { return clock.getCurrentDate().getTime(); }
private Timestamp currentDate() { return new Timestamp(clock.getCurrentDate().getTime()); } }
private DateTime now() { return new DateTime(clock.getCurrentDate().getTime(), DateTimeZone.UTC); }
private int getDaysUntilDate(final Date date) { if (date == null) { return Integer.MAX_VALUE; } else { final double days = ((double) (date.getTime() - clock.getCurrentDate().getTime())) / TimeUnit.DAYS.toMillis(1); return (int)Math.floor(days); } }
@Override @Nonnull public List<ReindexRequest> transitionStatus(@Nonnull Iterable<ReindexRequest> requests, @Nonnull ReindexStatus newStatus) { final long transitionTime = clock.getCurrentDate().getTime(); final ImmutableList.Builder<ReindexRequest> transitionedRequestBuilder = ImmutableList.builder(); for (ReindexRequest request : requests) { transitionedRequestBuilder.add(transitionStatus(request, newStatus, transitionTime)); } return transitionedRequestBuilder.build(); }
public List<QueryLiteral> getValues(final QueryCreationContext queryCreationContext, final FunctionOperand operand, final TerminalClause terminalClause) { return Collections.singletonList(new QueryLiteral(operand, clock.getCurrentDate().getTime())); }
private Date parseDuration(final String str) { try { final long offset = parseDurationOffset(str); final Date currentDate = clock.getCurrentDate(); return new Date(currentDate.getTime() + offset); } catch (InvalidDurationException e) { return null; } catch (NumberFormatException ne) { return null; } }
protected boolean wantFullStackTrace() { if (isDebugEnabled()) { return true; } // Check if the last full warning is too long ago and if so reset all and start again long systemTime = clock.getCurrentDate().getTime(); if (systemTime - lastWarning.get() > resetAfterMinutes) { warningsLogged.set(0); warningSuppressedMessageWritten.set(false); } lastWarning.set(systemTime); if (warningsLogged.incrementAndGet() <= maxStackTraces) { return true; } if (warningSuppressedMessageWritten.compareAndSet(false, true)) { delegate.warn("*******************************************************************************************************************"); delegate.warn("Further stacktraces of this type are temporarily suppressed."); delegate.warn("To enable full stacktraces set logger level for '" + name + "' to 'DEBUG' "); delegate.warn("*******************************************************************************************************************"); } return false; }
public long sizeOfFile() { final long currentTime = clock.getCurrentDate().getTime(); //Double checked locking if (lastRefreshTime < 0 || currentTime - lastRefreshTime > validityDuration) { synchronized (this) { if (lastRefreshTime < 0 || currentTime - lastRefreshTime > validityDuration) { //estimated size MUST be populated first, cause if exception occurs in FileUtils.sizeOfDirectory method, it //will be rethrown each time this method is called (if last refresh time was populated first we will //not hit this code until validatyDuration has passed) lastEstimatedSize = FileUtils.sizeOfDirectory(file); lastRefreshTime = currentTime; } } } return lastEstimatedSize; }
private Boolean isLicenseThisOld(final LicenseDetails input, final Period period) { Date licensePurchaseDate = input.getJiraLicense().getPurchaseDate(); return new DateTime(licensePurchaseDate).withPeriodAdded(period, 1).isBefore(new DateTime(clock.getCurrentDate())); } }
private boolean hasExpired(final GenericValue gv) { final long maxAgeMS = rememberMeConfiguration.getCookieMaxAgeInSeconds() * 1000; final Timestamp createdTS = gv.getTimestamp(Columns.CREATED); //noinspection SimplifiableIfStatement if (createdTS == null) { // why would this ever be the case? worse things have happened at sea! return true; } final long howOld = createdTS.getTime() + maxAgeMS; final long now = clock.getCurrentDate().getTime(); return howOld < now; }
private LocalDate parseDuration(final String str) { try { final long offset = parseDurationOffset(str); final Date currentDate = clock.getCurrentDate(); return convertToLocalDate(currentDate.getTime() + offset); } catch (InvalidDurationException e) { return null; } catch (NumberFormatException ne) { return null; } }
@Override public void dismissFlagForUser(String flagKey, ApplicationUser user) { if (user == null || isBlank(flagKey)) { return; } JSONObject dismissals = getDismissalsForUser(user); try { dismissals.put(flagKey, clock.getCurrentDate().getTime()); setDismissalsForUser(user, dismissals); } catch (JSONException e) { log.debug("Exception occurred while trying to dismiss flag:", e); } }
private void writeFile() { long now = clock.getCurrentDate().getTime(); NodeSharedHomeStatus status = new NodeSharedHomeStatus(getNodeId(), now); sharedHomeNodeStatusWriter.writeNodeStatus(status); } }
cal.setTime(clock.getCurrentDate());