Class KvStateClientProxyImpl
- java.lang.Object
-
- org.apache.flink.queryablestate.network.AbstractServerBase<KvStateRequest,KvStateResponse>
-
- org.apache.flink.queryablestate.client.proxy.KvStateClientProxyImpl
-
- All Implemented Interfaces:
KvStateClientProxy
,KvStateServer
@Internal public class KvStateClientProxyImpl extends AbstractServerBase<KvStateRequest,KvStateResponse> implements KvStateClientProxy
The default implementation of theKvStateClientProxy
.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.queryablestate.network.AbstractServerBase
log
-
-
Constructor Summary
Constructors Constructor Description KvStateClientProxyImpl(String bindAddress, Iterator<Integer> bindPortIterator, Integer numEventLoopThreads, Integer numQueryThreads, KvStateRequestStats stats)
Creates the Queryable State Client Proxy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KvStateLocationOracle
getKvStateLocationOracle(JobID jobId)
Retrieves a future containing the currently leading key-value state location oracle.InetSocketAddress
getServerAddress()
Returns the address of this server.AbstractServerHandler<KvStateRequest,KvStateResponse>
initializeHandler()
Returns thehandler
to be used for serving the incoming requests.void
shutdown()
Shuts down the server and all related thread pools.void
start()
Starts the server by binding to the configured bind address (blocking).void
updateKvStateLocationOracle(JobID jobId, KvStateLocationOracle kvStateLocationOracle)
Updates the activeJob Manager
in case of change.-
Methods inherited from class org.apache.flink.queryablestate.network.AbstractServerBase
getQueryExecutor, getServerName, isEventGroupShutdown, shutdownServer
-
-
-
-
Constructor Detail
-
KvStateClientProxyImpl
public KvStateClientProxyImpl(String bindAddress, Iterator<Integer> bindPortIterator, Integer numEventLoopThreads, Integer numQueryThreads, KvStateRequestStats stats)
Creates the Queryable State Client Proxy.The server is instantiated using reflection by the
QueryableStateUtils.createKvStateClientProxy(InetAddress, Iterator, int, int, KvStateRequestStats)
.The server needs to be started via
start()
in order to bind to the configured bind address.- Parameters:
bindAddress
- the address to listen to.bindPortIterator
- the port range to try to bind to.numEventLoopThreads
- number of event loop threads.numQueryThreads
- number of query threads.stats
- the statistics collector.
-
-
Method Detail
-
getServerAddress
public InetSocketAddress getServerAddress()
Description copied from class:AbstractServerBase
Returns the address of this server.- Specified by:
getServerAddress
in interfaceKvStateServer
- Overrides:
getServerAddress
in classAbstractServerBase<KvStateRequest,KvStateResponse>
- Returns:
- AbstractServerBase address
-
start
public void start() throws Throwable
Description copied from class:AbstractServerBase
Starts the server by binding to the configured bind address (blocking).- Specified by:
start
in interfaceKvStateServer
- Overrides:
start
in classAbstractServerBase<KvStateRequest,KvStateResponse>
- Throws:
Throwable
-
shutdown
public void shutdown()
Description copied from interface:KvStateServer
Shuts down the server and all related thread pools.- Specified by:
shutdown
in interfaceKvStateServer
-
updateKvStateLocationOracle
public void updateKvStateLocationOracle(JobID jobId, @Nullable KvStateLocationOracle kvStateLocationOracle)
Description copied from interface:KvStateClientProxy
Updates the activeJob Manager
in case of change.This is useful in settings where high-availability is enabled and a failed Job Manager is replaced by a new one.
IMPORTANT: this method may be called by a different thread than the
KvStateClientProxy.getKvStateLocationOracle(JobID)
.- Specified by:
updateKvStateLocationOracle
in interfaceKvStateClientProxy
- Parameters:
jobId
- identifying the job for which to update the key-value state location oraclekvStateLocationOracle
- the key-value state location oracle for the givenJobID
, or null if there is no oracle anymore
-
getKvStateLocationOracle
@Nullable public KvStateLocationOracle getKvStateLocationOracle(JobID jobId)
Description copied from interface:KvStateClientProxy
Retrieves a future containing the currently leading key-value state location oracle.IMPORTANT: this method may be called by a different thread than the
KvStateClientProxy.updateKvStateLocationOracle(JobID, KvStateLocationOracle)
.- Specified by:
getKvStateLocationOracle
in interfaceKvStateClientProxy
- Parameters:
jobId
- identifying the job for which to request the key-value state location oracle- Returns:
- The key-value state location oracle for the given
JobID
or null if none.
-
initializeHandler
public AbstractServerHandler<KvStateRequest,KvStateResponse> initializeHandler()
Description copied from class:AbstractServerBase
Returns thehandler
to be used for serving the incoming requests.- Specified by:
initializeHandler
in classAbstractServerBase<KvStateRequest,KvStateResponse>
-
-