public class OnlineUsersCachingStrategy extends tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt> implements tigase.licence.LicencedComponent
Modifier and Type | Field and Description |
---|---|
protected static tigase.licence.LicenceChecker |
licenceChecker |
static String |
ONLINE_PRESENCE_CACHE_PROP_KEY |
static String |
REQUEST_SYNCONLINE_CMD |
static String |
RESPOND_SYNCONLINE_CMD |
static String |
STRATEGY_STATS_CMD |
static String |
USER_CONN_ID_CHANGED_CMD |
static String |
USER_CONNECTED_CMD |
static String |
USER_DISCONNECTED_CMD |
static String |
USER_PRESENCE_CMD |
Constructor and Description |
---|
OnlineUsersCachingStrategy() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsJid(tigase.xmpp.jid.BareJID jid) |
void |
everyMinute() |
CacheContenerIfc |
getCacheContener()
Retrieves
CacheContener instance used by this ACS instance. |
tigase.cluster.api.ClusterControllerIfc |
getCluster()
Method returns implementation
ClusterControllerIfc currently used. |
tigase.xmpp.jid.JID[] |
getConnectionIdsForJid(tigase.xmpp.jid.BareJID jid) |
ConnectionRecordExt |
getConnectionRecord(tigase.xmpp.jid.JID jid) |
ConnectionRecordExt |
getConnectionRecordInstance() |
Set<ConnectionRecordExt> |
getConnectionRecords(tigase.xmpp.jid.BareJID bareJID) |
Map<String,Object> |
getDefaults(Map<String,Object> params) |
String |
getInfo() |
List<tigase.xmpp.jid.JID> |
getNodesForPacketForward(tigase.xmpp.jid.JID fromNode,
Set<tigase.xmpp.jid.JID> visitedNodes,
tigase.server.Packet packet) |
List<tigase.xmpp.jid.JID> |
getNodesForUserConnect(tigase.xmpp.jid.JID jid)
Method returns list of all nodes to which information about user connecting should be sent.
|
List<tigase.xmpp.jid.JID> |
getNodesForUserDisconnect(tigase.xmpp.jid.JID jid)
Method returns list of all nodes to which information about user disconnecting should be sent.
|
tigase.cluster.api.SessionManagerClusteredIfc |
getSM()
Method allows retrieval of a particular
SessionManagerClusteredIfc implementation currently used. |
void |
getStatistics(tigase.stats.StatisticsList list) |
void |
handleLocalPacket(tigase.server.Packet packet,
tigase.xmpp.XMPPResourceConnection conn) |
void |
handleLocalResourceBind(tigase.xmpp.XMPPResourceConnection conn) |
void |
handleLocalUserChangedConnId(tigase.xmpp.jid.BareJID userId,
tigase.xmpp.XMPPResourceConnection conn,
tigase.xmpp.jid.JID oldConnId,
tigase.xmpp.jid.JID newConnId) |
void |
handleLocalUserLogout(tigase.xmpp.jid.BareJID userId,
tigase.xmpp.XMPPResourceConnection conn) |
boolean |
hasCompleteJidsInfo() |
void |
nodeConnected(tigase.xmpp.jid.JID node) |
void |
nodeDisconnected(tigase.xmpp.jid.JID node) |
protected Map<String,String> |
prepareConnectionParams(tigase.xmpp.XMPPResourceConnection conn)
A utility method used to prepare a Map of data with user session data before it can be sent over to another
cluster node.
|
protected boolean |
presenceStatusUpdate(tigase.server.Packet packet)
Method evaluates whether given packet is a valid presence update, i.e. is of correct type and has proper
addressing.
|
void |
presenceUpdate(tigase.xml.Element presence,
ConnectionRecordExt rec)
If presence caching is enabled method updates given connection in the cache with the information about presence
for the given connection.
|
protected void |
requestSync(tigase.xmpp.jid.JID node)
Send synchronization request to a given cluster node.
|
void |
setProperties(Map<String,Object> props) |
String |
toString() |
void |
userChangedConnId(tigase.xmpp.jid.BareJID userId,
tigase.xmpp.jid.JID oldConnectionId,
tigase.xmpp.jid.JID newConnectionId)
Method responsible for changing connection id for session for which connection id was changed, ie. due to stream
resumption.
|
void |
userDisconnected(ConnectionRecordExt rec)
Method responsible for user disconnection events.
|
void |
usersConnected(ConnectionRecordExt... recs)
Method responsible for user connection events.
|
addCommandListener, containsJidLocally, containsJidLocally, everyHour, everySecond, fireEvent, getNodesConnected, getNodesForIqResponse, getStatistics, handleLocalPresenceSet, handleLocalUserLogin, isIqResponseToNode, isSuitableForForward, processPacket, sendToNextNode, setClusterController, setStatisticsPrefix, statisticExecutedIn
public static final String ONLINE_PRESENCE_CACHE_PROP_KEY
public static final String REQUEST_SYNCONLINE_CMD
public static final String RESPOND_SYNCONLINE_CMD
public static final String STRATEGY_STATS_CMD
public static final String USER_CONNECTED_CMD
public static final String USER_CONN_ID_CHANGED_CMD
public static final String USER_DISCONNECTED_CMD
public static final String USER_PRESENCE_CMD
protected static tigase.licence.LicenceChecker licenceChecker
public boolean containsJid(tigase.xmpp.jid.BareJID jid)
containsJid
in interface tigase.sys.OnlineJidsReporter
containsJid
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public void handleLocalPacket(tigase.server.Packet packet, tigase.xmpp.XMPPResourceConnection conn)
handleLocalPacket
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
handleLocalPacket
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public void handleLocalUserLogout(tigase.xmpp.jid.BareJID userId, tigase.xmpp.XMPPResourceConnection conn)
handleLocalUserLogout
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
handleLocalUserLogout
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public void handleLocalResourceBind(tigase.xmpp.XMPPResourceConnection conn)
handleLocalResourceBind
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
handleLocalResourceBind
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public void handleLocalUserChangedConnId(tigase.xmpp.jid.BareJID userId, tigase.xmpp.XMPPResourceConnection conn, tigase.xmpp.jid.JID oldConnId, tigase.xmpp.jid.JID newConnId)
handleLocalUserChangedConnId
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
handleLocalUserChangedConnId
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public void nodeConnected(tigase.xmpp.jid.JID node)
nodeConnected
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
nodeConnected
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public void nodeDisconnected(tigase.xmpp.jid.JID node)
nodeDisconnected
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
nodeDisconnected
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public void presenceUpdate(tigase.xml.Element presence, ConnectionRecordExt rec)
presence
- Element
containing presence informationrec
- ConnectionRecordExt
for which presence should be updatedpublic String toString()
toString
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public void userDisconnected(ConnectionRecordExt rec)
userDisconnected()
on particular cache
implementation.rec
- ConnectionRecordExt
for which presence should be updatedpublic void usersConnected(ConnectionRecordExt... recs)
usersConnected()
on particular cache
implementation.recs
- ConnectionRecordExt
for which presence should be updatedpublic void userChangedConnId(tigase.xmpp.jid.BareJID userId, tigase.xmpp.jid.JID oldConnectionId, tigase.xmpp.jid.JID newConnectionId)
userId
- - bare jid of useroldConnectionId
- - connection id which was changednewConnectionId
- - connection id which replaced old connection idpublic tigase.cluster.api.ClusterControllerIfc getCluster()
ClusterControllerIfc
currently used.ClusterControllerIfc
public tigase.xmpp.jid.JID[] getConnectionIdsForJid(tigase.xmpp.jid.BareJID jid)
getConnectionIdsForJid
in interface tigase.sys.OnlineJidsReporter
getConnectionIdsForJid
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public ConnectionRecordExt getConnectionRecord(tigase.xmpp.jid.JID jid)
getConnectionRecord
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
getConnectionRecord
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public ConnectionRecordExt getConnectionRecordInstance()
getConnectionRecordInstance
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
getConnectionRecordInstance
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public Set<ConnectionRecordExt> getConnectionRecords(tigase.xmpp.jid.BareJID bareJID)
getConnectionRecords
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
getConnectionRecords
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public Map<String,Object> getDefaults(Map<String,Object> params)
getDefaults
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
getDefaults
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public String getInfo()
getInfo
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
getInfo
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public CacheContenerIfc getCacheContener()
CacheContener
instance used by this ACS instance.CacheContener
instance used by this ACS instance.public List<tigase.xmpp.jid.JID> getNodesForPacketForward(tigase.xmpp.jid.JID fromNode, Set<tigase.xmpp.jid.JID> visitedNodes, tigase.server.Packet packet)
getNodesForPacketForward
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public List<tigase.xmpp.jid.JID> getNodesForUserConnect(tigase.xmpp.jid.JID jid)
jid
- JID
of user that has connectedList
of all nodes JID
to which information about user connecting should be sent.public List<tigase.xmpp.jid.JID> getNodesForUserDisconnect(tigase.xmpp.jid.JID jid)
jid
- JID
of user that has disconnectedList
of all nod JID
to which information about user disconnecting should be sent.public tigase.cluster.api.SessionManagerClusteredIfc getSM()
SessionManagerClusteredIfc
implementation currently used.getSM
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
SessionManagerClusteredIfc
implementation currently used.public void everyMinute()
everyMinute
in interface tigase.stats.StatisticHolder
everyMinute
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public void getStatistics(tigase.stats.StatisticsList list)
getStatistics
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
getStatistics
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public boolean hasCompleteJidsInfo()
hasCompleteJidsInfo
in interface tigase.sys.OnlineJidsReporter
hasCompleteJidsInfo
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
public void setProperties(Map<String,Object> props)
setProperties
in interface tigase.cluster.strategy.ClusteringStrategyIfc<ConnectionRecordExt>
setProperties
in class tigase.cluster.strategy.DefaultClusteringStrategyAbstract<ConnectionRecordExt>
protected Map<String,String> prepareConnectionParams(tigase.xmpp.XMPPResourceConnection conn) throws tigase.xmpp.NotAuthorizedException, tigase.xmpp.NoConnectionIdException
conn
- is user's XMPPResourceConnection for which Map structure is prepare.
a Map structure with all user's connection essential data.
Map<String,String>
tigase.xmpp.NotAuthorizedException
tigase.xmpp.NoConnectionIdException
protected boolean presenceStatusUpdate(tigase.server.Packet packet)
packet
- to be validatedtrue
if the packet is a valid presence update, false
otherwiseprotected void requestSync(tigase.xmpp.jid.JID node)
node
- is a JID of the target cluster node.Copyright © 2004–2020 Tigase. All rights reserved.