本文整理了Java中org.threeten.bp.Instant.isAfter()
方法的一些代码示例,展示了Instant.isAfter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instant.isAfter()
方法的具体详情如下:
包路径:org.threeten.bp.Instant
类名称:Instant
方法名:isAfter
[英]Checks if this instant is after the specified instant.
The comparison is based on the time-line position of the instants.
[中]检查此瞬间是否在指定瞬间之后。
比较是基于瞬间的时间线位置。
代码示例来源:origin: googleapis/google-cloud-java
if (currTime.isAfter(lastResetTime.plus(windowLength))) {
int sessionsToKeep =
Math.max(options.getMinSessions(), maxSessionsInUse + options.getMaxIdleSessions());
代码示例来源:origin: googleapis/google-cloud-java
@InternalApi
void extendDeadlines() {
int extendSeconds = getMessageDeadlineSeconds();
List<PendingModifyAckDeadline> modacks = new ArrayList<>();
PendingModifyAckDeadline modack = new PendingModifyAckDeadline(extendSeconds);
Instant now = now();
Instant extendTo = now.plusSeconds(extendSeconds);
for (Map.Entry<String, AckHandler> entry : pendingMessages.entrySet()) {
String ackId = entry.getKey();
Instant totalExpiration = entry.getValue().totalExpiration;
if (totalExpiration.isAfter(extendTo)) {
modack.ackIds.add(ackId);
continue;
}
// forget removes from pendingMessages; this is OK, concurrent maps can
// handle concurrent iterations and modifications.
entry.getValue().forget();
if (totalExpiration.isAfter(now)) {
int sec = Math.max(1, (int) now.until(totalExpiration, ChronoUnit.SECONDS));
modacks.add(new PendingModifyAckDeadline(sec, ackId));
}
}
logger.log(Level.FINER, "Sending {0} modacks", modack.ackIds.size() + modacks.size());
modacks.add(modack);
List<String> acksToSend = Collections.emptyList();
ackProcessor.sendAckOperations(acksToSend, modacks);
}
代码示例来源:origin: googleapis/google-cloud-java
private void work() {
Instant cmpTime = Instant.ofEpochMilli(clock.millisTime());
for (; ; ) {
PendingCallable<?> callable = null;
synchronized (pendingCallables) {
if (pendingCallables.isEmpty()
|| pendingCallables.peek().getScheduledTime().isAfter(cmpTime)) {
break;
}
callable = pendingCallables.poll();
}
if (callable != null) {
try {
callable.call();
} catch (Exception e) {
// We ignore any callable exception, which should be set to the future but not relevant to
// advanceTime.
}
}
}
synchronized (pendingCallables) {
if (shutdown.get() && pendingCallables.isEmpty()) {
pendingCallables.notifyAll();
}
}
}
代码示例来源:origin: com.google.cloud/google-cloud-spanner
if (currTime.isAfter(lastResetTime.plus(windowLength))) {
int sessionsToKeep =
Math.max(options.getMinSessions(), maxSessionsInUse + options.getMaxIdleSessions());
内容来源于网络,如有侵权,请联系作者删除!