Class SubscriptionTask
- java.lang.Object
-
- org.jivesoftware.openfire.pubsub.cluster.NodeTask
-
- org.jivesoftware.openfire.pubsub.cluster.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
-
-
Field Summary
-
Fields inherited from class org.jivesoftware.openfire.pubsub.cluster.NodeTask
nodeId, serviceId, uniqueNodeIdentifier
-
-
Constructor Summary
Constructors Constructor Description SubscriptionTask()
This no-argument constructor is provided for serialization purposes.SubscriptionTask(NodeSubscription subscription)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.xmpp.packet.JID
getOwner()
Returns the address of the entity that owns this subscription.NodeSubscription.State
getState()
Returns the state of the subscription.org.xmpp.packet.JID
getSubscriberJid()
Returns the address that is going to receive the event notifications.String
getSubscriptionId()
Returns the ID that uniquely identifies the subscription of the user in the node.Optional<NodeSubscription>
getSubscriptionIfLoaded()
Finds the pubsub node subscription that is the subject of this task.void
readExternal(ObjectInput in)
String
toString()
void
writeExternal(ObjectOutput out)
-
Methods inherited from class org.jivesoftware.openfire.pubsub.cluster.NodeTask
getNodeId, getNodeIfLoaded, getResult, getServiceIfLoaded, getUniqueNodeIdentifier
-
-
-
-
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()
-
getState
public NodeSubscription.State getState()
Returns the state of the subscription.- Returns:
- subscription state
- See Also:
NodeSubscription.getState()
-
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
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classNodeTask
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classNodeTask
- Throws:
IOException
ClassNotFoundException
-
-