Github user wenlong88 commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3709#discussion_r111308326
  
    --- Diff: 
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/ExecutionGraphHolder.java
 ---
    @@ -48,7 +52,41 @@
     
        private final FiniteDuration timeout;
     
    -   private final WeakHashMap<JobID, AccessExecutionGraph> cache = new 
WeakHashMap<>();
    +   private AtomicReference<ActorGateway> jobManagerRef = new 
AtomicReference<>(null);
    +
    +   private final LoadingCache<JobID, AccessExecutionGraph> cache =
    +           CacheBuilder.newBuilder()
    +                   .maximumSize(1000)
    +                   .expireAfterWrite(30, TimeUnit.SECONDS)
    +                   .build(new CacheLoader<JobID, AccessExecutionGraph>() {
    +                           @Override
    +                           public AccessExecutionGraph load(JobID jobID) 
throws Exception {
    +                                   try {
    +                                           if (jobManagerRef.get() != 
null) {
    +                                                   Future<Object> future = 
jobManagerRef.get().ask(new JobManagerMessages.RequestJob(jobID), timeout);
    +                                                   Object result = 
Await.result(future, timeout);
    +
    +                                                   if (result instanceof 
JobManagerMessages.JobNotFound) {
    +                                                           return null;
    --- End diff --
    
    CacheLoader do not support return null.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to