Class Announcement
java.lang.Object
org.apache.sling.discovery.base.connectors.announcement.Announcement
An announcement is the information exchanged by the topology connector and
contains all clusters and instances which both the topology connector client
and servlet see (in their part before joining the two worlds).
An announcement is exchanged in json format and carries a timeout.
-
Constructor Summary
ConstructorsConstructorDescriptionAnnouncement
(String ownerId) Announcement
(String ownerId, int protocolVersion) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIncomingTopologyAnnouncement
(Announcement incomingTopologyAnnouncement) adds an incoming announcement to this announcementasJSON()
Convert this announcement into jsonboolean
correspondsTo
(Announcement announcement) Compare this Announcement with another one, ignoring the 'created' property - which gets added to the JSON object automatically due to SLING-3389 wire-backwards-compatibility - and backoffInterval introduced as part of SLING-3382static Announcement
Create an announcement form jsonlong
Gets the backoffInterval which the connector servlets passes back to the client to use as the next heartbeatIntervallong
Returns the slingid of the owner of this announcement.the key which is unique to this announcementint
Returns the protocolVersion of this announcementlong
boolean
gets the resetBackoff flagthe information about the server where this announcement came fromboolean
check whether this is announcement contains the valid protocol versionboolean
Returns the inherited flag - if true this means that this announcement is the response of a topology connectboolean
isLoop()
Returns the loop flag - set when this announcement represents a loop detected in the topology connectorsboolean
isValid()
check whether this is a valid announcement, containing the minimal informationReturns the list of instances that are contained in this announcementvoid
Persists this announcement using the given 'announcements' resource, under which a node with the primary key is createdvoid
registerPing
(Announcement incomingAnnouncement) void
removeInherited
(String ownerId) Remove all announcements that match the given owner Idvoid
setBackoffInterval
(long backoffInterval) Sets the backoffInterval which the connector servlets passes back to the client to use as the next heartbeatIntervalvoid
setInherited
(boolean inherited) set the inherited flag - if true this means this announcement is the response of a topology connectvoid
setLocalCluster
(ClusterView localCluster) sets the local clusterviewvoid
setLoop
(boolean loop) Sets the loop falg - set true when this announcement should represent a loop detected in the topology connectorsvoid
setResetBackoff
(boolean resetBackoff) sets the resetBackoff flagvoid
setServerInfo
(String serverInfo) sets the information about the server where this announcement came fromtoString()
-
Constructor Details
-
Announcement
-
Announcement
-
-
Method Details
-
toString
-
isCorrectVersion
public boolean isCorrectVersion()check whether this is announcement contains the valid protocol version -
isValid
public boolean isValid()check whether this is a valid announcement, containing the minimal information -
setInherited
public void setInherited(boolean inherited) set the inherited flag - if true this means this announcement is the response of a topology connect -
isInherited
public boolean isInherited()Returns the inherited flag - if true this means that this announcement is the response of a topology connect -
setLoop
public void setLoop(boolean loop) Sets the loop falg - set true when this announcement should represent a loop detected in the topology connectors -
setBackoffInterval
public void setBackoffInterval(long backoffInterval) Sets the backoffInterval which the connector servlets passes back to the client to use as the next heartbeatInterval -
getBackoffInterval
public long getBackoffInterval()Gets the backoffInterval which the connector servlets passes back to the client to use as the next heartbeatInterval -
getOriginallyCreatedAt
public long getOriginallyCreatedAt() -
getReceivedAt
public long getReceivedAt() -
setResetBackoff
public void setResetBackoff(boolean resetBackoff) sets the resetBackoff flag -
getResetBackoff
public boolean getResetBackoff()gets the resetBackoff flag -
isLoop
public boolean isLoop()Returns the loop flag - set when this announcement represents a loop detected in the topology connectors -
getProtocolVersion
public int getProtocolVersion()Returns the protocolVersion of this announcement -
setServerInfo
sets the information about the server where this announcement came from -
getServerInfo
the information about the server where this announcement came from -
getOwnerId
Returns the slingid of the owner of this announcement.The owner is the instance which initiated the topology connection
-
fromJSON
Create an announcement form json -
setLocalCluster
sets the local clusterview -
addIncomingTopologyAnnouncement
adds an incoming announcement to this announcement -
asJSON
Convert this announcement into json -
getPrimaryKey
the key which is unique to this announcement -
listInstances
Returns the list of instances that are contained in this announcement -
persistTo
Persists this announcement using the given 'announcements' resource, under which a node with the primary key is created- Throws:
PersistenceException
-
removeInherited
Remove all announcements that match the given owner Id -
correspondsTo
Compare this Announcement with another one, ignoring the 'created' property - which gets added to the JSON object automatically due to SLING-3389 wire-backwards-compatibility - and backoffInterval introduced as part of SLING-3382 -
registerPing
-