io.undertow.server.XnioByteBufferPool Java Examples
The following examples show how to use
io.undertow.server.XnioByteBufferPool.
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: TokenAuthenticator.java From hawkular-metrics with Apache License 2.0 | 5 votes |
private ByteBufferPool createByteBufferPool() { long maxMemory = Runtime.getRuntime().maxMemory(); boolean useDirectBuffers; int bufferSize, buffersPerRegion; if (maxMemory < 64 * 1024 * 1024) { //smaller than 64mb of ram we use 512b buffers useDirectBuffers = false; bufferSize = 512; buffersPerRegion = 10; } else if (maxMemory < 128 * 1024 * 1024) { //use 1k buffers useDirectBuffers = true; bufferSize = 1024; buffersPerRegion = 10; } else { //use 16k buffers for best performance //as 16k is generally the max amount of data that can be sent in a single write() call useDirectBuffers = true; bufferSize = 1024 * 16; buffersPerRegion = 20; } BufferAllocator<ByteBuffer> allocator; if (useDirectBuffers) { allocator = BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR; } else { allocator = BufferAllocator.BYTE_BUFFER_ALLOCATOR; } int maxRegionSize = buffersPerRegion * bufferSize; ByteBufferSlicePool pool = new ByteBufferSlicePool(allocator, bufferSize, maxRegionSize); return new XnioByteBufferPool(pool); }
Example #2
Source File: AjpOpenListener.java From lams with GNU General Public License v2.0 | 4 votes |
public AjpOpenListener(final Pool<ByteBuffer> pool, final OptionMap undertowOptions) { this(new XnioByteBufferPool(pool), undertowOptions); }
Example #3
Source File: Http2OpenListener.java From lams with GNU General Public License v2.0 | 4 votes |
@Deprecated public Http2OpenListener(final Pool<ByteBuffer> pool, final OptionMap undertowOptions, String protocol) { this(new XnioByteBufferPool(pool), undertowOptions, protocol); }
Example #4
Source File: HttpOpenListener.java From lams with GNU General Public License v2.0 | 4 votes |
@Deprecated public HttpOpenListener(final Pool<ByteBuffer> pool, final OptionMap undertowOptions) { this(new XnioByteBufferPool(pool), undertowOptions); }
Example #5
Source File: AlpnOpenListener.java From lams with GNU General Public License v2.0 | 4 votes |
public AlpnOpenListener(Pool<ByteBuffer> bufferPool, OptionMap undertowOptions, String fallbackProtocol, DelegateOpenListener fallbackListener) { this(new XnioByteBufferPool(bufferPool), undertowOptions, fallbackProtocol, fallbackListener); }
Example #6
Source File: StringReadChannelListener.java From lams with GNU General Public License v2.0 | 4 votes |
@Deprecated public StringReadChannelListener(final Pool<ByteBuffer> bufferPool) { this.bufferPool = new XnioByteBufferPool(bufferPool); }
Example #7
Source File: BufferPoolResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override public void start(final StartContext startContext) { poolConsumer.accept(byteBufferPool = new XnioByteBufferPool(poolSupplier.get())); }