javapns.notification.transmission
Interface PushQueue

All Known Implementing Classes:
NotificationThread, NotificationThreads

public interface PushQueue

A queue backed by an asynchronous notification thread or threads.

Author:
Sylvain Pedneault

Method Summary
 PushQueue add(Payload payload, Device device)
          Queue a message for delivery.
 PushQueue add(PayloadPerDevice message)
          Queue a message for delivery.
 PushQueue add(Payload payload, String token)
          Queue a message for delivery.
 void clearPushedNotifications()
          Deprecated. 
 List<Exception> getCriticalExceptions()
          Get a list of critical exceptions that underlying threads experienced.
 PushedNotifications getPushedNotifications(boolean clearList)
          Get a list of all notifications pushed through this queue.
 PushQueue start()
          Start the transmission thread(s) working for the queue.
 void stopQueue()
          Invoke stopQueue on all threads working for the queue.
 

Method Detail

add

PushQueue add(Payload payload,
              String token)
              throws InvalidDeviceTokenFormatException
Queue a message for delivery. A thread will pick it up and push it asynchroneously. This method has no effect if the underlying notification thread is not in QUEUE mode.

Parameters:
payload - a payload
token - a device token
Returns:
the actual queue to which the message was added, which could be a different one if the request was delegated to a sub-queue
Throws:
InvalidDeviceTokenFormatException

add

PushQueue add(Payload payload,
              Device device)
Queue a message for delivery. A thread will pick it up and push it asynchroneously. This method has no effect if the underlying notification thread is not in QUEUE mode.

Parameters:
payload - a payload
device - a device
Returns:
the actual queue to which the message was added, which could be a different one if the request was delegated to a sub-queue

add

PushQueue add(PayloadPerDevice message)
Queue a message for delivery. A thread will pick it up and push it asynchroneously. This method has no effect if the underlying notification thread is not in QUEUE mode.

Parameters:
message - a payload/device pair
Returns:
the actual queue to which the message was added, which could be a different one if the request was delegated to a sub-queue

start

PushQueue start()
Start the transmission thread(s) working for the queue.

Returns:
the queue itself, as a handy shortcut to create and start a queue in a single line of code

stopQueue

void stopQueue()
Invoke stopQueue on all threads working for the queue.


getCriticalExceptions

List<Exception> getCriticalExceptions()
Get a list of critical exceptions that underlying threads experienced. Critical exceptions include CommunicationException and KeystoreException. Exceptions related to tokens, payloads and such are *not* included here, as they are noted in individual PushedNotification objects. If critical exceptions are present, the underlying thread(s) is most likely not working at all and you should solve the problem before trying to go any further.

Returns:
a list of critical exceptions

getPushedNotifications

PushedNotifications getPushedNotifications(boolean clearList)
Get a list of all notifications pushed through this queue.

Returns:
a list of pushed notifications

clearPushedNotifications

@Deprecated
void clearPushedNotifications()
Deprecated. 

Clear the internal lists of PushedNotification objects maintained by this queue. You should invoke this method once you no longer need the list of PushedNotification objects so that memory can be reclaimed.