Add ByteBuf leak detection @Rule

This commit introduces a JUnit rule that detects ByteBuf leaks in
subclasses of AbstractDataBufferAllocatingTestCase.
This commit is contained in:
Arjen Poutsma
2017-06-30 10:33:29 +02:00
parent b33d8c6ade
commit 621df7c978
5 changed files with 56 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,6 +49,12 @@ public class NettyDataBufferFactory implements DataBufferFactory {
this.byteBufAllocator = byteBufAllocator;
}
/**
* Return the {@code ByteBufAllocator} used by this factory.
*/
public ByteBufAllocator getByteBufAllocator() {
return this.byteBufAllocator;
}
@Override
public NettyDataBuffer allocateBuffer() {