[ 
https://issues.apache.org/jira/browse/FLINK-5508?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15833951#comment-15833951
 ] 

ASF GitHub Bot commented on FLINK-5508:
---------------------------------------

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

    https://github.com/apache/flink/pull/3157#discussion_r97257878
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperUtilityFactory.java
 ---
    @@ -0,0 +1,120 @@
    +/*
    + * 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.zookeeper;
    +
    +import org.apache.curator.framework.CuratorFramework;
    +import org.apache.curator.framework.recipes.shared.SharedCount;
    +import org.apache.curator.framework.recipes.shared.SharedValue;
    +import org.apache.flink.configuration.Configuration;
    +import org.apache.flink.runtime.util.ZooKeeperUtils;
    +
    +import java.io.Serializable;
    +import java.util.concurrent.Executor;
    +
    +/**
    + * Creates ZooKeeper utility classes without exposing the {@link 
CuratorFramework} dependency. The
    + * curator framework is cached in this instance and shared among all 
created ZooKeeper utility
    + * instances. This requires that the utility classes DO NOT close the 
provided curator framework.
    + *
    + * <p>The curator framework is closed by calling the {@link 
#close(boolean)} method.
    + */
    +public class ZooKeeperUtilityFactory {
    +
    +   private final CuratorFramework root;
    +
    +   // Facade bound to the provided path
    +   private final CuratorFramework facade;
    +
    +   public ZooKeeperUtilityFactory(Configuration configuration, String 
path) throws Exception {
    +           root = ZooKeeperUtils.startCuratorFramework(configuration);
    +
    +           
root.newNamespaceAwareEnsurePath(path).ensure(root.getZookeeperClient());
    +           facade = 
root.usingNamespace(ZooKeeperUtils.generateZookeeperPath(root.getNamespace(), 
path));
    +   }
    +
    +   /**
    +    * Closes the ZooKeeperUtilityFactory. This entails closing the cached 
{@link CuratorFramework}
    +    * instance. If cleanup is true, then the initial path and all its 
children are deleted.
    +    *
    +    * @param cleanup deletes the initial path and all of its children to 
clean up
    +    * @throws Exception when deleting the znodes
    +    */
    +   public void close(boolean cleanup) throws Exception {
    +           if (cleanup) {
    +                   facade.delete().deletingChildrenIfNeeded().forPath("/");
    +           }
    +
    +           root.close();
    +   }
    +
    +   /**
    +    * Creates a {@link ZooKeeperStateHandleStore} instance with the 
provided arguments.
    +    *
    +    * @param zkStateHandleStorePath specifying the path in ZooKeeper to 
store the state handles to
    +    * @param stateStorageHelper storing the actual state data
    +    * @param executor to run asynchronous callbacks of the state handle 
store
    +    * @param <T> Type of the state to be stored
    +    * @return a ZooKeeperStateHandleStore instance
    +    * @throws Exception if ZooKeeper could not create the provided state 
handle store path in
    +    *     ZooKeeper
    --- End diff --
    
    nit: Does this line in the Javadoc need to be split into 2 lines? I don't 
think it's exceeding the max character limit, is it?


> Remove Mesos dynamic class loading
> ----------------------------------
>
>                 Key: FLINK-5508
>                 URL: https://issues.apache.org/jira/browse/FLINK-5508
>             Project: Flink
>          Issue Type: Improvement
>          Components: Mesos
>    Affects Versions: 1.2.0, 1.3.0
>            Reporter: Till Rohrmann
>            Assignee: Till Rohrmann
>            Priority: Minor
>             Fix For: 1.2.0, 1.3.0
>
>
> Mesos uses dynamic class loading in order to load the 
> {{ZooKeeperStateHandleStore}} and the {{CuratorFramework}} class. This can be 
> replaced by a compile time dependency.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to