View Javadoc

1   // Autogenerated Jamon implementation
2   // /wrkdirs/usr/ports/databases/hbase/work/hbase-0.98.4/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheViewTmpl.jamon
3   
4   package org.apache.hadoop.hbase.tmpl.regionserver;
5   
6   // 28, 1
7   import java.util.*;
8   // 29, 1
9   import org.apache.hadoop.conf.Configuration;
10  // 30, 1
11  import org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile;
12  // 31, 1
13  import org.apache.hadoop.hbase.io.hfile.BlockCacheUtil;
14  // 32, 1
15  import org.apache.hadoop.hbase.io.hfile.CachedBlock;
16  // 33, 1
17  import org.apache.hadoop.hbase.io.hfile.CacheConfig;
18  // 34, 1
19  import org.apache.hadoop.hbase.io.hfile.BlockCache;
20  // 35, 1
21  import org.apache.hadoop.hbase.io.hfile.bucket.BucketCacheStats;
22  // 36, 1
23  import org.apache.hadoop.hbase.io.hfile.bucket.BucketCache;
24  // 37, 1
25  import org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator;
26  // 38, 1
27  import org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.Bucket;
28  // 39, 1
29  import org.apache.hadoop.hbase.io.hfile.slab.SlabCache;
30  // 40, 1
31  import org.apache.hadoop.hbase.io.hfile.slab.SingleSizeCache;
32  // 41, 1
33  import org.apache.hadoop.util.StringUtils;
34  // 42, 1
35  import com.yammer.metrics.stats.Snapshot;
36  
37  public class BlockCacheViewTmplImpl
38    extends org.jamon.AbstractTemplateImpl
39    implements org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.Intf
40  
41  {
42    private final CacheConfig cacheConfig;
43    private final Configuration conf;
44    private final String bcn;
45    private final String bcv;
46    protected static org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData p_implData)
47    {
48      return p_implData;
49    }
50    public BlockCacheViewTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData p_implData)
51    {
52      super(p_templateManager, __jamon_setOptionalArguments(p_implData));
53      cacheConfig = p_implData.getCacheConfig();
54      conf = p_implData.getConf();
55      bcn = p_implData.getBcn();
56      bcv = p_implData.getBcv();
57    }
58    
59    public void renderNoFlush(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter)
60      throws java.io.IOException
61    {
62      // 44, 1
63      
64    BlockCache bc = cacheConfig.getBlockCache();
65    BlockCache [] bcs = bc.getBlockCaches();
66    if (bcn.equals("L1")) {
67      bc = bcs == null || bcs.length == 0? bc: bcs[0];
68    } else {
69      if (bcs.length < 2) {
70        System.out.println("There is no L2 block cache");
71        return;
72      }
73      bc = bcs[1];
74    }
75    CachedBlocksByFile cbsbf = BlockCacheUtil.getLoadedCachedBlocksByFile(conf, bc);
76  
77      // 58, 1
78      if (bcv.equals("file") )
79      {
80        // 58, 27
81        {
82          // 58, 27
83          __jamon_innerUnit__bc_by_file(jamonWriter, cbsbf);
84        }
85      }
86      // 58, 59
87      else
88      {
89        // 58, 66
90        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(BlockCacheUtil.toJSON(bc)), jamonWriter);
91      }
92      // 58, 103
93      jamonWriter.write("\n");
94      // 59, 1
95      
96  cbsbf = null;
97  
98    }
99    
100   
101   // 63, 1
102   private void __jamon_innerUnit__bc_by_file(@SuppressWarnings({"unused","hiding"}) final java.io.Writer jamonWriter, final CachedBlocksByFile cbsbf)
103     throws java.io.IOException
104   {
105     // 67, 1
106     jamonWriter.write("[");
107     // 67, 2
108     for (Map.Entry<String, NavigableSet<CachedBlock>> e: cbsbf.getCachedBlockStatsByFile().entrySet() )
109     {
110       // 67, 103
111       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(BlockCacheUtil.toJSON(e.getKey(), e.getValue())), jamonWriter);
112     }
113     // 67, 163
114     jamonWriter.write("]\n");
115   }
116   
117   
118 }