import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
* the caller to specify that it should never wait, or put an upper bound on how
* long it is going to wait.
*/
* the caller to specify that it should never wait, or put an upper bound on how
* long it is going to wait.
*/
/**
* Well-known value indicating that the implementation is currently not
* able to accept a notification.
*/
/**
* Well-known value indicating that the implementation is currently not
* able to accept a notification.
*/
* Abstract subclasses can refine the return type as returning a promise of a
* more specific type, e.g.:
*
* Abstract subclasses can refine the return type as returning a promise of a
* more specific type, e.g.:
*
* public interface DeliveryStatus { int getListenerCount(); }
* ListenableFuture<? extends DeliveryStatus> putNotification(DOMNotification notification);
* public interface DeliveryStatus { int getListenerCount(); }
* ListenableFuture<? extends DeliveryStatus> putNotification(DOMNotification notification);
* // Can block when (for example) the implemention's ThreadPool queue is full
* Object o = service.putNotification(notif).get();
* if (o instanceof DeliveryStatus) {
* // Can block when (for example) the implemention's ThreadPool queue is full
* Object o = service.putNotification(notif).get();
* if (o instanceof DeliveryStatus) {
* In case an implementation is running out of resources, it can block the calling
* thread until enough resources become available to accept the notification for
* processing, or it is interrupted.
*
* In case an implementation is running out of resources, it can block the calling
* thread until enough resources become available to accept the notification for
* processing, or it is interrupted.
*
* Caution: completion here means that the implementation has completed processing
* of the notification. This does not mean that all existing registrants
* have seen the notification. Most importantly, the delivery process at
* Caution: completion here means that the implementation has completed processing
* of the notification. This does not mean that all existing registrants
* have seen the notification. Most importantly, the delivery process at
* @throws InterruptedException if interrupted while waiting
* @throws NullPointerException if notification is null.
*/
* @throws InterruptedException if interrupted while waiting
* @throws NullPointerException if notification is null.
*/
* @param notification Notification to be published.
* @return A listenable future which will report completion when the service
* has finished propagating the notification to its immediate registrants,
* @param notification Notification to be published.
* @return A listenable future which will report completion when the service
* has finished propagating the notification to its immediate registrants,
* the implementation from accepting the notification for delivery.
* @throws NullPointerException if notification is null.
*/
* the implementation from accepting the notification for delivery.
* @throws NullPointerException if notification is null.
*/
* @param unit a TimeUnit determining how to interpret the timeout parameter
* @return A listenable future which will report completion when the service
* has finished propagating the notification to its immediate registrants,
* @param unit a TimeUnit determining how to interpret the timeout parameter
* @return A listenable future which will report completion when the service
* has finished propagating the notification to its immediate registrants,
* the implementation from accepting the notification for delivery.
* @throws InterruptedException if interrupted while waiting
* @throws NullPointerException if notification or unit is null.
* @throws IllegalArgumentException if timeout is negative.
*/
* the implementation from accepting the notification for delivery.
* @throws InterruptedException if interrupted while waiting
* @throws NullPointerException if notification or unit is null.
* @throws IllegalArgumentException if timeout is negative.
*/