CancelSubscriptionTask.java 1.01 KB
Newer Older
1 2 3 4
package org.jivesoftware.openfire.pubsub.cluster;

import org.jivesoftware.openfire.pubsub.Node;
import org.jivesoftware.openfire.pubsub.NodeSubscription;
5 6
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
7 8 9

public class CancelSubscriptionTask extends SubscriptionTask
{
10 11
    private static final Logger log = LoggerFactory.getLogger(CancelSubscriptionTask.class);

12 13 14 15 16 17 18 19 20
	public CancelSubscriptionTask()
	{
	}

	public CancelSubscriptionTask(NodeSubscription subscription)
	{
		super(subscription);
	}

21
	@Override
22 23
	public void run()
	{
24
		log.debug("[TASK] Cancel Subscription : {}", toString());
25 26 27 28 29 30 31 32 33 34

		Node node = getNode();
		
		// This will only occur if a PEP service is not loaded.  We can safely do nothing in this 
		// case since any changes will get loaded from the db when it is loaded.
		if (node == null)
			return;
		
		// This method will make a db call, but it will simply do nothing since
		// the record will already be deleted.
35
		node.cancelSubscription(getSubscription(), false);
36 37
	}
}