Class RegisteredRpcConnection<F extends Serializable,G extends org.apache.flink.runtime.rpc.RpcGateway,S extends RegistrationResponse.Success,R extends RegistrationResponse.Rejection>
java.lang.Object
org.apache.flink.runtime.registration.RegisteredRpcConnection<F,G,S,R>
- Type Parameters:
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.
- Direct Known Subclasses:
TaskExecutorToResourceManagerConnection
public abstract class RegisteredRpcConnection<F extends Serializable,G extends org.apache.flink.runtime.rpc.RpcGateway,S extends RegistrationResponse.Success,R extends RegistrationResponse.Rejection>
extends Object
This utility class implements the basis of RPC connecting from one component to another
component, for example the RPC connection from TaskExecutor to ResourceManager. This
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.slf4j.LoggerThe logger for all log messages of this class. -
Constructor Summary
ConstructorsConstructorDescriptionRegisteredRpcConnection(org.slf4j.Logger log, String targetAddress, F fencingToken, Executor executor) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close connection.protected abstract RetryingRegistration<F,G, S, R> This method generate a specific Registration, for example TaskExecutor Registration at the ResourceManager.Gets the RegisteredGateway.booleanisClosed()booleanprotected abstract voidonRegistrationFailure(Throwable failure) This method handle the Registration failure.protected abstract voidonRegistrationRejection(R rejection) This method handles the Registration rejection.protected abstract voidonRegistrationSuccess(S success) This method handle the Registration Response.voidstart()toString()booleanTries to reconnect to thetargetAddressby cancelling the pending registration and starting a new pending registration.
-
Field Details
-
log
protected final org.slf4j.Logger logThe logger for all log messages of this class.
-
-
Constructor Details
-
RegisteredRpcConnection
-
-
Method Details
-
start
public void start() -
tryReconnect
public boolean tryReconnect()Tries to reconnect to thetargetAddressby cancelling the pending registration and starting a new pending registration.- Returns:
falseif the connection has been closed or a concurrent modification has happened; otherwisetrue
-
generateRegistration
This method generate a specific Registration, for example TaskExecutor Registration at the ResourceManager. -
onRegistrationSuccess
This method handle the Registration Response. -
onRegistrationRejection
This method handles the Registration rejection.- Parameters:
rejection- rejection containing additional information about the rejection
-
onRegistrationFailure
This method handle the Registration failure. -
close
public void close()Close connection. -
isClosed
public boolean isClosed() -
getTargetLeaderId
-
getTargetAddress
-
getTargetGateway
Gets the RegisteredGateway. This returns null until the registration is completed. -
isConnected
public boolean isConnected() -
toString
-