Skip to content

Commit 17c69d7

Browse files
committed
Merge branch '2.1' into 3.1
2 parents d3c5464 + b5948f9 commit 17c69d7

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

core/src/main/java/org/apache/accumulo/core/file/blockfile/impl/CachableBlockFile.java

+10-11
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949

5050
import com.github.benmanes.caffeine.cache.Cache;
5151

52+
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
53+
5254
/**
5355
* This is a wrapper class for BCFile that includes a cache for independent caches for datablocks
5456
* and metadatablocks
@@ -342,6 +344,8 @@ public Map<String,Loader> getDependencies() {
342344
return Collections.emptyMap();
343345
}
344346

347+
@SuppressFBWarnings(value = {"NP_LOAD_OF_KNOWN_NULL_VALUE"},
348+
justification = "Spotbugs false positive, see spotbugs issue 2836.")
345349
@Override
346350
public byte[] load(int maxSize, Map<String,byte[]> dependencies) {
347351

@@ -356,23 +360,18 @@ public byte[] load(int maxSize, Map<String,byte[]> dependencies) {
356360
}
357361
}
358362

359-
BlockReader _currBlock = getBlockReader(maxSize, reader);
360-
if (_currBlock == null) {
361-
return null;
362-
}
363+
try (BlockReader _currBlock = getBlockReader(maxSize, reader)) {
364+
if (_currBlock == null) {
365+
return null;
366+
}
363367

364-
byte[] b = null;
365-
try {
366-
b = new byte[(int) _currBlock.getRawSize()];
368+
byte[] b = new byte[(int) _currBlock.getRawSize()];
367369
_currBlock.readFully(b);
370+
return b;
368371
} catch (IOException e) {
369372
log.debug("Error full blockRead for file " + cacheId + " for block " + getBlockId(), e);
370373
throw new UncheckedIOException(e);
371-
} finally {
372-
_currBlock.close();
373374
}
374-
375-
return b;
376375
} catch (IOException e) {
377376
throw new UncheckedIOException(e);
378377
}

server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/CompactionExecutorsMetrics.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class CompactionExecutorsMetrics implements MetricsProducer {
5050
private volatile List<CeMetrics> ceMetricsList = List.of();
5151
private final Map<CompactionExecutorId,CeMetrics> ceMetricsMap = new HashMap<>();
5252
private final Map<CompactionExecutorId,ExMetrics> exCeMetricsMap = new HashMap<>();
53-
private MeterRegistry registry = null;
53+
private volatile MeterRegistry registry = null;
5454

5555
// public so it can be closed by outside callers
5656
public class CeMetrics implements AutoCloseable {

0 commit comments

Comments
 (0)