tigase.cluster.strategy
public interface ClusteringStrategyIfc extends OnlineJidsReporter
Modifier and Type | Method and Description |
---|---|
List<tigase.xmpp.JID> |
getAllNodes()
The method returns all cluster nodes currently connected to the cluster.
|
ConnectionRecord |
getConnectionRecord(tigase.xmpp.JID jid)
Returns a ConnectionRecord object associated with this user's full JID if
it exists in the cache or null if it does not.
|
Set<ConnectionRecord> |
getConnectionRecords(tigase.xmpp.BareJID bareJID)
Returns a set with all ConnectionRecords found in the cache for a given
user ID, that is BareJID.
|
Map<String,Object> |
getDefaults(Map<String,Object> params)
This method is used for configuration purpose.
|
Object |
getInternalCacheData()
Deprecated.
|
List<tigase.xmpp.JID> |
getNodesForJid(tigase.xmpp.JID jid)
Returns a
List of all cluster nodes on which the given user
session can exist. |
List<tigase.xmpp.JID> |
getNodesForPacketForward(tigase.xmpp.JID fromNode,
Set<tigase.xmpp.JID> visitedNodes,
Packet packet)
The method allows the strategy implementation to control to which cluster
nodes forward the given packet.
|
List<tigase.xmpp.JID> |
getNodesForUserConnect(tigase.xmpp.JID jid)
The method allows the strategy implementation to control to which cluster
nodes send the notification about user's new connection event.
|
List<tigase.xmpp.JID> |
getNodesForUserDisconnect(tigase.xmpp.JID jid)
The method allows the strategy implementation to control to which cluster
nodes send the notification about user's disconnection event.
|
void |
getStatistics(StatisticsList list)
Add the strategy statistics to the List.
|
boolean |
needsSync()
This method returns
'true' if it needs online users
synchronization upon the node connection to the cluster. |
void |
nodeConnected(tigase.xmpp.JID node)
This is a handler method which is called when a new node connects to the
cluster.
|
void |
nodeDisconnected(tigase.xmpp.JID node)
This is a handler method which is called when a node disconnects from the
cluster.
|
void |
presenceUpdate(tigase.xml.Element presence,
ConnectionRecord rec)
The method is called on user's presence update received from a remote
cluster node.
|
void |
setProperties(Map<String,Object> props)
Method used to pass configuration parameters to the class.
|
void |
setSessionManagerHandler(SessionManagerHandler sm)
The method allows to obtain SessionManagerHandler object by the strategy.
|
void |
userDisconnected(Queue<Packet> results,
ConnectionRecord rec)
This is a handler method which is called when a user disconnects from some
node in the cluster.
|
void |
usersConnected(Queue<Packet> results,
ConnectionRecord... rec)
This is a handler method which is called when a user connects to some node
in the cluster.
|
containsJid, getConnectionIdsForJid, hasCompleteJidsInfo
@Deprecated Object getInternalCacheData()
Set<ConnectionRecord> getConnectionRecords(tigase.xmpp.BareJID bareJID)
bareJID
- is an instance of the user's BareJID, that is account ID.ConnectionRecord getConnectionRecord(tigase.xmpp.JID jid)
jid
- is an instance of the user's full JID.void setSessionManagerHandler(SessionManagerHandler sm)
sm
- is an instance of the SessionManagerHandler class.List<tigase.xmpp.JID> getAllNodes()
Map<String,Object> getDefaults(Map<String,Object> params)
setProperties
method.params
- a Map
with properties loaded from init.properties
file which should be used for generating defaults.Map
with all the class default configuration
parameters.List<tigase.xmpp.JID> getNodesForJid(tigase.xmpp.JID jid)
List
of all cluster nodes on which the given user
session can exist. In the simplest scenario it can always return all
cluster nodes as in theory the user can connect to any node if it is not on
the local node. More specialized implementation can know kind of hashing
algorithm which is used for binding a specific user to a specific node or
the implementation can keep track of all connected users to all nodes and
'know' where is the user connected at any given time.
In theory it can also return 'null'
it it 'knows' the user is
off-line.jid
- is a user full JID.void getStatistics(StatisticsList list)
list
- boolean needsSync()
'true'
if it needs online users
synchronization upon the node connection to the cluster. Normally it should
return 'false'
.
It it return 'true'
then the synchronization starts. All
online users from all other nodes would sent in batches and the
synchronization can take any amount of time.void nodeConnected(tigase.xmpp.JID node)
node
- is a cluster node id.void nodeDisconnected(tigase.xmpp.JID node)
node
- is a cluster node id.void setProperties(Map<String,Object> props)
Map
which contains compiles set of defaults
overwritten by parameters loaded from configuration file.
If he implementation took a good care of providing defaults for all
parameters no parameter should be missing.props
- a Map
with all configuration parameters for the
class.void userDisconnected(Queue<Packet> results, ConnectionRecord rec)
jid
- us a user full JID just disconnected from the cluster.node
- is a cluster node id from which the user disconnected.results
- is a collection of packets which can be generated upon the user
disconnection by the implementation.void usersConnected(Queue<Packet> results, ConnectionRecord... rec)
jids
- is a list of full user JIDs which just connected to the cluster.
Normally there is only one JID provided, however, in some cases
(during synchronization) there might be more than one.node
- is a cluster node id where the jid is connected to.results
- is a collection of packets which can be generated upon the user
connection by the implementation.List<tigase.xmpp.JID> getNodesForPacketForward(tigase.xmpp.JID fromNode, Set<tigase.xmpp.JID> visitedNodes, Packet packet)
fromNode
- a source address if the packet was forwarded from a different
node, this may be null if the packet was generated on this node.visitedNodes
- a list of cluster nodes through which the packet already traveled,
this parameter can be null if the packet was generated on this
nodepacket
- a packet which is supposed to be sent to other node.void presenceUpdate(tigase.xml.Element presence, ConnectionRecord rec)
presence
- Packet received from a remote cluster node.rec
- is an instance of the user's ConnectionRecord.List<tigase.xmpp.JID> getNodesForUserConnect(tigase.xmpp.JID jid)
List<tigase.xmpp.JID> getNodesForUserDisconnect(tigase.xmpp.JID jid)
Copyright © 2013 Tigase. All rights reserved.