This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.discovery.base-1.1.2 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-discovery-base.git
commit f12087518c283dca8f76e9b002435eea0be7238e Author: Stefan Egli <[email protected]> AuthorDate: Tue Nov 24 15:46:37 2015 +0000 SLING-5326 : adding time-difference health-check 'ClocksInSyncHealthCheck' git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/discovery/base@1716181 13f79535-47bb-0310-9956-ffa450edef68 --- .../base/connectors/announcement/Announcement.java | 20 ++++++++++++++++++++ .../connectors/announcement/CachedAnnouncement.java | 5 +++++ .../base/connectors/announcement/package-info.java | 4 ++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/sling/discovery/base/connectors/announcement/Announcement.java b/src/main/java/org/apache/sling/discovery/base/connectors/announcement/Announcement.java index c4345ae..95df6fc 100644 --- a/src/main/java/org/apache/sling/discovery/base/connectors/announcement/Announcement.java +++ b/src/main/java/org/apache/sling/discovery/base/connectors/announcement/Announcement.java @@ -79,6 +79,10 @@ public class Announcement { /** SLING-3382: the resetBackoff flag is sent from client to server and indicates that the client wants to start from (backoff) scratch **/ private boolean resetBackoff = false; + + private long originallyCreatedAt = -1; + + private long receivedAt = System.currentTimeMillis(); public Announcement(final String ownerId) { this(ownerId, PROTOCOL_VERSION); @@ -174,6 +178,14 @@ public class Announcement { return this.backoffInterval; } + public long getOriginallyCreatedAt() { + return this.originallyCreatedAt; + } + + public long getReceivedAt() { + return this.receivedAt; + } + /** sets the resetBackoff flag **/ public void setResetBackoff(boolean resetBackoff) { this.resetBackoff = resetBackoff; @@ -265,6 +277,9 @@ public class Announcement { protocolVersion = announcement.getInt("protocolVersion"); } final Announcement result = new Announcement(ownerId, protocolVersion); + if (announcement.has("created")) { + result.originallyCreatedAt = announcement.getLong("created"); + } if (announcement.has("backoffInterval")) { long backoffInterval = announcement.getLong("backoffInterval"); result.backoffInterval = backoffInterval; @@ -457,4 +472,9 @@ public class Announcement { return myJson.toString().equals(otherJson.toString()); } + public void registerPing(Announcement incomingAnnouncement) { + originallyCreatedAt = incomingAnnouncement.originallyCreatedAt; + receivedAt = incomingAnnouncement.receivedAt; + } + } diff --git a/src/main/java/org/apache/sling/discovery/base/connectors/announcement/CachedAnnouncement.java b/src/main/java/org/apache/sling/discovery/base/connectors/announcement/CachedAnnouncement.java index fc946ef..426c63f 100644 --- a/src/main/java/org/apache/sling/discovery/base/connectors/announcement/CachedAnnouncement.java +++ b/src/main/java/org/apache/sling/discovery/base/connectors/announcement/CachedAnnouncement.java @@ -70,6 +70,10 @@ public class CachedAnnouncement { return lastPing; } + public final long getFirstPing() { + return firstPing; + } + /** Returns the second until the next heartbeat is expected, otherwise the timeout will hit **/ public final long getSecondsUntilTimeout() { final long now = System.currentTimeMillis(); @@ -92,6 +96,7 @@ public class CachedAnnouncement { */ final long registerPing(Announcement incomingAnnouncement, BaseConfig config) { lastPing = System.currentTimeMillis(); + announcement.registerPing(incomingAnnouncement); if (incomingAnnouncement.isInherited()) { // then we are the client, we inherited this announcement from the server // hence we have no power to do any backoff instructions towards the server diff --git a/src/main/java/org/apache/sling/discovery/base/connectors/announcement/package-info.java b/src/main/java/org/apache/sling/discovery/base/connectors/announcement/package-info.java index 42eab68..207191e 100644 --- a/src/main/java/org/apache/sling/discovery/base/connectors/announcement/package-info.java +++ b/src/main/java/org/apache/sling/discovery/base/connectors/announcement/package-info.java @@ -21,9 +21,9 @@ * Provides topology announcement implementations for discovery * implementors that choose to extend from discovery.base * - * @version 1.0.0 + * @version 1.1.2 */ -@Version("1.0.0") +@Version("1.1.2") package org.apache.sling.discovery.base.connectors.announcement; import aQute.bnd.annotation.Version; -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
