Class SubscriptionTask

  • All Implemented Interfaces:
    Externalizable, Serializable, Runnable, ClusterTask<Void>
    Direct Known Subclasses:
    CancelSubscriptionTask, ModifySubscriptionTask, NewSubscriptionTask

    public abstract class SubscriptionTask
    extends NodeTask
    A cluster task used work with a particular subscription (a relation between an entity an a pubsub node) of a pubsub node. Note that this task aims to update in-memory state only: it will not apply affiliation changes to persistent data storage (it is assumed that the cluster node where the task originated takes responsibility for that). As a result, this task might not apply changes if the node that is the subject of this task is currently not loaded in-memory of the cluster node on which this task operates.
    See Also:
    Serialized Form
    • Constructor Detail

      • SubscriptionTask

        public SubscriptionTask()
        This no-argument constructor is provided for serialization purposes. It should generally not be used otherwise.
      • SubscriptionTask

        public SubscriptionTask​(@Nonnull
                                NodeSubscription subscription)
    • Method Detail

      • getSubscriptionId

        public String getSubscriptionId()
        Returns the ID that uniquely identifies the subscription of the user in the node.
        Returns:
        a unique node subscription identifier.
        See Also:
        NodeSubscription.getID()
      • getOwner

        public org.xmpp.packet.JID getOwner()
        Returns the address of the entity that owns this subscription.
        Returns:
        The address of the owner of the subscription.
        See Also:
        NodeSubscription.getOwner()
      • getSubscriberJid

        public org.xmpp.packet.JID getSubscriberJid()
        Returns the address that is going to receive the event notifications.
        Returns:
        the address that will receive notifications.
        See Also:
        NodeSubscription.getJID()
      • getSubscriptionIfLoaded

        @Nonnull
        public Optional<NodeSubscription> getSubscriptionIfLoaded()
        Finds the pubsub node subscription that is the subject of this task. Note that null, instead of a pubsub node subscription instance, might be returned when the pubsub service is not currently loaded in-memory on the cluster node that the task is executing on (although there is no guarantee that when this method returns a non-null node subscription, it was previously not loaded in-memory)! The rationale for this is that this cluster tasks does not need to operate on data that is not in memory, as such operations are the responsibility of the cluster node that initiates the cluster task.
        Returns:
        a pubsub node subscription