@Test(expected = IllegalArgumentException.class) public void testRequestMemorySegmentsWithInvalidArgument() { NetworkBufferPool globalPool = new NetworkBufferPool(10, 128, 0); globalPool.destroy(); fail("Should throw an IllegalArgumentException"); }
public void destroy() { synchronized (factoryLock) { isDestroyed = true; MemorySegment segment; while ((segment = availableMemorySegments.poll()) != null) { segment.free(); } } }
NetworkBufferPool implements BufferPoolFactory, MemorySegmentProvider { public void destroy() { synchronized (factoryLock) { isDestroyed = true; MemorySegment segment; while ((segment = availableMemorySegments.poll()) != null) { segment.free(); } } } }
NetworkBufferPool implements BufferPoolFactory, MemorySegmentProvider { public void destroy() { synchronized (factoryLock) { isDestroyed = true; MemorySegment segment; while ((segment = availableMemorySegments.poll()) != null) { segment.free(); } } } @VisibleForTesting  NetworkBufferPool(int numberOfSegmentsToAllocate, int segmentSize, int numberOfSegmentsToRequest);  NetworkBufferPool(
		int numberOfSegmentsToAllocate,
		int segmentSize,
		int numberOfSegmentsToRequest,
		Duration requestSegmentsTimeout); }
NetworkBufferPool implements BufferPoolFactory, MemorySegmentProvider { public void destroy() { synchronized (factoryLock) { isDestroyed = true; MemorySegment segment; while ((segment = availableMemorySegments.poll()) != null) { segment.free(); } } } @VisibleForTesting  NetworkBufferPool(int numberOfSegmentsToAllocate, int segmentSize, int numberOfSegmentsToRequest);  NetworkBufferPool(
		int numberOfSegmentsToAllocate,
		int segmentSize,
		int numberOfSegmentsToRequest,
		Duration requestSegmentsTimeout); @Nullable MemorySegment requestMemorySegment(); void recycle(MemorySegment segment); @Override List<MemorySegment> requestMemorySegments(); @Override void recycleMemorySegments(Collection<MemorySegment> segments); void destroy(); boolean isDestroyed(); int getTotalNumberOfMemorySegments(); int getNumberOfAvailableMemorySegments(); int getNumberOfRegisteredBufferPools(); int countBuffers(); @Override BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers); @Override BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers, Optional<BufferPoolOwner> owner); @Override void destroyBufferPool(BufferPool bufferPool); void destroyAllBufferPools(); }
NetworkBufferPool implements BufferPoolFactory, MemorySegmentProvider { public void destroy() { synchronized (factoryLock) { isDestroyed = true; MemorySegment segment; while ((segment = availableMemorySegments.poll()) != null) { segment.free(); } } } @VisibleForTesting  NetworkBufferPool(int numberOfSegmentsToAllocate, int segmentSize, int numberOfSegmentsToRequest);  NetworkBufferPool(
		int numberOfSegmentsToAllocate,
		int segmentSize,
		int numberOfSegmentsToRequest,
		Duration requestSegmentsTimeout); @Nullable MemorySegment requestMemorySegment(); void recycle(MemorySegment segment); @Override List<MemorySegment> requestMemorySegments(); @Override void recycleMemorySegments(Collection<MemorySegment> segments); void destroy(); boolean isDestroyed(); int getTotalNumberOfMemorySegments(); int getNumberOfAvailableMemorySegments(); int getNumberOfRegisteredBufferPools(); int countBuffers(); @Override BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers); @Override BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers, Optional<BufferPoolOwner> owner); @Override void destroyBufferPool(BufferPool bufferPool); void destroyAllBufferPools();  }