Skip to content

Commit 62d1b8d

Browse files
committed
uses newInputStreamStatisitics()
1 parent 66fb591 commit 62d1b8d

File tree

5 files changed

+11
-14
lines changed

5 files changed

+11
-14
lines changed

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/common/EmptyPrefetchingStatistics.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727

2828
public final class EmptyPrefetchingStatistics implements PrefetchingStatistics {
2929

30-
private static final EmptyPrefetchingStatistics emptyPrefetchingStatistics =
30+
private static final EmptyPrefetchingStatistics EMPTY_PREFETCHING_STATISTICS =
3131
new EmptyPrefetchingStatistics();
3232

3333
private EmptyPrefetchingStatistics() {
3434
}
3535

3636
public static EmptyPrefetchingStatistics getInstance() {
37-
return emptyPrefetchingStatistics;
37+
return EMPTY_PREFETCHING_STATISTICS;
3838
}
3939

4040
@Override

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/common/TestBlockCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void testArgChecks() throws Exception {
5959
@Test
6060
public void testPutAndGet() throws Exception {
6161
BlockCache cache =
62-
new SingleFilePerBlockCache(EmptyS3AStatisticsContext.EMPTY_INPUT_STREAM_STATISTICS);
62+
new SingleFilePerBlockCache(new EmptyS3AStatisticsContext().newInputStreamStatistics());
6363

6464
ByteBuffer buffer1 = ByteBuffer.allocate(BUFFER_SIZE);
6565
for (byte i = 0; i < BUFFER_SIZE; i++) {

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/common/TestBufferPool.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@ public class TestBufferPool extends AbstractHadoopTestBase {
3434

3535
private static final int POOL_SIZE = 2;
3636
private static final int BUFFER_SIZE = 10;
37-
37+
private final S3AInputStreamStatistics s3AInputStreamStatistics =
38+
new EmptyS3AStatisticsContext().newInputStreamStatistics();
3839

3940
@Test
4041
public void testArgChecks() throws Exception {
41-
S3AInputStreamStatistics s3AInputStreamStatistics =
42-
new EmptyS3AStatisticsContext().newInputStreamStatistics();
43-
4442
// Should not throw.
4543
BufferPool pool = new BufferPool(POOL_SIZE, BUFFER_SIZE, s3AInputStreamStatistics);
4644

@@ -87,8 +85,7 @@ public void testArgChecks() throws Exception {
8785

8886
@Test
8987
public void testGetAndRelease() {
90-
BufferPool pool = new BufferPool(POOL_SIZE, BUFFER_SIZE,
91-
EmptyS3AStatisticsContext.EMPTY_INPUT_STREAM_STATISTICS);
88+
BufferPool pool = new BufferPool(POOL_SIZE, BUFFER_SIZE, s3AInputStreamStatistics);
9289
assertInitialState(pool, POOL_SIZE);
9390

9491
int count = 0;
@@ -135,8 +132,7 @@ public void testRelease() throws Exception {
135132
private void testReleaseHelper(BufferData.State stateBeforeRelease, boolean expectThrow)
136133
throws Exception {
137134

138-
BufferPool pool = new BufferPool(POOL_SIZE, BUFFER_SIZE,
139-
EmptyS3AStatisticsContext.EMPTY_INPUT_STREAM_STATISTICS);
135+
BufferPool pool = new BufferPool(POOL_SIZE, BUFFER_SIZE, s3AInputStreamStatistics);
140136
assertInitialState(pool, POOL_SIZE);
141137

142138
BufferData data = this.acquire(pool, 1);

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/read/Fakes.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.apache.hadoop.fs.FileSystem;
4040
import org.apache.hadoop.fs.common.BlockCache;
4141
import org.apache.hadoop.fs.common.BlockData;
42+
import org.apache.hadoop.fs.common.EmptyPrefetchingStatistics;
4243
import org.apache.hadoop.fs.common.ExecutorServiceFuturePool;
4344
import org.apache.hadoop.fs.common.SingleFilePerBlockCache;
4445
import org.apache.hadoop.fs.common.Validate;
@@ -284,7 +285,7 @@ public static class TestS3FilePerBlockCache extends SingleFilePerBlockCache {
284285
private final int writeDelay;
285286

286287
public TestS3FilePerBlockCache(int readDelay, int writeDelay) {
287-
super(EmptyS3AStatisticsContext.EMPTY_INPUT_STREAM_STATISTICS);
288+
super(new EmptyS3AStatisticsContext().newInputStreamStatistics());
288289
this.files = new ConcurrentHashMap<>();
289290
this.readDelay = readDelay;
290291
this.writeDelay = writeDelay;
@@ -339,7 +340,7 @@ public TestS3CachingBlockManager(
339340
BlockData blockData,
340341
int bufferPoolSize) {
341342
super(futurePool, reader, blockData, bufferPoolSize,
342-
EmptyS3AStatisticsContext.EMPTY_INPUT_STREAM_STATISTICS);
343+
new EmptyS3AStatisticsContext().newInputStreamStatistics());
343344
}
344345

345346
@Override

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/read/TestS3CachingBlockManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class TestS3CachingBlockManager extends AbstractHadoopTestBase {
4444
private final ExecutorService threadPool = Executors.newFixedThreadPool(4);
4545
private final ExecutorServiceFuturePool futurePool = new ExecutorServiceFuturePool(threadPool);
4646
private final S3AInputStreamStatistics streamStatistics =
47-
EmptyS3AStatisticsContext.EMPTY_INPUT_STREAM_STATISTICS;
47+
new EmptyS3AStatisticsContext().newInputStreamStatistics();
4848

4949
private final BlockData blockData = new BlockData(FILE_SIZE, BLOCK_SIZE);
5050

0 commit comments

Comments
 (0)