javapns.notification.transmission
Enum NotificationThread.MODE

java.lang.Object
  extended by java.lang.Enum<NotificationThread.MODE>
      extended by javapns.notification.transmission.NotificationThread.MODE
All Implemented Interfaces:
Serializable, Comparable<NotificationThread.MODE>
Enclosing class:
NotificationThread

public static enum NotificationThread.MODE
extends Enum<NotificationThread.MODE>

Working modes supported by Notification Threads.


Enum Constant Summary
LIST
          In LIST mode, the thread is given a predefined list of devices and pushes all notifications as soon as it is started.
QUEUE
          In QUEUE mode, the thread is started with an open connection and no notification to send, and waits for notifications to be queued.
STOP
          Mode used to stop a queue gracefully.
 
Method Summary
static NotificationThread.MODE valueOf(String name)
          Returns the enum constant of this type with the specified name.
static NotificationThread.MODE[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

LIST

public static final NotificationThread.MODE LIST
In LIST mode, the thread is given a predefined list of devices and pushes all notifications as soon as it is started. Its work is complete, the connection is closed and the thread ends as soon as all notifications have been sent. This mode is appropriate when you have a large amount of notifications to send in one batch.


QUEUE

public static final NotificationThread.MODE QUEUE
In QUEUE mode, the thread is started with an open connection and no notification to send, and waits for notifications to be queued. It opens a connection and waits for messages to be added to its queue using a queue(..) method. This mode is appropriate when you need to periodically send random individual notifications and you do not wish to open and close connections to Apple all the time (which is something Apple warns against in their documentation). Unless your software is constantly generating large amounts of random notifications and that you absolutely need to stream them over multiple threaded connections, you should not need to create more than one NotificationThread in QUEUE mode.


STOP

public static final NotificationThread.MODE STOP
Mode used to stop a queue gracefully.

Method Detail

values

public static NotificationThread.MODE[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (NotificationThread.MODE c : NotificationThread.MODE.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static NotificationThread.MODE valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null