org.apache.hadoop.hbase.codec.prefixtree.encode
Class ThreadLocalEncoderPool
java.lang.Object
org.apache.hadoop.hbase.codec.prefixtree.encode.ThreadLocalEncoderPool
- All Implemented Interfaces:
- EncoderPool
@InterfaceAudience.Private
public class ThreadLocalEncoderPool
- extends Object
- implements EncoderPool
Pool to enable reusing the Encoder objects which can consist of thousands of smaller objects and
would be more garbage than the data in the block. A new encoder is needed for each block in
a flush, compaction, RPC response, etc.
It is not a pool in the traditional sense, but implements the semantics of a traditional pool
via ThreadLocals to avoid sharing between threads. Sharing between threads would not be
very expensive given that it's accessed per-block, but this is just as easy.
This pool implementation assumes there is a one-to-one mapping between a single thread and a
single flush or compaction.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ThreadLocalEncoderPool
public ThreadLocalEncoderPool()
checkOut
public PrefixTreeEncoder checkOut(OutputStream os,
boolean includeMvccVersion)
- Get the encoder attached to the current ThreadLocal, or create a new one and attach it to the
current thread.
- Specified by:
checkOut
in interface EncoderPool
checkIn
public void checkIn(PrefixTreeEncoder encoder)
- Specified by:
checkIn
in interface EncoderPool
Copyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.