public class CountDownRegistrantListener<T> extends java.lang.Object implements RegistrantListener<T>
Constructor and Description |
---|
CountDownRegistrantListener()
Construct a
CountDownPublisherListener with all counts set to 1. |
CountDownRegistrantListener(java.util.concurrent.CountDownLatch masterRegistrationSuccessLatch,
java.util.concurrent.CountDownLatch masterRegistrationFailureLatch,
java.util.concurrent.CountDownLatch masterUnregistrationSuccessLatch,
java.util.concurrent.CountDownLatch masterUnregistrationFailureLatch) |
CountDownRegistrantListener(int masterRegistrationSuccessCount,
int masterRegistrationFailureCount,
int masterUnregistrationSuccessCount,
int masterUnregistrationFailureCount) |
Modifier and Type | Method and Description |
---|---|
void |
awaitMasterRegistrationFailure()
Wait for the requested number of failed registrations.
|
boolean |
awaitMasterRegistrationFailure(long timeout,
java.util.concurrent.TimeUnit unit)
Wait for the requested number of failed registrations within the given time
period.
|
void |
awaitMasterRegistrationSuccess()
Wait for the requested number of successful registrations.
|
boolean |
awaitMasterRegistrationSuccess(long timeout,
java.util.concurrent.TimeUnit unit)
Wait for the requested number of successful registrations within the given
time period.
|
void |
awaitMasterUnregistrationFailure()
Wait for the requested number of failed unregistrations.
|
boolean |
awaitMasterUnregistrationFailure(long timeout,
java.util.concurrent.TimeUnit unit)
Wait for the requested number of failed unregistrations within the given
time period.
|
void |
awaitMasterUnregistrationSuccess()
Wait for the requested number of successful unregistrations.
|
boolean |
awaitMasterUnregistrationSuccess(long timeout,
java.util.concurrent.TimeUnit unit)
Wait for the requested number of successful unregistrations within the
given time period.
|
void |
onMasterRegistrationFailure(T registrant)
The registrant has failed to register with the master.
|
void |
onMasterRegistrationSuccess(T registrant)
The registrant has been registered with the master.
|
void |
onMasterUnregistrationFailure(T registrant)
The registrant has failed to unregister with the master.
|
void |
onMasterUnregistrationSuccess(T registrant)
The registrant has been unregistered with the master.
|
public CountDownRegistrantListener()
CountDownPublisherListener
with all counts set to 1.public CountDownRegistrantListener(int masterRegistrationSuccessCount, int masterRegistrationFailureCount, int masterUnregistrationSuccessCount, int masterUnregistrationFailureCount)
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 forpublic CountDownRegistrantListener(java.util.concurrent.CountDownLatch masterRegistrationSuccessLatch, java.util.concurrent.CountDownLatch masterRegistrationFailureLatch, java.util.concurrent.CountDownLatch masterUnregistrationSuccessLatch, java.util.concurrent.CountDownLatch masterUnregistrationFailureLatch)
public void onMasterRegistrationSuccess(T registrant)
RegistrantListener
onMasterRegistrationSuccess
in interface RegistrantListener<T>
registrant
- the registrant which has been registeredpublic void onMasterRegistrationFailure(T registrant)
RegistrantListener
This may be called multiple times per registrant since master registration will be retried until success.
onMasterRegistrationFailure
in interface RegistrantListener<T>
registrant
- the registrant which has been registeredpublic void onMasterUnregistrationSuccess(T registrant)
RegistrantListener
onMasterUnregistrationSuccess
in interface RegistrantListener<T>
registrant
- the registrant which has been unregisteredpublic void onMasterUnregistrationFailure(T registrant)
RegistrantListener
This may be called multiple times per registrant since master unregistration will be retried until success.
onMasterUnregistrationFailure
in interface RegistrantListener<T>
registrant
- the registrant which has been unregisteredpublic void awaitMasterRegistrationSuccess() throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean awaitMasterRegistrationSuccess(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 registration happened within the time period,
false
otherwisejava.lang.InterruptedException
public void awaitMasterUnregistrationSuccess() throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean awaitMasterUnregistrationSuccess(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 unregistration happened within the time period,
false
otherwisejava.lang.InterruptedException
public void awaitMasterRegistrationFailure() throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean awaitMasterRegistrationFailure(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 registration happened within the time period,
false
otherwisejava.lang.InterruptedException
public void awaitMasterUnregistrationFailure() throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean awaitMasterUnregistrationFailure(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 unregistration happened within the time period,
false
otherwisejava.lang.InterruptedException