public class CountDownPublisherListener<T> extends CountDownRegistrantListener<Publisher<T>> implements PublisherListener<T>
PublisherListener
which uses separate CountDownLatch
instances for all signals.Modifier and Type | Method and Description |
---|---|
void |
awaitNewSubscriber()
Wait for the requested number of shutdowns.
|
boolean |
awaitNewSubscriber(long timeout,
java.util.concurrent.TimeUnit unit)
Wait for the requested number of new subscribers within the given time
period.
|
void |
awaitShutdown()
Wait for for shutdown.
|
boolean |
awaitShutdown(long timeout,
java.util.concurrent.TimeUnit unit)
Wait for shutdown within the given time period.
|
static <T> CountDownPublisherListener<T> |
newDefault() |
static <T> CountDownPublisherListener<T> |
newFromCounts(int masterRegistrationSuccessCount,
int masterRegistrationFailureCount,
int masterUnregistrationSuccessCount,
int masterUnregistrationFailureCount,
int newSubscriberCount) |
void |
onNewSubscriber(Publisher<T> publisher,
SubscriberIdentifier subscriberIdentifier)
A
Subscriber has connected to the Publisher . |
void |
onShutdown(Publisher<T> publisher)
The
Publisher has been shut down. |
awaitMasterRegistrationFailure, awaitMasterRegistrationFailure, awaitMasterRegistrationSuccess, awaitMasterRegistrationSuccess, awaitMasterUnregistrationFailure, awaitMasterUnregistrationFailure, awaitMasterUnregistrationSuccess, awaitMasterUnregistrationSuccess, onMasterRegistrationFailure, onMasterRegistrationSuccess, onMasterUnregistrationFailure, onMasterUnregistrationSuccess
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onMasterRegistrationFailure, onMasterRegistrationSuccess, onMasterUnregistrationFailure, onMasterUnregistrationSuccess
public static <T> CountDownPublisherListener<T> newDefault()
public static <T> CountDownPublisherListener<T> newFromCounts(int masterRegistrationSuccessCount, int masterRegistrationFailureCount, int masterUnregistrationSuccessCount, int masterUnregistrationFailureCount, int newSubscriberCount)
masterRegistrationSuccessCount
- the number of successful master registrations to wait formasterRegistrationFailureCount
- the number of failing master registrations to wait formasterUnregistrationSuccessCount
- the number of successful master unregistrations to wait formasterUnregistrationFailureCount
- the number of failing master unregistrations to wait fornewSubscriberCount
- the number of new subscribers to wait forpublic void onNewSubscriber(Publisher<T> publisher, SubscriberIdentifier subscriberIdentifier)
PublisherListener
Subscriber
has connected to the Publisher
.onNewSubscriber
in interface PublisherListener<T>
publisher
- the Publisher
that the Subscriber
connected tosubscriberIdentifier
- the SubscriberIdentifier
of the new Subscriber
public void onShutdown(Publisher<T> publisher)
PublisherListener
Publisher
has been shut down.onShutdown
in interface PublisherListener<T>
publisher
- the Publisher
that was shut downpublic void awaitNewSubscriber() throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean awaitNewSubscriber(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
timeout
- the maximum time to waitunit
- the TimeUnit
of the timeout
argumenttrue
if the requested number of new subscribers connect
within the time period false
otherwise.java.lang.InterruptedException
public void awaitShutdown() throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean awaitShutdown(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
timeout
- the maximum time to waitunit
- the TimeUnit
of the timeout
argumenttrue
if shutdown happened within the time period,
false
otherwisejava.lang.InterruptedException