org.apache.flink.queryablestate.exceptions.UnknownLocationException Java Examples
The following examples show how to use
org.apache.flink.queryablestate.exceptions.UnknownLocationException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KvStateClientProxyHandler.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
/** * Lookup the {@link KvStateLocation} for the given job and queryable state name. * * <p>The job manager will be queried for the location only if forced or no * cached location can be found. There are no guarantees about * * @param jobId JobID the state instance belongs to. * @param queryableStateName Name under which the state instance has been published. * @param forceUpdate Flag to indicate whether to force a update via the lookup service. * @return Future holding the KvStateLocation */ private CompletableFuture<KvStateLocation> getKvStateLookupInfo( final JobID jobId, final String queryableStateName, final boolean forceUpdate) { final Tuple2<JobID, String> cacheKey = new Tuple2<>(jobId, queryableStateName); final CompletableFuture<KvStateLocation> cachedFuture = lookupCache.get(cacheKey); if (!forceUpdate && cachedFuture != null && !cachedFuture.isCompletedExceptionally()) { LOG.debug("Retrieving location for state={} of job={} from the cache.", queryableStateName, jobId); return cachedFuture; } final KvStateLocationOracle kvStateLocationOracle = proxy.getKvStateLocationOracle(jobId); if (kvStateLocationOracle != null) { LOG.debug("Retrieving location for state={} of job={} from the key-value state location oracle.", queryableStateName, jobId); final CompletableFuture<KvStateLocation> location = new CompletableFuture<>(); lookupCache.put(cacheKey, location); kvStateLocationOracle .requestKvStateLocation(jobId, queryableStateName) .whenComplete( (KvStateLocation kvStateLocation, Throwable throwable) -> { if (throwable != null) { if (ExceptionUtils.stripCompletionException(throwable) instanceof FlinkJobNotFoundException) { // if the jobId was wrong, remove the entry from the cache. lookupCache.remove(cacheKey); } location.completeExceptionally(throwable); } else { location.complete(kvStateLocation); } }); return location; } else { return FutureUtils.completedExceptionally( new UnknownLocationException( "Could not retrieve location of state=" + queryableStateName + " of job=" + jobId + ". Potential reasons are: i) the state is not ready, or ii) the job does not exist.")); } }
Example #2
Source File: KvStateClientProxyHandler.java From flink with Apache License 2.0 | 4 votes |
/** * Lookup the {@link KvStateLocation} for the given job and queryable state name. * * <p>The job manager will be queried for the location only if forced or no * cached location can be found. There are no guarantees about * * @param jobId JobID the state instance belongs to. * @param queryableStateName Name under which the state instance has been published. * @param forceUpdate Flag to indicate whether to force a update via the lookup service. * @return Future holding the KvStateLocation */ private CompletableFuture<KvStateLocation> getKvStateLookupInfo( final JobID jobId, final String queryableStateName, final boolean forceUpdate) { final Tuple2<JobID, String> cacheKey = new Tuple2<>(jobId, queryableStateName); final CompletableFuture<KvStateLocation> cachedFuture = lookupCache.get(cacheKey); if (!forceUpdate && cachedFuture != null && !cachedFuture.isCompletedExceptionally()) { LOG.debug("Retrieving location for state={} of job={} from the cache.", queryableStateName, jobId); return cachedFuture; } final KvStateLocationOracle kvStateLocationOracle = proxy.getKvStateLocationOracle(jobId); if (kvStateLocationOracle != null) { LOG.debug("Retrieving location for state={} of job={} from the key-value state location oracle.", queryableStateName, jobId); final CompletableFuture<KvStateLocation> location = new CompletableFuture<>(); lookupCache.put(cacheKey, location); kvStateLocationOracle .requestKvStateLocation(jobId, queryableStateName) .whenComplete( (KvStateLocation kvStateLocation, Throwable throwable) -> { if (throwable != null) { if (ExceptionUtils.stripCompletionException(throwable) instanceof FlinkJobNotFoundException) { // if the jobId was wrong, remove the entry from the cache. lookupCache.remove(cacheKey); } location.completeExceptionally(throwable); } else { location.complete(kvStateLocation); } }); return location; } else { return FutureUtils.completedExceptionally( new UnknownLocationException( "Could not retrieve location of state=" + queryableStateName + " of job=" + jobId + ". Potential reasons are: i) the state is not ready, or ii) the job does not exist.")); } }
Example #3
Source File: KvStateClientProxyHandler.java From flink with Apache License 2.0 | 4 votes |
/** * Lookup the {@link KvStateLocation} for the given job and queryable state name. * * <p>The job manager will be queried for the location only if forced or no * cached location can be found. There are no guarantees about * * @param jobId JobID the state instance belongs to. * @param queryableStateName Name under which the state instance has been published. * @param forceUpdate Flag to indicate whether to force a update via the lookup service. * @return Future holding the KvStateLocation */ private CompletableFuture<KvStateLocation> getKvStateLookupInfo( final JobID jobId, final String queryableStateName, final boolean forceUpdate) { final Tuple2<JobID, String> cacheKey = new Tuple2<>(jobId, queryableStateName); final CompletableFuture<KvStateLocation> cachedFuture = lookupCache.get(cacheKey); if (!forceUpdate && cachedFuture != null && !cachedFuture.isCompletedExceptionally()) { LOG.debug("Retrieving location for state={} of job={} from the cache.", queryableStateName, jobId); return cachedFuture; } final KvStateLocationOracle kvStateLocationOracle = proxy.getKvStateLocationOracle(jobId); if (kvStateLocationOracle != null) { LOG.debug("Retrieving location for state={} of job={} from the key-value state location oracle.", queryableStateName, jobId); final CompletableFuture<KvStateLocation> location = new CompletableFuture<>(); lookupCache.put(cacheKey, location); kvStateLocationOracle .requestKvStateLocation(jobId, queryableStateName) .whenComplete( (KvStateLocation kvStateLocation, Throwable throwable) -> { if (throwable != null) { if (ExceptionUtils.stripCompletionException(throwable) instanceof FlinkJobNotFoundException) { // if the jobId was wrong, remove the entry from the cache. lookupCache.remove(cacheKey); } location.completeExceptionally(throwable); } else { location.complete(kvStateLocation); } }); return location; } else { return FutureUtils.completedExceptionally( new UnknownLocationException( "Could not retrieve location of state=" + queryableStateName + " of job=" + jobId + ". Potential reasons are: i) the state is not ready, or ii) the job does not exist.")); } }