|
Siena (v.1.5.5) API documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsiena.NotificationBuffer
public class NotificationBuffer
a "mailbox" for notifications functions as a proxy notifiable. It receives and stores notifications and sequences of notifications from Siena. Notifications and sequences can be retrieved synchronously (blocking) or asynchronously (non-blocking).
Example:
Siena siena;
Filter f;
// ...
// siena = new ...
// f = new Filter();
// f.addConstraint ...
// ...
NotificationBuffer queue = new NotificationBuffer();
siena.subscribe(f, queue);
Notification n = queue.getNotification(-1); // infinite timeout
System.out.println(n.toString());
Notice that NotificationBuffer
handles notifications and
sequences (of notifications) separately.
Notification
,
Notifiable
Constructor Summary | |
---|---|
NotificationBuffer()
constructs an empty NotificationBuffer with unlimited capacity this NotificationBuffer will grow dynamically to store any number of notifications and sequences. |
|
NotificationBuffer(int dimension)
constructs an empty NotificationBuffer with limited capacity this NotificationBuffer will hold up to dimension notifications and dimension sequences. |
Method Summary | |
---|---|
Notification |
getNotification()
attempts to extract a notification (non-blocking) attempts to extract a notification. |
Notification |
getNotification(long timeout)
attempts to extract a notification (blocking) attempts to extract a notification. |
Notification[] |
getSequence()
|
Notification[] |
getSequence(long timeout)
attempts to extract a sequence of notification (non-blocking) attempts to extract a sequence of notifications. |
int |
notificationsCount()
number of available notifications |
void |
notify(Notification n)
sends a Notification to this Notifable
Since version 1.0.1 of the Siena API it is safe to modify the
Notification object received through this method. |
void |
notify(Notification[] s)
sends a sequence of Notification s to this
Notifable
Since version 1.0.1 of the Siena API it is safe to modify the
Notification objects received through this method. |
int |
sequencesCount()
the number of available sequences of notifications |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NotificationBuffer()
public NotificationBuffer(int dimension)
dimension
- maximum capacity. Must be > 0Method Detail |
---|
public int notificationsCount()
public int sequencesCount()
public void notify(Notification n)
Notifiable
Notification
to this Notifable
Since version 1.0.1 of the Siena API it is safe to modify the
Notification object received through this method. Note that:
notify
in interface Notifiable
n
- notification passed to the notifiableSiena.subscribe(Filter,Notifiable)
public void notify(Notification[] s)
Notifiable
Notification
s to this
Notifable
Since version 1.0.1 of the Siena API it is safe to modify the
Notification objects received through this method. Please
read the notes in the above documentation of Notifiable.notify(Notification)
, which apply to this method as well.
notify
in interface Notifiable
s
- sequence of notifications passed to the notifiableSiena.subscribe(Pattern,Notifiable)
public Notification getNotification()
null
if none is available.
null
public Notification getNotification(long timeout) throws java.lang.InterruptedException
null
in case the timeout expired.
null
java.lang.InterruptedException
public Notification[] getSequence() throws java.lang.InterruptedException
java.lang.InterruptedException
public Notification[] getSequence(long timeout) throws java.lang.InterruptedException
null
in case the timeout expired.
null
java.lang.InterruptedException
|
Siena (v.1.5.5) API documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |