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

    https://github.com/apache/flink/pull/4764#discussion_r143685852
  
    --- Diff: flink-core/src/main/java/org/apache/flink/util/ResourceGuard.java 
---
    @@ -0,0 +1,152 @@
    +/*
    + * 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.util;
    +
    +import java.io.IOException;
    +import java.io.Serializable;
    +import java.util.concurrent.atomic.AtomicBoolean;
    +
    +/**
    + * This class is a guard for shared resources with the following 
invariants. The resource can be acquired by multiple
    + * clients in parallel through the {@link #acquireResource()} call. As a 
result of the call, each client gets a
    + * {@link Lease}. The {@link #close()} method of the lease releases the 
resources and reduces the client count in
    + * the {@link ResourceGuard} object.
    + * The protected resource should only be disposed once the corresponding 
resource guard is successfully closed, but
    + * the guard can only be closed once all clients that acquired a lease for 
the guarded resource have released it.
    + * Before this is happened, the call to {@link #close()} will block until 
the zero-open-leases condition is triggered.
    --- End diff --
    
    nit "Before this has happened"


---

Reply via email to