View Javadoc

1   // Autogenerated Jamon implementation
2   // /grid/0/jenkins/workspace/HDP-parallel-centos7/SOURCES/hbase/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  
31  public class BlockCacheViewTmplImpl
32    extends org.jamon.AbstractTemplateImpl
33    implements org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.Intf
34  
35  {
36    private final CacheConfig cacheConfig;
37    private final Configuration conf;
38    private final String bcn;
39    private final String bcv;
40    protected static org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData __jamon_setOptionalArguments(org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData p_implData)
41    {
42      return p_implData;
43    }
44    public BlockCacheViewTmplImpl(org.jamon.TemplateManager p_templateManager, org.apache.hadoop.hbase.tmpl.regionserver.BlockCacheViewTmpl.ImplData p_implData)
45    {
46      super(p_templateManager, __jamon_setOptionalArguments(p_implData));
47      cacheConfig = p_implData.getCacheConfig();
48      conf = p_implData.getConf();
49      bcn = p_implData.getBcn();
50      bcv = p_implData.getBcv();
51    }
52    
53    @Override public void renderNoFlush(final java.io.Writer jamonWriter)
54      throws java.io.IOException
55    {
56      // 41, 1
57      
58    BlockCache bc = cacheConfig == null ? null : cacheConfig.getBlockCache();
59    BlockCache [] bcs = bc == null ? null : bc.getBlockCaches();
60    if (bcn.equals("L1")) {
61      bc = bcs == null || bcs.length == 0? bc: bcs[0];
62    } else {
63      if (bcs.length < 2) {
64        System.out.println("There is no L2 block cache");
65        return;
66      }
67      bc = bcs[1];
68    }
69    if (bc == null) {
70      System.out.println("There is no block cache");
71      return;
72    }
73    CachedBlocksByFile cbsbf = BlockCacheUtil.getLoadedCachedBlocksByFile(conf, bc);
74  
75      // 59, 1
76      if (bcv.equals("file") )
77      {
78        // 59, 27
79        {
80          // 59, 27
81          __jamon_innerUnit__bc_by_file(jamonWriter, cbsbf);
82        }
83      }
84      // 59, 59
85      else
86      {
87        // 59, 66
88        jamonWriter.write("[ ");
89        // 59, 68
90        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(BlockCacheUtil.toJSON(bc)), jamonWriter);
91        // 59, 99
92        jamonWriter.write(", ");
93        // 59, 101
94        org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(BlockCacheUtil.toJSON(cbsbf)), jamonWriter);
95        // 59, 135
96        jamonWriter.write(" ]");
97      }
98      // 59, 143
99      jamonWriter.write("\n");
100     // 60, 1
101     
102 cbsbf = null;
103 
104   }
105   
106   
107   // 64, 1
108   private void __jamon_innerUnit__bc_by_file(final java.io.Writer jamonWriter, final CachedBlocksByFile cbsbf)
109     throws java.io.IOException
110   {
111     // 68, 1
112     jamonWriter.write("[");
113     // 68, 2
114     for (Map.Entry<String, NavigableSet<CachedBlock>> e: cbsbf.getCachedBlockStatsByFile().entrySet() )
115     {
116       // 68, 103
117       org.jamon.escaping.Escaping.HTML.write(org.jamon.emit.StandardEmitter.valueOf(BlockCacheUtil.toJSON(e.getKey(), e.getValue())), jamonWriter);
118     }
119     // 68, 163
120     jamonWriter.write("]\n");
121   }
122   
123   
124 }