accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keith-turner <>
Subject [GitHub] accumulo pull request #134: ACCUMULO-4391 Source deepcopies cannot be used s...
Date Wed, 03 Aug 2016 15:32:15 GMT
Github user keith-turner commented on a diff in the pull request:
    --- Diff: core/src/main/java/org/apache/accumulo/core/file/rfile/bcfile/
    @@ -149,9 +149,13 @@ public boolean markSupported() {
       public void close() {
    -    // Invalidate the state of the stream.
    -    in = null;
    -    pos = end;
    -    mark = -1;
    +    final FSDataInputStream inLocal = in;
    +    if (inLocal != null) {
    +      // synchronize on the FSDataInputStream to ensure we block closing if in the read
    +      synchronized (inLocal) {
    +        // Invalidate the state of the stream.
    +        in = null;
    --- End diff --
    The code sets `in` to null to indicate close was called.  This make all the code that's
trying to sync on `in` go through a rigmarole.  I think it may simplify the code if a boolean
that tracks the closed state was introduced and `in` was never set to null.  Then the code
can always safely sync on `in` and check the closed boolean after syncing.  

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 or file a JIRA ticket
with INFRA.

View raw message