public class ByteBufferThreadLocal extends ThreadLocal<ByteBuffer>
ByteBuffer
and makes thread-local copies of it.
Note that this class only works with ByteBuffer
, not the related
primitive buffers. This is because the duplicte()
method is
defined on the concrete classes, not the Buffer
interface.
Warning:
Because each thread will have its own ByteBuffer
instance, the
mark, position and limit of those buffers will vary independently. Application
code should never assume that one thread's buffer is in the same state as
another (except for contents).
Constructor and Description |
---|
ByteBufferThreadLocal(ByteBuffer src) |
Modifier and Type | Method and Description |
---|---|
protected ByteBuffer |
initialValue() |
get, remove, set, withInitial
public ByteBufferThreadLocal(ByteBuffer src)
protected ByteBuffer initialValue()
initialValue
in class ThreadLocal<ByteBuffer>