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

    https://github.com/apache/flink/pull/1153#discussion_r41126510
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/ZooKeeperSubmittedJobGraphs.java
 ---
    @@ -0,0 +1,356 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.runtime.jobmanager;
    +
    +import org.apache.curator.framework.CuratorFramework;
    +import org.apache.curator.framework.recipes.cache.PathChildrenCache;
    +import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;
    +import 
org.apache.curator.framework.recipes.cache.PathChildrenCacheListener;
    +import org.apache.curator.utils.ZKPaths;
    +import org.apache.flink.api.common.JobID;
    +import org.apache.flink.runtime.state.StateHandle;
    +import org.apache.flink.runtime.state.StateHandleProvider;
    +import org.apache.flink.runtime.zookeeper.ZooKeeperStateHandle;
    +import org.apache.flink.runtime.zookeeper.ZooKeeperStateHandleStore;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.ConcurrentModificationException;
    +import java.util.HashSet;
    +import java.util.List;
    +import java.util.Set;
    +
    +import static com.google.common.base.Preconditions.checkNotNull;
    +import static com.google.common.base.Preconditions.checkState;
    +
    +/**
    + * {@link SubmittedJobGraph} instances for JobManagers running in {@link 
RecoveryMode#ZOOKEEPER}.
    + *
    + * <p>Each job graph creates ZNode:
    + * <pre>
    + * +----O /flink/jobgraphs/&lt;job-id&gt; 1 [persistent]
    + * .
    + * .
    + * .
    + * +----O /flink/jobgraphs/&lt;job-id&gt; N [persistent]
    + * </pre>
    + *
    + * <p>The root path is watched to detect concurrent modifications in 
corner situations where
    + * multiple instances operate concurrently. The job manager acts as a 
{@link SubmittedJobGraphListener}
    + * to react to such situations.
    + */
    +public class ZooKeeperSubmittedJobGraphs implements SubmittedJobGraphs {
    +
    +   private static final Logger LOG = 
LoggerFactory.getLogger(ZooKeeperSubmittedJobGraphs.class);
    +
    +   /** Lock to synchronize with the {@link SubmittedJobGraphListener}. */
    +   private final Object cacheLock = new Object();
    +
    +   /** Client (not a namespace facade) */
    +   private final CuratorFramework client;
    +
    +   /** The set of IDs of all added job graphs. */
    +   private final Set<JobID> addedJobGraphs = new HashSet<>();
    +
    +   /** Completed checkpoints in ZooKeeper */
    +   private final ZooKeeperStateHandleStore<SubmittedJobGraph> 
jobGraphsInZooKeeper;
    +
    +   /**
    +    * Cache to monitor all children. This is used to detect races with 
other instances working
    +    * on the same state.
    +    */
    +   private final PathChildrenCache pathCache;
    +
    +   /** The external listener to be notified on races. */
    +   private SubmittedJobGraphListener jobGraphListener;
    +
    +   /** Flag indicating whether this instance is running. */
    +   private boolean isRunning;
    +
    +   public ZooKeeperSubmittedJobGraphs(
    +                   CuratorFramework client,
    +                   String currentJobsPath,
    +                   StateHandleProvider<SubmittedJobGraph> 
stateHandleProvider) throws Exception {
    +
    +           checkNotNull(client, "Curator client");
    --- End diff --
    
    `this.client = checkNotNull(....)`.


---
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