Class ThreadLocalStreamBufferPool
- java.lang.Object
-
- net.officefloor.server.stream.impl.AbstractStreamBufferPool<java.nio.ByteBuffer>
-
- net.officefloor.server.stream.impl.ThreadLocalStreamBufferPool
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,ThreadCompletionListener
,ThreadCompletionListenerFactory
,StreamBufferPool<java.nio.ByteBuffer>
public class ThreadLocalStreamBufferPool extends AbstractStreamBufferPool<java.nio.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
Constructors Constructor Description ThreadLocalStreamBufferPool(ByteBufferFactory byteBufferFactory, int maxThreadLocalPoolSize, int maxCorePoolSize)
Instantiate with details of pool sizes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activeThreadLocalPooling()
void
close()
Closes pool releasing allStreamBuffer
instances.ThreadCompletionListener
createThreadCompletionListener(ManagedObjectPool pool)
============= ThreadCompletionListenerFactory =========StreamBuffer<java.nio.ByteBuffer>
getPooledStreamBuffer()
=============== StreamBufferPool ===========================int
getStreamBufferCount()
Obtains the number ofStreamBuffer
instances in circulation.void
threadComplete()
================= ThreadCompletionListener ============-
Methods inherited from class net.officefloor.server.stream.impl.AbstractStreamBufferPool
getFileStreamBuffer, getUnpooledStreamBuffer
-
-
-
-
Constructor Detail
-
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
- MaximumThreadLocal
pool size.maxCorePoolSize
- Maximum core pool size.
-
-
Method Detail
-
activeThreadLocalPooling
public void activeThreadLocalPooling()
-
getStreamBufferCount
public int getStreamBufferCount()
Obtains the number ofStreamBuffer
instances in circulation.- Returns:
- Number of
StreamBuffer
instances in circulation.
-
getPooledStreamBuffer
public StreamBuffer<java.nio.ByteBuffer> getPooledStreamBuffer()
=============== StreamBufferPool ===========================- Specified by:
getPooledStreamBuffer
in interfaceStreamBufferPool<java.nio.ByteBuffer>
- Returns:
StreamBuffer
.
-
close
public void close()
Description copied from interface:StreamBufferPool
Closes pool releasing allStreamBuffer
instances.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceStreamBufferPool<java.nio.ByteBuffer>
-
createThreadCompletionListener
public ThreadCompletionListener createThreadCompletionListener(ManagedObjectPool pool)
============= ThreadCompletionListenerFactory =========- Specified by:
createThreadCompletionListener
in interfaceThreadCompletionListenerFactory
- Parameters:
pool
-ManagedObjectPool
.- Returns:
ThreadCompletionListener
for theManagedObjectPool
.
-
threadComplete
public void threadComplete()
================= ThreadCompletionListener ============- Specified by:
threadComplete
in interfaceThreadCompletionListener
-
-