F
- The type of the fencing tokenG
- The type of the gateway to connect to.S
- The type of the successful registration responses.R
- The type of the registration rejection responses.public abstract class RegisteredRpcConnection<F extends Serializable,G extends RpcGateway,S extends RegistrationResponse.Success,R extends RegistrationResponse.Rejection> extends Object
RegisteredRpcConnection
implements registration and get target gateway.
The registration gives access to a future that is completed upon successful registration. The RPC connection can be closed, for example when the target where it tries to register loses leader status.
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log
The logger for all log messages of this class.
|
Constructor and Description |
---|
RegisteredRpcConnection(org.slf4j.Logger log,
String targetAddress,
F fencingToken,
Executor executor) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close connection.
|
protected abstract RetryingRegistration<F,G,S,R> |
generateRegistration()
This method generate a specific Registration, for example TaskExecutor Registration at the
ResourceManager.
|
String |
getTargetAddress() |
G |
getTargetGateway()
Gets the RegisteredGateway.
|
F |
getTargetLeaderId() |
boolean |
isClosed() |
boolean |
isConnected() |
protected abstract void |
onRegistrationFailure(Throwable failure)
This method handle the Registration failure.
|
protected abstract void |
onRegistrationRejection(R rejection)
This method handles the Registration rejection.
|
protected abstract void |
onRegistrationSuccess(S success)
This method handle the Registration Response.
|
void |
start() |
String |
toString() |
boolean |
tryReconnect()
Tries to reconnect to the
targetAddress by cancelling the pending registration and
starting a new pending registration. |
protected final org.slf4j.Logger log
public void start()
public boolean tryReconnect()
targetAddress
by cancelling the pending registration and
starting a new pending registration.false
if the connection has been closed or a concurrent modification has
happened; otherwise true
protected abstract RetryingRegistration<F,G,S,R> generateRegistration()
protected abstract void onRegistrationSuccess(S success)
protected abstract void onRegistrationRejection(R rejection)
rejection
- rejection containing additional information about the rejectionprotected abstract void onRegistrationFailure(Throwable failure)
public void close()
public boolean isClosed()
public F getTargetLeaderId()
public String getTargetAddress()
public G getTargetGateway()
public boolean isConnected()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.