| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>ByteBuffAllocator (Apache HBase 3.0.0-alpha-2-SNAPSHOT API)</title> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="ByteBuffAllocator (Apache HBase 3.0.0-alpha-2-SNAPSHOT API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":9,"i5":9,"i6":10,"i7":10,"i8":10,"i9":10,"i10":9,"i11":9,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/ByteBuffAllocator.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/apache/hadoop/hbase/io/ByteArrayOutputStream.html" title="class in org.apache.hadoop.hbase.io"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.Recycler.html" title="interface in org.apache.hadoop.hbase.io"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/hadoop/hbase/io/ByteBuffAllocator.html" target="_top">Frames</a></li> |
| <li><a href="ByteBuffAllocator.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.hadoop.hbase.io</div> |
| <h2 title="Class ByteBuffAllocator" class="title">Class ByteBuffAllocator</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.hadoop.hbase.io.ByteBuffAllocator</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>Direct Known Subclasses:</dt> |
| <dd><a href="../../../../../org/apache/hadoop/hbase/io/DeallocateRewriteByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">DeallocateRewriteByteBuffAllocator</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>@InterfaceAudience.Private |
| public class <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.57">ByteBuffAllocator</a> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> |
| <div class="block">ByteBuffAllocator is a nio ByteBuffer pool. |
| It returns <a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio"><code>ByteBuff</code></a>s which are wrappers of offheap <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio"><code>ByteBuffer</code></a> usually. If we are |
| sure that the returned ByteBuffs have reached the end of their life cycle, we must call |
| <a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html#release--"><code>ByteBuff.release()</code></a> to return buffers to the pool otherwise the pool will leak. If the |
| desired memory size is larger than what the ByteBufferPool has available, we'll downgrade to |
| allocate ByteBuffers from the heap. Increase the ByteBufferPool size if detect this case.<br/> |
| <br/> |
| For better memory/pool utilization, there is a lower bound named |
| <code>minSizeForReservoirUse</code> in this allocator, and if the desired size is less than |
| <code>minSizeForReservoirUse</code>, the allocator will just allocate the ByteBuffer from heap |
| and let the JVM manage memory, because it better to not waste pool slots allocating a single |
| fixed-size ByteBuffer for a small object.<br/> |
| <br/> |
| This pool can be used anywhere it makes sense managing memory. Currently used at least by RPC.</div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation"> |
| <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Class and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static interface </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.Recycler.html" title="interface in org.apache.hadoop.hbase.io">ByteBuffAllocator.Recycler</a></span></code> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#ALLOCATOR_POOL_ENABLED_KEY">ALLOCATOR_POOL_ENABLED_KEY</a></span></code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#BUFFER_SIZE_KEY">BUFFER_SIZE_KEY</a></span></code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>private <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Queue.html?is-external=true" title="class or interface in java.util">Queue</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#buffers">buffers</a></span></code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#bufSize">bufSize</a></span></code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#BYTEBUFF_ALLOCATOR_CLASS">BYTEBUFF_ALLOCATOR_CLASS</a></span></code> |
| <div class="block">Set an alternate bytebuffallocator by setting this config, |
| e.g.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#DEFAULT_BUFFER_SIZE">DEFAULT_BUFFER_SIZE</a></span></code> |
| <div class="block">There're some reasons why better to choose 65KB(rather than 64KB) as the default buffer size:</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#DEPRECATED_ALLOCATOR_POOL_ENABLED_KEY">DEPRECATED_ALLOCATOR_POOL_ENABLED_KEY</a></span></code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">since 2.3.0 and will be removed in 4.0.0. Use |
| <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#ALLOCATOR_POOL_ENABLED_KEY"><code>ALLOCATOR_POOL_ENABLED_KEY</code></a> instead.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>(package private) static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#DEPRECATED_BUFFER_SIZE_KEY">DEPRECATED_BUFFER_SIZE_KEY</a></span></code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">since 2.3.0 and will be removed in 4.0.0. Use |
| <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#BUFFER_SIZE_KEY"><code>BUFFER_SIZE_KEY</code></a> instead.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>(package private) static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#DEPRECATED_MAX_BUFFER_COUNT_KEY">DEPRECATED_MAX_BUFFER_COUNT_KEY</a></span></code> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> |
| <div class="block"><span class="deprecationComment">since 2.3.0 and will be removed in 4.0.0. Use |
| <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#MAX_BUFFER_COUNT_KEY"><code>MAX_BUFFER_COUNT_KEY</code></a> instead.</span></div> |
| </div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#HEAP">HEAP</a></span></code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>private <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/LongAdder.html?is-external=true" title="class or interface in java.util.concurrent.atomic">LongAdder</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#heapAllocationBytes">heapAllocationBytes</a></span></code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>private long</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#lastHeapAllocationBytes">lastHeapAllocationBytes</a></span></code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>private long</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#lastPoolAllocationBytes">lastPoolAllocationBytes</a></span></code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>private static org.slf4j.Logger</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#LOG">LOG</a></span></code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#MAX_BUFFER_COUNT_KEY">MAX_BUFFER_COUNT_KEY</a></span></code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>private int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#maxBufCount">maxBufCount</a></span></code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>private boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#maxPoolSizeInfoLevelLogged">maxPoolSizeInfoLevelLogged</a></span></code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#MIN_ALLOCATE_SIZE_KEY">MIN_ALLOCATE_SIZE_KEY</a></span></code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>private int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#minSizeForReservoirUse">minSizeForReservoirUse</a></span></code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.Recycler.html" title="interface in org.apache.hadoop.hbase.io">ByteBuffAllocator.Recycler</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#NONE">NONE</a></span></code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>private <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/LongAdder.html?is-external=true" title="class or interface in java.util.concurrent.atomic">LongAdder</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#poolAllocationBytes">poolAllocationBytes</a></span></code> </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>protected boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#reservoirEnabled">reservoirEnabled</a></span></code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>private <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicInteger.html?is-external=true" title="class or interface in java.util.concurrent.atomic">AtomicInteger</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#usedBufCount">usedBufCount</a></span></code> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier</th> |
| <th class="colLast" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#ByteBuffAllocator-boolean-int-int-int-">ByteBuffAllocator</a></span>(boolean reservoirEnabled, |
| int maxBufCount, |
| int bufSize, |
| int minSizeForReservoirUse)</code> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#allocate-int-">allocate</a></span>(int size)</code> |
| <div class="block">Allocate size bytes from the ByteBufAllocator, Note to call the <a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html#release--"><code>ByteBuff.release()</code></a> if |
| no need any more, otherwise the memory leak happen in NIO ByteBuffer pool.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../../org/apache/hadoop/hbase/nio/SingleByteBuff.html" title="class in org.apache.hadoop.hbase.nio">SingleByteBuff</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#allocateOneBuffer--">allocateOneBuffer</a></span>()</code> |
| <div class="block">Allocate an buffer with buffer size from ByteBuffAllocator, Note to call the |
| <a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html#release--"><code>ByteBuff.release()</code></a> if no need any more, otherwise the memory leak happen in NIO |
| ByteBuffer pool.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>private <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#allocateOnHeap-int-">allocateOnHeap</a></span>(int size)</code> </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#clean--">clean</a></span>()</code> |
| <div class="block">Free all direct buffers if allocated, mainly used for testing.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#create-org.apache.hadoop.conf.Configuration-boolean-">create</a></span>(org.apache.hadoop.conf.Configuration conf, |
| boolean reservoirEnabled)</code> |
| <div class="block">Initialize an <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io"><code>ByteBuffAllocator</code></a> which will try to allocate ByteBuffers from off-heap if |
| reservoir is enabled and the reservoir has enough buffers, otherwise the allocator will just |
| allocate the insufficient buffers from on-heap to meet the requirement.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>private static <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#createOnHeap--">createOnHeap</a></span>()</code> |
| <div class="block">Initialize an <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io"><code>ByteBuffAllocator</code></a> which only allocate ByteBuffer from on-heap, it's |
| designed for testing purpose or disabled reservoir case.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>private <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#getBuffer--">getBuffer</a></span>()</code> </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#getBufferSize--">getBufferSize</a></span>()</code> </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#getFreeBufferCount--">getFreeBufferCount</a></span>()</code> |
| <div class="block">The <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html?is-external=true#size--" title="class or interface in java.util.concurrent"><code>ConcurrentLinkedQueue.size()</code></a> is O(N) complexity and time-consuming, so DO NOT use |
| the method except in UT.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>long</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#getHeapAllocationBytes--">getHeapAllocationBytes</a></span>()</code> </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>static long</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#getHeapAllocationBytes-org.apache.hadoop.hbase.io.ByteBuffAllocator...-">getHeapAllocationBytes</a></span>(<a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a>... allocators)</code> </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>static double</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#getHeapAllocationRatio-org.apache.hadoop.hbase.io.ByteBuffAllocator...-">getHeapAllocationRatio</a></span>(<a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a>... allocators)</code> </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>long</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#getPoolAllocationBytes--">getPoolAllocationBytes</a></span>()</code> </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#getTotalBufferCount--">getTotalBufferCount</a></span>()</code> </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#getUsedBufferCount--">getUsedBufferCount</a></span>()</code> </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#isReservoirEnabled--">isReservoirEnabled</a></span>()</code> </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>protected void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#putbackBuffer-java.nio.ByteBuffer-">putbackBuffer</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a> buf)</code> |
| <div class="block">Return back a ByteBuffer after its use.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="LOG"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>LOG</h4> |
| <pre>private static final org.slf4j.Logger <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.59">LOG</a></pre> |
| </li> |
| </ul> |
| <a name="HEAP"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>HEAP</h4> |
| <pre>public static final <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.64">HEAP</a></pre> |
| </li> |
| </ul> |
| <a name="ALLOCATOR_POOL_ENABLED_KEY"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>ALLOCATOR_POOL_ENABLED_KEY</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.66">ALLOCATOR_POOL_ENABLED_KEY</a></pre> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../constant-values.html#org.apache.hadoop.hbase.io.ByteBuffAllocator.ALLOCATOR_POOL_ENABLED_KEY">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="MAX_BUFFER_COUNT_KEY"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>MAX_BUFFER_COUNT_KEY</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.68">MAX_BUFFER_COUNT_KEY</a></pre> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../constant-values.html#org.apache.hadoop.hbase.io.ByteBuffAllocator.MAX_BUFFER_COUNT_KEY">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="BUFFER_SIZE_KEY"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>BUFFER_SIZE_KEY</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.70">BUFFER_SIZE_KEY</a></pre> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../constant-values.html#org.apache.hadoop.hbase.io.ByteBuffAllocator.BUFFER_SIZE_KEY">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="MIN_ALLOCATE_SIZE_KEY"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>MIN_ALLOCATE_SIZE_KEY</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.72">MIN_ALLOCATE_SIZE_KEY</a></pre> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../constant-values.html#org.apache.hadoop.hbase.io.ByteBuffAllocator.MIN_ALLOCATE_SIZE_KEY">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="BYTEBUFF_ALLOCATOR_CLASS"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>BYTEBUFF_ALLOCATOR_CLASS</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.79">BYTEBUFF_ALLOCATOR_CLASS</a></pre> |
| <div class="block">Set an alternate bytebuffallocator by setting this config, |
| e.g. we can config <a href="../../../../../org/apache/hadoop/hbase/io/DeallocateRewriteByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io"><code>DeallocateRewriteByteBuffAllocator</code></a> to find out |
| prematurely release issues</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../constant-values.html#org.apache.hadoop.hbase.io.ByteBuffAllocator.BYTEBUFF_ALLOCATOR_CLASS">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="DEPRECATED_ALLOCATOR_POOL_ENABLED_KEY"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>DEPRECATED_ALLOCATOR_POOL_ENABLED_KEY</h4> |
| <pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a> |
| public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.86">DEPRECATED_ALLOCATOR_POOL_ENABLED_KEY</a></pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">since 2.3.0 and will be removed in 4.0.0. Use |
| <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#ALLOCATOR_POOL_ENABLED_KEY"><code>ALLOCATOR_POOL_ENABLED_KEY</code></a> instead.</span></div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../constant-values.html#org.apache.hadoop.hbase.io.ByteBuffAllocator.DEPRECATED_ALLOCATOR_POOL_ENABLED_KEY">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="DEPRECATED_MAX_BUFFER_COUNT_KEY"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>DEPRECATED_MAX_BUFFER_COUNT_KEY</h4> |
| <pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a> |
| static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.94">DEPRECATED_MAX_BUFFER_COUNT_KEY</a></pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">since 2.3.0 and will be removed in 4.0.0. Use |
| <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#MAX_BUFFER_COUNT_KEY"><code>MAX_BUFFER_COUNT_KEY</code></a> instead.</span></div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../constant-values.html#org.apache.hadoop.hbase.io.ByteBuffAllocator.DEPRECATED_MAX_BUFFER_COUNT_KEY">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="DEPRECATED_BUFFER_SIZE_KEY"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>DEPRECATED_BUFFER_SIZE_KEY</h4> |
| <pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a> |
| static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.101">DEPRECATED_BUFFER_SIZE_KEY</a></pre> |
| <div class="block"><span class="deprecatedLabel">Deprecated.</span> <span class="deprecationComment">since 2.3.0 and will be removed in 4.0.0. Use |
| <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html#BUFFER_SIZE_KEY"><code>BUFFER_SIZE_KEY</code></a> instead.</span></div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../constant-values.html#org.apache.hadoop.hbase.io.ByteBuffAllocator.DEPRECATED_BUFFER_SIZE_KEY">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="DEFAULT_BUFFER_SIZE"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>DEFAULT_BUFFER_SIZE</h4> |
| <pre>public static final int <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.119">DEFAULT_BUFFER_SIZE</a></pre> |
| <div class="block">There're some reasons why better to choose 65KB(rather than 64KB) as the default buffer size: |
| <p> |
| 1. Almost all of the data blocks have the block size: 64KB + delta, whose delta is very small, |
| depends on the size of lastKeyValue. If we set buffer.size=64KB, then each block will be |
| allocated as a MultiByteBuff: one 64KB DirectByteBuffer and delta bytes HeapByteBuffer, the |
| HeapByteBuffer will increase the GC pressure. Ideally, we should let the data block to be |
| allocated as a SingleByteBuff, it has simpler data structure, faster access speed, less heap |
| usage. |
| <p> |
| 2. Since the blocks are MultiByteBuff when using buffer.size=64KB, so we have to calculate the |
| checksum by an temp heap copying (see HBASE-21917), while if it's a SingleByteBuff, we can |
| speed the checksum by calling the hadoop' checksum in native lib, which is more faster. |
| <p> |
| For performance comparison, please see HBASE-22483.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../../constant-values.html#org.apache.hadoop.hbase.io.ByteBuffAllocator.DEFAULT_BUFFER_SIZE">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="NONE"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>NONE</h4> |
| <pre>public static final <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.Recycler.html" title="interface in org.apache.hadoop.hbase.io">ByteBuffAllocator.Recycler</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.121">NONE</a></pre> |
| </li> |
| </ul> |
| <a name="reservoirEnabled"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>reservoirEnabled</h4> |
| <pre>protected final boolean <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.128">reservoirEnabled</a></pre> |
| </li> |
| </ul> |
| <a name="bufSize"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>bufSize</h4> |
| <pre>protected final int <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.129">bufSize</a></pre> |
| </li> |
| </ul> |
| <a name="maxBufCount"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>maxBufCount</h4> |
| <pre>private final int <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.130">maxBufCount</a></pre> |
| </li> |
| </ul> |
| <a name="usedBufCount"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>usedBufCount</h4> |
| <pre>private final <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicInteger.html?is-external=true" title="class or interface in java.util.concurrent.atomic">AtomicInteger</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.131">usedBufCount</a></pre> |
| </li> |
| </ul> |
| <a name="maxPoolSizeInfoLevelLogged"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>maxPoolSizeInfoLevelLogged</h4> |
| <pre>private boolean <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.133">maxPoolSizeInfoLevelLogged</a></pre> |
| </li> |
| </ul> |
| <a name="minSizeForReservoirUse"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>minSizeForReservoirUse</h4> |
| <pre>private final int <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.137">minSizeForReservoirUse</a></pre> |
| </li> |
| </ul> |
| <a name="buffers"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>buffers</h4> |
| <pre>private final <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Queue.html?is-external=true" title="class or interface in java.util">Queue</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.139">buffers</a></pre> |
| </li> |
| </ul> |
| <a name="poolAllocationBytes"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>poolAllocationBytes</h4> |
| <pre>private final <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/LongAdder.html?is-external=true" title="class or interface in java.util.concurrent.atomic">LongAdder</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.143">poolAllocationBytes</a></pre> |
| </li> |
| </ul> |
| <a name="heapAllocationBytes"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>heapAllocationBytes</h4> |
| <pre>private final <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/LongAdder.html?is-external=true" title="class or interface in java.util.concurrent.atomic">LongAdder</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.144">heapAllocationBytes</a></pre> |
| </li> |
| </ul> |
| <a name="lastPoolAllocationBytes"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>lastPoolAllocationBytes</h4> |
| <pre>private long <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.145">lastPoolAllocationBytes</a></pre> |
| </li> |
| </ul> |
| <a name="lastHeapAllocationBytes"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>lastHeapAllocationBytes</h4> |
| <pre>private long <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.146">lastHeapAllocationBytes</a></pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="ByteBuffAllocator-boolean-int-int-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>ByteBuffAllocator</h4> |
| <pre>protected <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.197">ByteBuffAllocator</a>(boolean reservoirEnabled, |
| int maxBufCount, |
| int bufSize, |
| int minSizeForReservoirUse)</pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="create-org.apache.hadoop.conf.Configuration-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>create</h4> |
| <pre>public static <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.159">create</a>(org.apache.hadoop.conf.Configuration conf, |
| boolean reservoirEnabled)</pre> |
| <div class="block">Initialize an <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io"><code>ByteBuffAllocator</code></a> which will try to allocate ByteBuffers from off-heap if |
| reservoir is enabled and the reservoir has enough buffers, otherwise the allocator will just |
| allocate the insufficient buffers from on-heap to meet the requirement.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>conf</code> - which get the arguments to initialize the allocator.</dd> |
| <dd><code>reservoirEnabled</code> - indicate whether the reservoir is enabled or disabled. NOTICE: if |
| reservoir is enabled, then we will use the pool allocator to allocate off-heap |
| ByteBuffers and use the HEAP allocator to allocate heap ByteBuffers. Otherwise if |
| reservoir is disabled then all allocations will happen in HEAP instance.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>ByteBuffAllocator to manage the byte buffers.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="createOnHeap--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>createOnHeap</h4> |
| <pre>private static <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.193">createOnHeap</a>()</pre> |
| <div class="block">Initialize an <a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io"><code>ByteBuffAllocator</code></a> which only allocate ByteBuffer from on-heap, it's |
| designed for testing purpose or disabled reservoir case.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>allocator to allocate on-heap ByteBuffer.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isReservoirEnabled--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isReservoirEnabled</h4> |
| <pre>public boolean <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.205">isReservoirEnabled</a>()</pre> |
| </li> |
| </ul> |
| <a name="getHeapAllocationBytes--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getHeapAllocationBytes</h4> |
| <pre>public long <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.209">getHeapAllocationBytes</a>()</pre> |
| </li> |
| </ul> |
| <a name="getPoolAllocationBytes--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getPoolAllocationBytes</h4> |
| <pre>public long <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.213">getPoolAllocationBytes</a>()</pre> |
| </li> |
| </ul> |
| <a name="getBufferSize--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getBufferSize</h4> |
| <pre>public int <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.217">getBufferSize</a>()</pre> |
| </li> |
| </ul> |
| <a name="getUsedBufferCount--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getUsedBufferCount</h4> |
| <pre>public int <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.221">getUsedBufferCount</a>()</pre> |
| </li> |
| </ul> |
| <a name="getFreeBufferCount--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getFreeBufferCount</h4> |
| <pre>public int <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.229">getFreeBufferCount</a>()</pre> |
| <div class="block">The <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html?is-external=true#size--" title="class or interface in java.util.concurrent"><code>ConcurrentLinkedQueue.size()</code></a> is O(N) complexity and time-consuming, so DO NOT use |
| the method except in UT.</div> |
| </li> |
| </ul> |
| <a name="getTotalBufferCount--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getTotalBufferCount</h4> |
| <pre>public int <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.233">getTotalBufferCount</a>()</pre> |
| </li> |
| </ul> |
| <a name="getHeapAllocationBytes-org.apache.hadoop.hbase.io.ByteBuffAllocator...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getHeapAllocationBytes</h4> |
| <pre>public static long <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.237">getHeapAllocationBytes</a>(<a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a>... allocators)</pre> |
| </li> |
| </ul> |
| <a name="getHeapAllocationRatio-org.apache.hadoop.hbase.io.ByteBuffAllocator...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getHeapAllocationRatio</h4> |
| <pre>public static double <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.245">getHeapAllocationRatio</a>(<a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.html" title="class in org.apache.hadoop.hbase.io">ByteBuffAllocator</a>... allocators)</pre> |
| </li> |
| </ul> |
| <a name="allocateOneBuffer--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>allocateOneBuffer</h4> |
| <pre>public <a href="../../../../../org/apache/hadoop/hbase/nio/SingleByteBuff.html" title="class in org.apache.hadoop.hbase.nio">SingleByteBuff</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.273">allocateOneBuffer</a>()</pre> |
| <div class="block">Allocate an buffer with buffer size from ByteBuffAllocator, Note to call the |
| <a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html#release--"><code>ByteBuff.release()</code></a> if no need any more, otherwise the memory leak happen in NIO |
| ByteBuffer pool.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an ByteBuff with the buffer size.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="allocateOnHeap-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>allocateOnHeap</h4> |
| <pre>private <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.284">allocateOnHeap</a>(int size)</pre> |
| </li> |
| </ul> |
| <a name="allocate-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>allocate</h4> |
| <pre>public <a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html" title="class in org.apache.hadoop.hbase.nio">ByteBuff</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.295">allocate</a>(int size)</pre> |
| <div class="block">Allocate size bytes from the ByteBufAllocator, Note to call the <a href="../../../../../org/apache/hadoop/hbase/nio/ByteBuff.html#release--"><code>ByteBuff.release()</code></a> if |
| no need any more, otherwise the memory leak happen in NIO ByteBuffer pool.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>size</code> - to allocate</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an ByteBuff with the desired size.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="clean--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>clean</h4> |
| <pre>public void <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.335">clean</a>()</pre> |
| <div class="block">Free all direct buffers if allocated, mainly used for testing.</div> |
| </li> |
| </ul> |
| <a name="getBuffer--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getBuffer</h4> |
| <pre>private <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a> <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.359">getBuffer</a>()</pre> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>One free DirectByteBuffer from the pool. If no free ByteBuffer and we have not reached |
| the maximum pool size, it will create a new one and return. In case of max pool size |
| also reached, will return null. When pool returned a ByteBuffer, make sure to return it |
| back to pool after use.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="putbackBuffer-java.nio.ByteBuffer-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>putbackBuffer</h4> |
| <pre>protected void <a href="../../../../../src-html/org/apache/hadoop/hbase/io/ByteBuffAllocator.html#line.390">putbackBuffer</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a> buf)</pre> |
| <div class="block">Return back a ByteBuffer after its use. Don't read/write the ByteBuffer after the returning.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>buf</code> - ByteBuffer to return.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/ByteBuffAllocator.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../../org/apache/hadoop/hbase/io/ByteArrayOutputStream.html" title="class in org.apache.hadoop.hbase.io"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/hadoop/hbase/io/ByteBuffAllocator.Recycler.html" title="interface in org.apache.hadoop.hbase.io"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/hadoop/hbase/io/ByteBuffAllocator.html" target="_top">Frames</a></li> |
| <li><a href="ByteBuffAllocator.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2007–2021 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |