[GitHub] flink pull request #2992: [FLINK-5325] Splitting user/system-facing API of C...
Github user StefanRRichter closed the pull request at: https://github.com/apache/flink/pull/2992 --- 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. ---
[GitHub] flink pull request #2992: [FLINK-5325] Splitting user/system-facing API of C...
Github user aljoscha commented on a diff in the pull request: https://github.com/apache/flink/pull/2992#discussion_r99317280 --- Diff: flink-core/src/main/java/org/apache/flink/util/AbstractConcurrentClosingRegistry.java --- @@ -18,37 +18,42 @@ package org.apache.flink.util; +import javax.annotation.concurrent.GuardedBy; import java.io.Closeable; import java.io.IOException; +import java.util.HashMap; import java.util.Map; /** - * This is the abstract base class for registries that allow to register instances of {@link Closeable}, which are all - * closed if this registry is closed. + * This is the abstract base class for registries that allow to register instances of {@link Closeable}, which are + * all closed if this registry is closed. * * Registering to an already closed registry will throw an exception and close the provided {@link Closeable} * * All methods in this class are thread-safe. * - * @param Type of the closeable this registers + * @param Type of the {@link Closeable} this registers * @param Type for potential meta data associated with the registering closeables */ -public abstract class AbstractCloseableRegistry implements Closeable { +public abstract class AbstractConcurrentClosingRegistry implements Closeable { --- End diff -- Why is this not `AbstractConcurrentClosableRegistry`? --- 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. ---
[GitHub] flink pull request #2992: [FLINK-5325] Splitting user/system-facing API of C...
Github user StefanRRichter commented on a diff in the pull request: https://github.com/apache/flink/pull/2992#discussion_r98654756 --- Diff: flink-core/src/main/java/org/apache/flink/core/fs/SafetyNetCloseableRegistry.java --- @@ -41,7 +41,7 @@ * Phantom references are used to track when {@link org.apache.flink.util.WrappingProxy}s of {@link Closeable} got * GC'ed. We ensure that the wrapped {@link Closeable} is properly closed to avoid resource leaks. * - * Other than that, it works like a normal {@link CloseableRegistry}. + * Other than that, it works like a normal {@link CloseableRegistryImpl}. --- End diff -- Yes. --- 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. ---
[GitHub] flink pull request #2992: [FLINK-5325] Splitting user/system-facing API of C...
Github user aljoscha commented on a diff in the pull request: https://github.com/apache/flink/pull/2992#discussion_r98638456 --- Diff: flink-core/src/main/java/org/apache/flink/core/fs/SafetyNetCloseableRegistry.java --- @@ -41,7 +41,7 @@ * Phantom references are used to track when {@link org.apache.flink.util.WrappingProxy}s of {@link Closeable} got * GC'ed. We ensure that the wrapped {@link Closeable} is properly closed to avoid resource leaks. * - * Other than that, it works like a normal {@link CloseableRegistry}. + * Other than that, it works like a normal {@link CloseableRegistryImpl}. --- End diff -- Should this be `ClosableRegistry`? --- 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. ---
[GitHub] flink pull request #2992: [FLINK-5325] Splitting user/system-facing API of C...
Github user StefanRRichter commented on a diff in the pull request: https://github.com/apache/flink/pull/2992#discussion_r92199074 --- Diff: flink-core/src/main/java/org/apache/flink/core/fs/CloseableRegistryImpl.java --- @@ -0,0 +1,52 @@ +/* + * 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.core.fs; + +import org.apache.flink.util.AbstractCloseableRegistry; + +import java.io.Closeable; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * This class allows to register instances of {@link Closeable}, which are all closed if this registry is closed. + * + * Registering to an already closed registry will throw an exception and close the provided {@link Closeable} + * + * All methods in this class are thread-safe. + */ +public class CloseableRegistryImpl extends AbstractCloseableRegistryimplements CloseableRegistry { --- End diff -- I also totally agree that it should implement ``CloseableRegistry ``. However, this it can not trivially implement the interface without making ``CloseableRegistry `` generic in . This in turn would lead to some nasty naming like ``CloseableRegistry``. Maybe it is just a naming problem after all, just yet lacking the right idea on those names :-) --- 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. ---
[GitHub] flink pull request #2992: [FLINK-5325] Splitting user/system-facing API of C...
GitHub user StefanRRichter opened a pull request: https://github.com/apache/flink/pull/2992 [FLINK-5325] Splitting user/system-facing API of CloseableRegistry Currently, the API of ``CloseableRegistry`` exposes the ``close`` method to all client code. This PR splits the API into a user-facing interface (allowing only for un/registration of ``Closeable`` and a system-facing part that also exposes the ``close method``. This prevents users from accidentally calling close, thus closing resources that other callers registered. You can merge this pull request into a Git repository by running: $ git pull https://github.com/StefanRRichter/flink closeable-registry-interface Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/2992.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2992 commit fce3c97a575f4296d55bea2d833a4b55c0913ee4 Author: Stefan RichterDate: 2016-12-12T12:53:24Z [FLINK-5325] Splitting user/system-facing API of CloseableRegistry --- 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. ---