public class Announcement
extends java.lang.Object
An announcement is exchanged in json format and carries a timeout.
Constructor and Description |
---|
Announcement(java.lang.String ownerId) |
Announcement(java.lang.String ownerId,
int protocolVersion) |
Modifier and Type | Method and Description |
---|---|
void |
addIncomingTopologyAnnouncement(Announcement incomingTopologyAnnouncement)
adds an incoming announcement to this announcement
|
java.lang.String |
asJSON()
Convert this announcement into json
|
boolean |
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-3382
|
static Announcement |
fromJSON(java.lang.String topologyAnnouncementJSON)
Create an announcement form json
|
long |
getBackoffInterval()
Gets the backoffInterval which the connector servlets passes back to the client to use as the next heartbeatInterval
|
long |
getOriginallyCreatedAt() |
java.lang.String |
getOwnerId()
Returns the slingid of the owner of this announcement.
|
java.lang.String |
getPrimaryKey()
the key which is unique to this announcement
|
int |
getProtocolVersion()
Returns the protocolVersion of this announcement
|
long |
getReceivedAt() |
boolean |
getResetBackoff()
gets the resetBackoff flag
|
java.lang.String |
getServerInfo()
the information about the server where this announcement came from
|
boolean |
isCorrectVersion()
check whether this is announcement contains the valid protocol version
|
boolean |
isInherited()
Returns the inherited flag - if true this means that this announcement is the response of a topology connect
|
boolean |
isLoop()
Returns the loop flag - set when this announcement represents a loop detected in the topology connectors
|
boolean |
isValid()
check whether this is a valid announcement, containing the minimal information
|
java.util.Collection<InstanceDescription> |
listInstances()
Returns the list of instances that are contained in this announcement
|
void |
persistTo(Resource announcementsResource)
Persists this announcement using the given 'announcements' resource,
under which a node with the primary key is created
|
void |
registerPing(Announcement incomingAnnouncement) |
void |
removeInherited(java.lang.String ownerId)
Remove all announcements that match the given owner Id
|
void |
setBackoffInterval(long backoffInterval)
Sets the backoffInterval which the connector servlets passes back to the client to use as the next heartbeatInterval
|
void |
setInherited(boolean inherited)
set the inherited flag - if true this means this announcement is the response of a topology connect
|
void |
setLocalCluster(ClusterView localCluster)
sets the local clusterview
|
void |
setLoop(boolean loop)
Sets the loop falg - set true when this announcement should represent a loop detected in the topology connectors
|
void |
setResetBackoff(boolean resetBackoff)
sets the resetBackoff flag
|
void |
setServerInfo(java.lang.String serverInfo)
sets the information about the server where this announcement came from
|
java.lang.String |
toString() |
public Announcement(java.lang.String ownerId)
public Announcement(java.lang.String ownerId, int protocolVersion)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isCorrectVersion()
public boolean isValid()
public void setInherited(boolean inherited)
public boolean isInherited()
public void setLoop(boolean loop)
public void setBackoffInterval(long backoffInterval)
public long getBackoffInterval()
public long getOriginallyCreatedAt()
public long getReceivedAt()
public void setResetBackoff(boolean resetBackoff)
public boolean getResetBackoff()
public boolean isLoop()
public int getProtocolVersion()
public void setServerInfo(java.lang.String serverInfo)
public java.lang.String getServerInfo()
public java.lang.String getOwnerId()
The owner is the instance which initiated the topology connection
public static Announcement fromJSON(java.lang.String topologyAnnouncementJSON)
public void setLocalCluster(ClusterView localCluster)
public void addIncomingTopologyAnnouncement(Announcement incomingTopologyAnnouncement)
public java.lang.String asJSON()
public java.lang.String getPrimaryKey()
public java.util.Collection<InstanceDescription> listInstances()
public void persistTo(Resource announcementsResource) throws PersistenceException
PersistenceException
public void removeInherited(java.lang.String ownerId)
public boolean correspondsTo(Announcement announcement)
public void registerPing(Announcement incomingAnnouncement)
Copyright © 2022 The Apache Software Foundation. All rights reserved.