Java Code Examples for org.apache.http.nio.util.HeapByteBufferAllocator#INSTANCE
The following examples show how to use
org.apache.http.nio.util.HeapByteBufferAllocator#INSTANCE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleInputBufferPooledObjectOpsTest.java From log4j2-elasticsearch with Apache License 2.0 | 6 votes |
@Test public void createsItemSource() { // given SimpleInputBufferPooledObjectOps ops = new SimpleInputBufferPooledObjectOps( HeapByteBufferAllocator.INSTANCE, TEST_BUFFER_SIZE ); // when ItemSource result = ops.createItemSource(mock(ReleaseCallback.class)); // then assertNotNull(result); }
Example 2
Source File: SimpleInputBufferPooledObjectOpsTest.java From log4j2-elasticsearch with Apache License 2.0 | 6 votes |
@Test public void purgeDoesNotAffectItemSource() { // given SimpleInputBufferPooledObjectOps ops = new SimpleInputBufferPooledObjectOps( HeapByteBufferAllocator.INSTANCE, TEST_BUFFER_SIZE ); ItemSource result = spy(ops.createItemSource(mock(ReleaseCallback.class))); // when ops.purge(result); // then verifyNoMoreInteractions(result); }
Example 3
Source File: SimpleInputBufferPooledObjectOpsTest.java From log4j2-elasticsearch with Apache License 2.0 | 6 votes |
@Test public void resetDelegatesToUnderlyingItem() { // given SimpleInputBufferPooledObjectOps ops = new SimpleInputBufferPooledObjectOps( HeapByteBufferAllocator.INSTANCE, TEST_BUFFER_SIZE ); ItemSource<SimpleInputBuffer> result = spy(ops.createItemSource(source -> {})); SimpleInputBuffer simpleInputBuffer = mock(SimpleInputBuffer.class); when(result.getSource()).thenReturn(simpleInputBuffer); // when ops.reset(result); // then verify(simpleInputBuffer).reset(); }
Example 4
Source File: SimpleInputBufferPooledObjectOpsTest.java From log4j2-elasticsearch with Apache License 2.0 | 6 votes |
@Test public void metricsSupplierReturnsNull() { // given SimpleInputBufferPooledObjectOps ops = new SimpleInputBufferPooledObjectOps( HeapByteBufferAllocator.INSTANCE, TEST_BUFFER_SIZE ); Supplier<String> metricsSupplier = ops.createMetricsSupplier(); // when String result = metricsSupplier.get(); // then assertNull(result); }
Example 5
Source File: SimpleInputBufferObjectOpsTest.java From log4j2-elasticsearch with Apache License 2.0 | 6 votes |
public static GenericItemSourcePool<SimpleInputBuffer> createDefaultTestGenericItemSourcePool( int initialSize, boolean monitored, ResizePolicy resizePolicy ) { SimpleInputBufferPooledObjectOps pooledObjectOps = new SimpleInputBufferPooledObjectOps( HeapByteBufferAllocator.INSTANCE, DEFAULT_TEST_ITEM_SIZE_IN_BYTES); return new GenericItemSourcePool<>( DEFAULT_TEST_ITEM_POOL_NAME, pooledObjectOps, resizePolicy, DEFAULT_TEST_RESIZE_TIMEOUT, monitored, DEFAULT_TEST_MONITOR_TASK_INTERVAL, initialSize ); }
Example 6
Source File: HttpClientFactory.java From log4j2-elasticsearch with Apache License 2.0 | 5 votes |
private GenericItemSourcePool<SimpleInputBuffer> createPool() { GenericItemSourcePool<SimpleInputBuffer> bufferPool = new GenericItemSourcePool<>( "hc-responseBufferPool", new SimpleInputBufferPooledObjectOps( HeapByteBufferAllocator.INSTANCE, pooledResponseBuffersSizeInBytes ), new UnlimitedResizePolicy.Builder().withResizeFactor(0.5).build(), 1000L, false, 30000, maxTotalConnections ); return bufferPool; }
Example 7
Source File: SimpleInputBufferObjectOpsTest.java From log4j2-elasticsearch with Apache License 2.0 | 4 votes |
public static SimpleInputBufferPooledObjectOps createDefaultTestObject() { return new SimpleInputBufferPooledObjectOps(HeapByteBufferAllocator.INSTANCE, DEFAULT_TEST_ITEM_SIZE_IN_BYTES); }