F
- The type of the fencing tokenG
- The type of the gateway to connect to.S
- The type of the successful registration responses.public abstract class RetryingRegistration<F extends Serializable,G extends RpcGateway,S extends RegistrationResponse.Success> extends Object
RetryingRegistration
implements both the initial address resolution
and the retries-with-backoff strategy.
The registration gives access to a future that is completed upon successful registration. The registration can be canceled, for example when the target where it tries to register at looses leader status.
Constructor and Description |
---|
RetryingRegistration(org.slf4j.Logger log,
RpcService rpcService,
String targetName,
Class<G> targetType,
String targetAddress,
F fencingToken) |
RetryingRegistration(org.slf4j.Logger log,
RpcService rpcService,
String targetName,
Class<G> targetType,
String targetAddress,
F fencingToken,
long initialRegistrationTimeout,
long maxRegistrationTimeout,
long delayOnError,
long delayOnRefusedRegistration) |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels the registration procedure.
|
CompletableFuture<Tuple2<G,S>> |
getFuture() |
protected abstract CompletableFuture<RegistrationResponse> |
invokeRegistration(G gateway,
F fencingToken,
long timeoutMillis) |
boolean |
isCanceled()
Checks if the registration was canceled.
|
void |
startRegistration()
This method resolves the target address to a callable gateway and starts the
registration after that.
|
public RetryingRegistration(org.slf4j.Logger log, RpcService rpcService, String targetName, Class<G> targetType, String targetAddress, F fencingToken)
public CompletableFuture<Tuple2<G,S>> getFuture()
public void cancel()
public boolean isCanceled()
protected abstract CompletableFuture<RegistrationResponse> invokeRegistration(G gateway, F fencingToken, long timeoutMillis) throws Exception
Exception
public void startRegistration()
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.