001// Autogenerated Jamon implementation 002// /Users/petersomogyi/projects/hbase-upstream/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheViewTmpl.jamon 003 004package org.apache.hadoop.hbase.tmpl.regionserver; 005 006// 29, 1 007import java.util.*; 008// 30, 1 009import org.apache.hadoop.conf.Configuration; 010// 31, 1 011import org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile; 012// 32, 1 013import org.apache.hadoop.hbase.io.hfile.BlockCacheUtil; 014// 33, 1 015import org.apache.hadoop.hbase.io.hfile.CachedBlock; 016// 34, 1 017import org.apache.hadoop.hbase.io.hfile.CacheConfig; 018// 35, 1 019import org.apache.hadoop.hbase.io.hfile.BlockCache; 020// 36, 1 021import org.apache.hadoop.hbase.io.hfile.bucket.BucketCacheStats; 022// 37, 1 023import org.apache.hadoop.hbase.io.hfile.bucket.BucketCache; 024// 38, 1 025import org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator; 026// 39, 1 027import org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.Bucket; 028// 40, 1 029import org.apache.hadoop.util.StringUtils; 030 031public class BlockCacheViewTmplImpl 032 extends org.jamon.AbstractTemplateImpl 033 implements org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.Intf 034 035{ 036 private final CacheConfig cacheConfig; 037 private final Configuration conf; 038 private final String bcn; 039 private final String bcv; 040 private final BlockCache blockCache; 041 protected static org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData p_implData) 042 { 043 return p_implData; 044 } 045 public BlockCacheViewTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData p_implData) 046 { 047 super(p_templateManager, __jamon_setOptionalArguments(p_implData)); 048 cacheConfig = p_implData.getCacheConfig(); 049 conf = p_implData.getConf(); 050 bcn = p_implData.getBcn(); 051 bcv = p_implData.getBcv(); 052 blockCache = p_implData.getBlockCache(); 053 } 054 055 @Override public void renderNoFlush(final java.io.Writer jamonWriter) 056 throws java.io.IOException 057 { 058 // 42, 1 059 060 BlockCache bc = blockCache; 061 BlockCache [] bcs = bc == null ? null : bc.getBlockCaches(); 062 if (bcn.equals("L1")) { 063 bc = bcs == null || bcs.length == 0? bc: bcs[0]; 064 } else { 065 if (bcs == null || bcs.length < 2) { 066 System.out.println("There is no L2 block cache"); 067 return; 068 } 069 bc = bcs[1]; 070 } 071 if (bc == null) { 072 System.out.println("There is no block cache"); 073 return; 074 } 075 CachedBlocksByFile cbsbf = BlockCacheUtil.getLoadedCachedBlocksByFile(conf, bc); 076 077 // 60, 1 078 if (bcv.equals("file") ) 079 { 080 // 60, 27 081 { 082 // 60, 27 083 __jamon_innerUnit__bc_by_file(jamonWriter, cbsbf); 084 } 085 } 086 // 60, 59 087 else 088 { 089 // 60, 66 090 jamonWriter.write("[ "); 091 // 60, 68 092 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(BlockCacheUtil.toJSON(bc)), jamonWriter); 093 // 60, 99 094 jamonWriter.write(", "); 095 // 60, 101 096 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(BlockCacheUtil.toJSON(cbsbf)), jamonWriter); 097 // 60, 135 098 jamonWriter.write(" ]"); 099 } 100 // 60, 143 101 jamonWriter.write("\n"); 102 // 61, 1 103 104cbsbf = null; 105 106 } 107 108 109 // 65, 1 110 private void __jamon_innerUnit__bc_by_file(final java.io.Writer jamonWriter, final CachedBlocksByFile cbsbf) 111 throws java.io.IOException 112 { 113 // 69, 1 114 jamonWriter.write("["); 115 // 69, 2 116 for (Map.Entry<String, NavigableSet<CachedBlock>> e: cbsbf.getCachedBlockStatsByFile().entrySet() ) 117 { 118 // 69, 103 119 org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(BlockCacheUtil.toJSON(e.getKey(), e.getValue())), jamonWriter); 120 } 121 // 69, 163 122 jamonWriter.write("]\n"); 123 } 124 125 126}