View Javadoc

1   // Autogenerated Jamon implementation
2   // /home/busbey/projects/hbase/hbase-assembly/target/hbase-1.2.6/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.util.StringUtils;
30  // 40, 1
31  import com.yammer.metrics.stats.Snapshot;
32  
33  public class BlockCacheViewTmplImpl
34    extends org.jamon.AbstractTemplateImpl
35    implements org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.Intf
36  
37  {
38    private final CacheConfig cacheConfig;
39    private final Configuration conf;
40    private final String bcn;
41    private final String bcv;
42    protected static org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData p_implData)
43    {
44      return p_implData;
45    }
46    public BlockCacheViewTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData p_implData)
47    {
48      super(p_templateManager, __jamon_setOptionalArguments(p_implData));
49      cacheConfig = p_implData.getCacheConfig();
50      conf = p_implData.getConf();
51      bcn = p_implData.getBcn();
52      bcv = p_implData.getBcv();
53    }
54    
55    @Override public void renderNoFlush(final java.io.Writer jamonWriter)
56      throws java.io.IOException
57    {
58      // 42, 1
59      
60    BlockCache bc = cacheConfig == null ? null : cacheConfig.getBlockCache();
61    BlockCache [] bcs = bc == null ? null : bc.getBlockCaches();
62    if (bcn.equals("L1")) {
63      bc = bcs == null || bcs.length == 0? bc: bcs[0];
64    } else {
65      if (bcs == null || bcs.length < 2) {
66        System.out.println("There is no L2 block cache");
67        return;
68      }
69      bc = bcs[1];
70    }
71    if (bc == null) {
72      System.out.println("There is no block cache");
73      return;
74    }
75    CachedBlocksByFile cbsbf = BlockCacheUtil.getLoadedCachedBlocksByFile(conf, bc);
76  
77      // 60, 1
78      if (bcv.equals("file") )
79      {
80        // 60, 27
81        {
82          // 60, 27
83          __jamon_innerUnit__bc_by_file(jamonWriter, cbsbf);
84        }
85      }
86      // 60, 59
87      else
88      {
89        // 60, 66
90        jamonWriter.write("[ ");
91        // 60, 68
92        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(BlockCacheUtil.toJSON(bc)), jamonWriter);
93        // 60, 99
94        jamonWriter.write(", ");
95        // 60, 101
96        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(BlockCacheUtil.toJSON(cbsbf)), jamonWriter);
97        // 60, 135
98        jamonWriter.write(" ]");
99      }
100     // 60, 143
101     jamonWriter.write("\n");
102     // 61, 1
103     
104 cbsbf = 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 }