|
@@ -99,7 +99,7 @@ public class PageCacheRecycler {
|
|
|
final int maxPageCount = (int) Math.min(Integer.MAX_VALUE, limit / PAGE_SIZE_IN_BYTES);
|
|
|
|
|
|
final int maxBytePageCount = (int) (bytesWeight * maxPageCount / totalWeight);
|
|
|
- bytePage = build(type, maxBytePageCount, allocatedProcessors, new AbstractRecyclerC<byte[]>() {
|
|
|
+ bytePage = build(type, maxBytePageCount, allocatedProcessors, new AbstractRecyclerC<>() {
|
|
|
@Override
|
|
|
public byte[] newInstance() {
|
|
|
return new byte[BYTE_PAGE_SIZE];
|
|
@@ -109,10 +109,15 @@ public class PageCacheRecycler {
|
|
|
public void recycle(byte[] value) {
|
|
|
// nothing to do
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int pageSize() {
|
|
|
+ return BYTE_PAGE_SIZE;
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
final int maxObjectPageCount = (int) (objectsWeight * maxPageCount / totalWeight);
|
|
|
- objectPage = build(type, maxObjectPageCount, allocatedProcessors, new AbstractRecyclerC<Object[]>() {
|
|
|
+ objectPage = build(type, maxObjectPageCount, allocatedProcessors, new AbstractRecyclerC<>() {
|
|
|
@Override
|
|
|
public Object[] newInstance() {
|
|
|
return new Object[OBJECT_PAGE_SIZE];
|
|
@@ -122,6 +127,11 @@ public class PageCacheRecycler {
|
|
|
public void recycle(Object[] value) {
|
|
|
Arrays.fill(value, null); // we need to remove the strong refs on the objects stored in the array
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int pageSize() {
|
|
|
+ return OBJECT_PAGE_SIZE;
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
assert PAGE_SIZE_IN_BYTES * (maxBytePageCount + maxObjectPageCount) <= limit;
|