cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [2/3] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0
Date Wed, 12 Aug 2015 22:49:25 GMT
Merge branch 'cassandra-2.2' into cassandra-3.0


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0ff2a5b7
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0ff2a5b7
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0ff2a5b7

Branch: refs/heads/trunk
Commit: 0ff2a5b712363dae742807005f11bb03201b4237
Parents: e51f83b 85d550f
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Thu Aug 13 01:50:17 2015 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Thu Aug 13 01:50:17 2015 +0300

----------------------------------------------------------------------
 .../io/util/ChecksummedRandomAccessReader.java         | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/0ff2a5b7/src/java/org/apache/cassandra/io/util/ChecksummedRandomAccessReader.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/util/ChecksummedRandomAccessReader.java
index 3fc247b,442236d..98869a1
--- a/src/java/org/apache/cassandra/io/util/ChecksummedRandomAccessReader.java
+++ b/src/java/org/apache/cassandra/io/util/ChecksummedRandomAccessReader.java
@@@ -41,23 -41,26 +41,24 @@@ public class ChecksummedRandomAccessRea
      private final DataIntegrityMetadata.ChecksumValidator validator;
      private final File file;
  
-     protected ChecksummedRandomAccessReader(File file, ChannelProxy channel, DataIntegrityMetadata.ChecksumValidator
validator) throws IOException
+     protected ChecksummedRandomAccessReader(File file, ChannelProxy channel, DataIntegrityMetadata.ChecksumValidator
validator)
      {
 -        super(channel, validator.chunkSize, -1, BufferType.ON_HEAP, null);
 +        super(channel, validator.chunkSize, -1, BufferType.ON_HEAP);
          this.validator = validator;
          this.file = file;
      }
  
++    @SuppressWarnings("resource")
      public static ChecksummedRandomAccessReader open(File file, File crcFile) throws IOException
      {
 -        try (ChannelProxy channel = new ChannelProxy(file))
 -        {
 -            RandomAccessReader crcReader = RandomAccessReader.open(crcFile);
 -            @SuppressWarnings("resource")
 -            DataIntegrityMetadata.ChecksumValidator validator =
 -                new DataIntegrityMetadata.ChecksumValidator(new Adler32(), crcReader, file.getPath());
 -            return new ChecksummedRandomAccessReader(file, channel, validator);
 -        }
 +        ChannelProxy channel = new ChannelProxy(file);
 +        RandomAccessReader crcReader = RandomAccessReader.open(crcFile);
-         DataIntegrityMetadata.ChecksumValidator validator = new DataIntegrityMetadata.ChecksumValidator(new
CRC32(),
-                                                                                        
                crcReader,
-                                                                                        
                file.getPath());
++        DataIntegrityMetadata.ChecksumValidator validator =
++            new DataIntegrityMetadata.ChecksumValidator(new CRC32(), crcReader, file.getPath());
 +        return new ChecksummedRandomAccessReader(file, channel, validator);
      }
  
+     @Override
      protected void reBuffer()
      {
          long desiredPosition = current();
@@@ -95,16 -99,10 +97,17 @@@
          super.seek(newPosition);
      }
  
+     @Override
      public void close()
      {
 -        super.close();
 -        validator.close();
 +        try
 +        {
 +            super.close();
 +        }
 +        finally
 +        {
 +            channel.close();
 +            validator.close();
 +        }
      }
  }


Mime
View raw message