@PublicEvolving public class QueryableStateClient extends Object
You can mark state as queryable via StateDescriptor.setQueryable(String)
. The state
instance created from this descriptor will be published for queries when it's created on the Task
Managers and the location will be reported to the Job Manager.
The client connects to a Client Proxy
running on a given Task Manager. The proxy is
the entry point of the client to the Flink cluster. It forwards the requests of the client to the
Job Manager and the required Task Manager, and forwards the final response back the client.
The proxy, initially resolves the location of the requested KvState via the JobManager. Resolved locations are cached. When the server address of the requested KvState instance is determined, the client sends out a request to the server. The returned final answer is then forwarded to the Client.
Constructor and Description |
---|
QueryableStateClient(InetAddress remoteAddress,
int remotePort)
Create the Queryable State Client.
|
QueryableStateClient(String remoteHostname,
int remotePort)
Create the Queryable State Client.
|
Modifier and Type | Method and Description |
---|---|
ExecutionConfig |
getExecutionConfig()
Gets the
ExecutionConfig . |
<K,S extends State,V> |
getKvState(JobID jobId,
String queryableStateName,
K key,
TypeHint<K> keyTypeHint,
StateDescriptor<S,V> stateDescriptor)
Returns a future holding the request result.
|
<K,S extends State,V> |
getKvState(JobID jobId,
String queryableStateName,
K key,
TypeInformation<K> keyTypeInfo,
StateDescriptor<S,V> stateDescriptor)
Returns a future holding the request result.
|
ExecutionConfig |
setExecutionConfig(ExecutionConfig config)
Replaces the existing
ExecutionConfig (possibly null ), with the provided one. |
ClassLoader |
setUserClassLoader(ClassLoader userClassLoader)
* Replaces the existing
ClassLoader (possibly null ), with the provided one. |
CompletableFuture<?> |
shutdownAndHandle()
Shuts down the client and returns a
CompletableFuture that will be completed when the
shutdown process is completed. |
void |
shutdownAndWait()
Shuts down the client and waits until shutdown is completed.
|
public QueryableStateClient(String remoteHostname, int remotePort) throws UnknownHostException
remoteHostname
- the hostname of the Client Proxy
to connect to.remotePort
- the port of the proxy to connect to.UnknownHostException
public QueryableStateClient(InetAddress remoteAddress, int remotePort)
remoteAddress
- the address
of the Client Proxy
to connect
to.remotePort
- the port of the proxy to connect to.public CompletableFuture<?> shutdownAndHandle()
CompletableFuture
that will be completed when the
shutdown process is completed.
If an exception is thrown for any reason, then the returned future will be completed exceptionally with that exception.
CompletableFuture
for further handling of the shutdown result.public void shutdownAndWait()
If an exception is thrown, a warning is logged containing the exception message.
public ExecutionConfig getExecutionConfig()
ExecutionConfig
.public ExecutionConfig setExecutionConfig(ExecutionConfig config)
ExecutionConfig
(possibly null
), with the provided one.config
- The new configuration
.null
if none was specified.public ClassLoader setUserClassLoader(ClassLoader userClassLoader)
ClassLoader
(possibly null
), with the provided one.userClassLoader
- The new userClassLoader
.null
if none was specified.@PublicEvolving public <K,S extends State,V> CompletableFuture<S> getKvState(JobID jobId, String queryableStateName, K key, TypeHint<K> keyTypeHint, StateDescriptor<S,V> stateDescriptor)
jobId
- JobID of the job the queryable state belongs to.queryableStateName
- Name under which the state is queryable.key
- The key we are interested in.keyTypeHint
- A TypeHint
used to extract the type of the key.stateDescriptor
- The StateDescriptor
of the state we want to query.State
object containing the result.@PublicEvolving public <K,S extends State,V> CompletableFuture<S> getKvState(JobID jobId, String queryableStateName, K key, TypeInformation<K> keyTypeInfo, StateDescriptor<S,V> stateDescriptor)
jobId
- JobID of the job the queryable state belongs to.queryableStateName
- Name under which the state is queryable.key
- The key we are interested in.keyTypeInfo
- The TypeInformation
of the key.stateDescriptor
- The StateDescriptor
of the state we want to query.State
object containing the result.Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.