Package tigase.cluster.strategy
Class DefaultClusteringStrategy<E extends ConnectionRecordIfc>
- java.lang.Object
-
- tigase.cluster.strategy.DefaultClusteringStrategyAbstract<E>
-
- tigase.cluster.strategy.DefaultClusteringStrategy<E>
-
- All Implemented Interfaces:
ClusteringStrategyIfc<E>
,StatisticHolder
,OnlineJidsReporter
@Bean(name="strategy", parent=SessionManagerClustered.class, active=true) public class DefaultClusteringStrategy<E extends ConnectionRecordIfc> extends DefaultClusteringStrategyAbstract<E>
Created: May 13, 2009 9:53:44 AM- Author:
- Artur Hefczyc
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONNECTION_ID
static java.lang.String
RESOURCE
static java.lang.String
SM_ID
static java.lang.String
USER_ID
static java.lang.String
XMPP_SESSION_ID
-
Constructor Summary
Constructors Constructor Description DefaultClusteringStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ConnectionRecordIfc
getConnectionRecord(JID node, java.util.Map<java.lang.String,java.lang.String> data)
Method takes the data received from other cluster node and creates a ConnectionRecord with all essential connection information.java.util.List<JID>
getNodesForPacketForward(JID fromNode, java.util.Set<JID> visitedNodes, Packet packet)
void
handleLocalPacket(Packet packet, XMPPResourceConnection conn)
void
handleLocalResourceBind(XMPPResourceConnection conn)
void
handleLocalUserLogout(BareJID userId, XMPPResourceConnection conn)
protected java.util.Map<java.lang.String,java.lang.String>
prepareConnectionParams(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.-
Methods inherited from class tigase.cluster.strategy.DefaultClusteringStrategyAbstract
addCommandListener, containsJid, containsJidLocally, containsJidLocally, everyHour, everyMinute, everySecond, fireEvent, getConnectionIdsForJid, getConnectionRecord, getConnectionRecordInstance, getConnectionRecords, getDefaults, getInfo, getNodesConnected, getNodesForIqResponse, getSM, getStatistics, getStatistics, handleLocalPresenceSet, handleLocalUserChangedConnId, handleLocalUserLogin, hasCompleteJidsInfo, isIqResponseToNode, isSuitableForForward, nodeConnected, nodeDisconnected, processPacket, sendToNextNode, setClusterController, setProperties, setStatisticsPrefix, statisticExecutedIn, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface tigase.cluster.strategy.ClusteringStrategyIfc
getConnectionRecordsByCreationTime
-
-
-
-
Field Detail
-
CONNECTION_ID
public static final java.lang.String CONNECTION_ID
- See Also:
- Constant Field Values
-
RESOURCE
public static final java.lang.String RESOURCE
- See Also:
- Constant Field Values
-
SM_ID
public static final java.lang.String SM_ID
- See Also:
- Constant Field Values
-
USER_ID
public static final java.lang.String USER_ID
- See Also:
- Constant Field Values
-
XMPP_SESSION_ID
public static final java.lang.String XMPP_SESSION_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
handleLocalPacket
public void handleLocalPacket(Packet packet, XMPPResourceConnection conn)
- Specified by:
handleLocalPacket
in interfaceClusteringStrategyIfc<E extends ConnectionRecordIfc>
- Overrides:
handleLocalPacket
in classDefaultClusteringStrategyAbstract<E extends ConnectionRecordIfc>
-
handleLocalResourceBind
public void handleLocalResourceBind(XMPPResourceConnection conn)
- Specified by:
handleLocalResourceBind
in interfaceClusteringStrategyIfc<E extends ConnectionRecordIfc>
- Overrides:
handleLocalResourceBind
in classDefaultClusteringStrategyAbstract<E extends ConnectionRecordIfc>
-
handleLocalUserLogout
public void handleLocalUserLogout(BareJID userId, XMPPResourceConnection conn)
- Specified by:
handleLocalUserLogout
in interfaceClusteringStrategyIfc<E extends ConnectionRecordIfc>
- Overrides:
handleLocalUserLogout
in classDefaultClusteringStrategyAbstract<E extends ConnectionRecordIfc>
-
getNodesForPacketForward
public java.util.List<JID> getNodesForPacketForward(JID fromNode, java.util.Set<JID> visitedNodes, Packet packet)
- Overrides:
getNodesForPacketForward
in classDefaultClusteringStrategyAbstract<E extends ConnectionRecordIfc>
-
prepareConnectionParams
protected java.util.Map<java.lang.String,java.lang.String> prepareConnectionParams(XMPPResourceConnection conn) throws NotAuthorizedException, NoConnectionIdException
A utility method used to prepare a Map of data with user session data before it can be sent over to another cluster node. This is supposed to contain all the user's session essential information which directly identify user's resource and network connection. This information allows to detect two different user's connection made for the same resource. This may happen if both connections are established to different nodes.- Parameters:
conn
- is user's XMPPResourceConnection for which Map structure is prepare.- Returns:
- a Map structure with all user's connection essential data.
- Throws:
NotAuthorizedException
NoConnectionIdException
-
getConnectionRecord
protected ConnectionRecordIfc getConnectionRecord(JID node, java.util.Map<java.lang.String,java.lang.String> data)
Method takes the data received from other cluster node and creates a ConnectionRecord with all essential connection information. This might be used later to identify user's XMPPResourceConnection or use the clustering strategy API.
-
-