net.rim.pushsdk.subscription.match
Class SubStatusAlternateMatchManager

java.lang.Object
  extended by net.rim.pushsdk.subscription.match.SubStatusAlternateMatchManager
All Implemented Interfaces:
Callable<List<SubscriberPartial>>

public class SubStatusAlternateMatchManager
extends Object
implements Callable<List<SubscriberPartial>>

Performs threaded subscription matching to retrieve a list of subscribers for a push application that have a certain status (e.g. ACTIVE) and were found in a given list of subscriber ids.

It uses a different algorithm than SubStatusMatchManager and returns a list of subscribers rather than a list of subscriber ids.

The algorithm used here is:
For each request that comes in through a call to the matchSubscriptions method, call the matchByAppIdAndIdsAndStatus method from the SubscriptionService with the specified app id, status, and list of subscriber ids to be matched. This returns a list of subscribers matching the specified criteria.

After all the requests have been processed, the list of subscribers back from processing each request are combined and can be obtained through the getSubscriptionMatchResults method.

Author:
mdandrea
See Also:
SubStatusMatchManager

Constructor Summary
SubStatusAlternateMatchManager()
           
 
Method Summary
 List<SubscriberPartial> call()
          Pulls a match request off the queue and performs the subscription matching for that one request.
 List<SubscriberPartial> getSubscriptionMatchResults()
          This method must be called after all matchSubscriptions() method calls have been made with requests.
 void matchSubscriptions(String pushAppId, List<String> subscriberIds, SubscriberStatus status)
          Initiates the process to match the subscriptions from storage with the ones from the given subscriber ids list.
 void setPushSDKProperties(PushSDKProperties pushSDKProperties)
          Support for dependency injection.
 void setSubscriptionService(SubscriptionService subscriptionService)
          Support for dependency injection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubStatusAlternateMatchManager

public SubStatusAlternateMatchManager()
Method Detail

setPushSDKProperties

public void setPushSDKProperties(PushSDKProperties pushSDKProperties)
Support for dependency injection. This will override the default PushSDKProperties implementation.

Parameters:
pushSDKProperties -

setSubscriptionService

public void setSubscriptionService(SubscriptionService subscriptionService)
Support for dependency injection. Inject an implementation of a SubscriptionService collaborating object.

Parameters:
subscriptionService - an instance of a SubscriptionService implementation (must be thread safe)

matchSubscriptions

public void matchSubscriptions(String pushAppId,
                               List<String> subscriberIds,
                               SubscriberStatus status)
Initiates the process to match the subscriptions from storage with the ones from the given subscriber ids list.

Parameters:
pushAppId - the id of a push application
subscriberIds - the subscriber ids to match
status - the status of the subscribers to look for in storage

getSubscriptionMatchResults

public List<SubscriberPartial> getSubscriptionMatchResults()
                                                    throws ExecutionException,
                                                           InterruptedException
This method must be called after all matchSubscriptions() method calls have been made with requests.

Returns:
a combined list of subscriber results from all the match requests
Throws:
ExecutionException - if the computation threw an exception
InterruptedException - if the computation was interrupted while processing

call

public List<SubscriberPartial> call()
Pulls a match request off the queue and performs the subscription matching for that one request.

Specified by:
call in interface Callable<List<SubscriberPartial>>
Returns:
a list of matching subscriber ids from the request


Copyright © 2011 Research In Motion. All Rights Reserved.