Class ThreadLocalStreamBufferPool
java.lang.Object
net.officefloor.server.stream.impl.AbstractStreamBufferPool<ByteBuffer>
net.officefloor.server.stream.impl.ThreadLocalStreamBufferPool
- All Implemented Interfaces:
AutoCloseable,ThreadCompletionListener,ThreadCompletionListenerFactory,StreamBufferPool<ByteBuffer>
public class ThreadLocalStreamBufferPool
extends AbstractStreamBufferPool<ByteBuffer>
implements ThreadCompletionListenerFactory, ThreadCompletionListener
- Author:
- Daniel Sagenschneider
-
Nested Class Summary
Nested classes/interfaces inherited from class net.officefloor.server.stream.impl.AbstractStreamBufferPool
AbstractStreamBufferPool.FileStreamBuffer, AbstractStreamBufferPool.UnpooledStreamBuffer -
Constructor Summary
ConstructorsConstructorDescriptionThreadLocalStreamBufferPool(ByteBufferFactory byteBufferFactory, int maxThreadLocalPoolSize, int maxCorePoolSize) Instantiate with details of pool sizes. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclose()Closes pool releasing allStreamBufferinstances.============= ThreadCompletionListenerFactory ======================== StreamBufferPool ===========================intObtains the number ofStreamBufferinstances in circulation.void================= ThreadCompletionListener ============Methods inherited from class net.officefloor.server.stream.impl.AbstractStreamBufferPool
getFileStreamBuffer, getUnpooledStreamBuffer
-
Constructor Details
-
ThreadLocalStreamBufferPool
public ThreadLocalStreamBufferPool(ByteBufferFactory byteBufferFactory, int maxThreadLocalPoolSize, int maxCorePoolSize) Instantiate with details of pool sizes.
The total potential amount of memory used is:
pooledByteBufferSize* (active buffers+ (threadLocalPoolSize*active threads) +corePoolSize).- Parameters:
byteBufferFactory-ByteBufferFactory.maxThreadLocalPoolSize- MaximumThreadLocalpool size.maxCorePoolSize- Maximum core pool size.
-
-
Method Details
-
activeThreadLocalPooling
public void activeThreadLocalPooling() -
getStreamBufferCount
public int getStreamBufferCount()Obtains the number ofStreamBufferinstances in circulation.- Returns:
- Number of
StreamBufferinstances in circulation.
-
getPooledStreamBuffer
=============== StreamBufferPool ===========================- Specified by:
getPooledStreamBufferin interfaceStreamBufferPool<ByteBuffer>- Returns:
StreamBuffer.
-
close
public void close()Description copied from interface:StreamBufferPoolCloses pool releasing allStreamBufferinstances.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceStreamBufferPool<ByteBuffer>
-
createThreadCompletionListener
============= ThreadCompletionListenerFactory =========- Specified by:
createThreadCompletionListenerin interfaceThreadCompletionListenerFactory- Parameters:
pool-ManagedObjectPool.- Returns:
ThreadCompletionListenerfor theManagedObjectPool.
-
threadComplete
public void threadComplete()================= ThreadCompletionListener ============- Specified by:
threadCompletein interfaceThreadCompletionListener
-