1
2
3
4 package org.apache.hadoop.hbase.tmpl.regionserver;
5
6
7 import java.util.Map;
8
9 import org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile;
10
11 import org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.AgeSnapshot;
12
13 import org.apache.hadoop.hbase.io.hfile.CachedBlock;
14
15 import org.apache.hadoop.conf.Configuration;
16
17 import org.apache.hadoop.hbase.io.hfile.CacheConfig;
18
19 import org.apache.hadoop.hbase.io.hfile.BlockCache;
20
21 import org.apache.hadoop.hbase.io.hfile.bucket.BucketCacheStats;
22
23 import org.apache.hadoop.hbase.io.hfile.bucket.BucketCache;
24
25 import org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator;
26
27 import org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocator.Bucket;
28
29 import org.apache.hadoop.hbase.io.hfile.slab.SlabCache;
30
31 import org.apache.hadoop.hbase.io.hfile.slab.SingleSizeCache;
32
33 import org.apache.hadoop.util.StringUtils;
34
35 @org.jamon.annotations.Template(
36 signature = "8F3892A92B902EE933A05F0ABA2BE807",
37 requiredArguments = {
38 @org.jamon.annotations.Argument(name = "cacheConfig", type = "CacheConfig"),
39 @org.jamon.annotations.Argument(name = "config", type = "Configuration")})
40 public class BlockCacheTmpl
41 extends org.jamon.AbstractTemplateProxy
42 {
43
44 public BlockCacheTmpl(org.jamon.TemplateManager p_manager)
45 {
46 super(p_manager);
47 }
48
49 public BlockCacheTmpl()
50 {
51 super("/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl");
52 }
53
54 protected interface Intf
55 extends org.jamon.AbstractTemplateProxy.Intf{
56
57 void renderNoFlush(final java.io.Writer jamonWriter) throws java.io.IOException;
58
59 }
60 public static class ImplData
61 extends org.jamon.AbstractTemplateProxy.ImplData
62 {
63
64 public void setCacheConfig(CacheConfig cacheConfig)
65 {
66
67 m_cacheConfig = cacheConfig;
68 }
69 public CacheConfig getCacheConfig()
70 {
71 return m_cacheConfig;
72 }
73 private CacheConfig m_cacheConfig;
74
75 public void setConfig(Configuration config)
76 {
77
78 m_config = config;
79 }
80 public Configuration getConfig()
81 {
82 return m_config;
83 }
84 private Configuration m_config;
85 }
86 @Override
87 protected ImplData makeImplData()
88 {
89 return new ImplData();
90 }
91 @Override @SuppressWarnings("unchecked") public ImplData getImplData()
92 {
93 return (ImplData) super.getImplData();
94 }
95
96
97 @Override
98 public org.jamon.AbstractTemplateImpl constructImpl(Class<? extends org.jamon.AbstractTemplateImpl> p_class){
99 try
100 {
101 return p_class
102 .getConstructor(new Class [] { org.jamon.TemplateManager.class, ImplData.class })
103 .newInstance(new Object [] { getTemplateManager(), getImplData()});
104 }
105 catch (RuntimeException e)
106 {
107 throw e;
108 }
109 catch (Exception e)
110 {
111 throw new RuntimeException(e);
112 }
113 }
114
115 @Override
116 protected org.jamon.AbstractTemplateImpl constructImpl(){
117 return new BlockCacheTmplImpl(getTemplateManager(), getImplData());
118 }
119 public org.jamon.Renderer makeRenderer(final CacheConfig cacheConfig, final Configuration config)
120 {
121 return new org.jamon.AbstractRenderer() {
122 @Override
123 public void renderTo(final java.io.Writer jamonWriter)
124 throws java.io.IOException
125 {
126 render(jamonWriter, cacheConfig, config);
127 }
128 };
129 }
130
131 public void render(final java.io.Writer jamonWriter, final CacheConfig cacheConfig, final Configuration config)
132 throws java.io.IOException
133 {
134 renderNoFlush(jamonWriter, cacheConfig, config);
135 jamonWriter.flush();
136 }
137 public void renderNoFlush(final java.io.Writer jamonWriter, final CacheConfig cacheConfig, final Configuration config)
138 throws java.io.IOException
139 {
140 ImplData implData = getImplData();
141 implData.setCacheConfig(cacheConfig);
142 implData.setConfig(config);
143 Intf instance = (Intf) getTemplateManager().constructImpl(this);
144 instance.renderNoFlush(jamonWriter);
145 reset();
146 }
147
148
149 }