private final ClientIdentifier clientId;
private final String persistenceId;
+ private long lastConnectTicks;
+ private long lastSeenTicks;
private long expectedTxSequence;
private Long lastSeenHistory = null;
this.purgedHistories = Preconditions.checkNotNull(purgedHistories);
this.standaloneHistory = Preconditions.checkNotNull(standaloneHistory);
this.localHistories = Preconditions.checkNotNull(localHistories);
+ this.lastSeenTicks = tree.readTime();
}
@Override
}
private LocalHistorySuccess handleDestroyHistory(final DestroyLocalHistoryRequest request,
- final RequestEnvelope envelope, final long now)
- throws RequestException {
+ final RequestEnvelope envelope, final long now) {
final LocalHistoryIdentifier id = request.getTarget();
final LocalFrontendHistory existing = localHistories.get(id);
if (existing == null) {
}
private LocalHistorySuccess handlePurgeHistory(final PurgeLocalHistoryRequest request,
- final RequestEnvelope envelope, final long now) throws RequestException {
+ final RequestEnvelope envelope, final long now) {
final LocalHistoryIdentifier id = request.getTarget();
final LocalFrontendHistory existing = localHistories.remove(id);
if (existing == null) {
void reconnect() {
expectedTxSequence = 0;
+ lastConnectTicks = tree.readTime();
}
void retire() {
standaloneHistory.retire();
}
+ long getLastConnectTicks() {
+ return lastConnectTicks;
+ }
+
+ long getLastSeenTicks() {
+ return lastSeenTicks;
+ }
+
+ void touch() {
+ this.lastSeenTicks = tree.readTime();
+ }
+
@Override
public String toString() {
- return MoreObjects.toStringHelper(LeaderFrontendState.class).add("clientId", clientId)
- .add("purgedHistories", purgedHistories).toString();
+ return MoreObjects.toStringHelper(LeaderFrontendState.class)
+ .add("clientId", clientId)
+ .add("nanosAgo", tree.readTime() - lastSeenTicks)
+ .add("purgedHistories", purgedHistories)
+ .toString();
}
}