Class ClusteredNodeStrategy

java.lang.Object
tigase.pubsub.cluster.AbstractStrategy
tigase.pubsub.cluster.ClusteredNodeStrategy
All Implemented Interfaces:
tigase.kernel.beans.Initializable, tigase.kernel.beans.UnregisterAware, StrategyIfc

@Bean(name="strategy", parent=PubSubComponentClustered.class, active=true) public class ClusteredNodeStrategy extends AbstractStrategy implements StrategyIfc
ClusteredNodeStrategy - all pubsub nodes are shared between all cluster nodes, which implies forwarding of packet information across the cluster with the exception of create/remove operation on nodes (to avoid race conditions).
Author:
andrzej
  • Field Details

    • FORWARD_ELEMENTS

      public static final String[] FORWARD_ELEMENTS
    • nodesModifications

      protected final ThreadLocal<ArrayDeque<tigase.xml.Element>> nodesModifications
  • Constructor Details

    • ClusteredNodeStrategy

      public ClusteredNodeStrategy()
  • Method Details

    • filterOutPacket

      public boolean filterOutPacket(tigase.server.Packet packet)
      Specified by:
      filterOutPacket in interface StrategyIfc
    • nodeDisconnected

      public void nodeDisconnected(tigase.xmpp.jid.JID jid)
      Specified by:
      nodeDisconnected in interface StrategyIfc
      Overrides:
      nodeDisconnected in class AbstractStrategy
    • getNodesForPacket

      public List<tigase.xmpp.jid.JID> getNodesForPacket(tigase.server.Packet packet) throws tigase.pubsub.exceptions.PubSubException
      Specified by:
      getNodesForPacket in interface StrategyIfc
      Throws:
      tigase.pubsub.exceptions.PubSubException
    • isLocalNode

      public boolean isLocalNode(tigase.xmpp.jid.BareJID serviceJid, String node)
      Specified by:
      isLocalNode in interface StrategyIfc
    • presenceCapsChanged

      public void presenceCapsChanged(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.JID jid, String caps)
      Specified by:
      presenceCapsChanged in interface StrategyIfc
    • presenceCapsRemoved

      public void presenceCapsRemoved(tigase.xmpp.jid.BareJID serviceJid, tigase.xmpp.jid.JID jid)
      Specified by:
      presenceCapsRemoved in interface StrategyIfc
    • nodeAddedToCollection

      public void nodeAddedToCollection(tigase.xmpp.jid.BareJID serviceJid, String nodeName, String collection)
      Specified by:
      nodeAddedToCollection in interface StrategyIfc
    • nodeAddedToRootCollection

      public void nodeAddedToRootCollection(tigase.xmpp.jid.BareJID serviceJid, String nodeName)
      Specified by:
      nodeAddedToRootCollection in interface StrategyIfc
    • nodeRemovedFromCollection

      public void nodeRemovedFromCollection(tigase.xmpp.jid.BareJID serviceJid, String nodeName, String collection)
      Specified by:
      nodeRemovedFromCollection in interface StrategyIfc
    • nodeRemovedFromRootCollection

      public void nodeRemovedFromRootCollection(tigase.xmpp.jid.BareJID serviceJid, String nodeName)
      Specified by:
      nodeRemovedFromRootCollection in interface StrategyIfc
    • nodeConfigurationChanged

      public void nodeConfigurationChanged(tigase.xmpp.jid.BareJID serviceJid, String nodeName, tigase.pubsub.AbstractNodeConfig config)
      Specified by:
      nodeConfigurationChanged in interface StrategyIfc
    • nodeAffiliationsChanged

      public void nodeAffiliationsChanged(tigase.xmpp.jid.BareJID serviceJid, String nodeName, Map<tigase.xmpp.jid.BareJID,tigase.pubsub.repository.stateless.UsersAffiliation> changedAffiliations)
      Specified by:
      nodeAffiliationsChanged in interface StrategyIfc
    • nodeSubscriptionsChanged

      public void nodeSubscriptionsChanged(tigase.xmpp.jid.BareJID serviceJid, String nodeName, Map<tigase.xmpp.jid.BareJID,tigase.pubsub.repository.stateless.UsersSubscription> changedSubscriptions)
      Specified by:
      nodeSubscriptionsChanged in interface StrategyIfc
    • notifyNodeConfigurationChanges

      public void notifyNodeConfigurationChanges()
    • broadcastNotification

      public void broadcastNotification(tigase.pubsub.utils.executors.Executor.Priority priority, tigase.xmpp.jid.BareJID serviceJID, String nodeName, tigase.xml.Element message)
      Specified by:
      broadcastNotification in interface StrategyIfc
    • requestSync

      protected void requestSync(tigase.xmpp.jid.JID nodeJid)
      Overrides:
      requestSync in class AbstractStrategy
    • sendToNodes

      public void sendToNodes(String command, Queue<tigase.xml.Element> packets, tigase.xmpp.jid.JID... toNodes)
    • sendException

      public boolean sendException(tigase.server.Packet packet, tigase.component.exceptions.ComponentException ex)
      Specified by:
      sendException in interface StrategyIfc
      Overrides:
      sendException in class AbstractStrategy
    • isOnlineLocally

      public boolean isOnlineLocally(tigase.xmpp.jid.JID jid)
      Specified by:
      isOnlineLocally in interface StrategyIfc
    • wrapNodeConfig

      public tigase.pubsub.AbstractNodeConfig wrapNodeConfig(tigase.xmpp.jid.BareJID serviceJid, String nodeName, tigase.pubsub.AbstractNodeConfig config)
      Specified by:
      wrapNodeConfig in interface StrategyIfc
      Overrides:
      wrapNodeConfig in class AbstractStrategy
    • packetProcessed

      public void packetProcessed()
      Specified by:
      packetProcessed in interface StrategyIfc
      Overrides:
      packetProcessed in class AbstractStrategy
    • shouldBroadcastNotificationLocallyFor

      public boolean shouldBroadcastNotificationLocallyFor(tigase.xmpp.jid.JID jid)
      Description copied from interface: StrategyIfc
      Method checks if notifications should be sent on this node for passed JID
      Specified by:
      shouldBroadcastNotificationLocallyFor in interface StrategyIfc
      Returns:
    • shouldBroadcastNotificationLocallyForOption1

      protected boolean shouldBroadcastNotificationLocallyForOption1(tigase.xmpp.jid.JID jid)
    • shouldBroadcastNotificationLocallyForOption2

      protected boolean shouldBroadcastNotificationLocallyForOption2(tigase.xmpp.jid.JID jid)
    • userRemoved

      public void userRemoved(tigase.xmpp.jid.BareJID serviceJid)
      Specified by:
      userRemoved in interface StrategyIfc
    • handleLocally

      protected boolean handleLocally(tigase.xmpp.jid.BareJID jid)