hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [03/13] hbase-site git commit: Published site at f9e69b51e1997c6de2ed74f9edbc6947b11c88dc.
Date Fri, 22 Jan 2016 17:00:45 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/29e33858/xref/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.html
----------------------------------------------------------------------
diff --git a/xref/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.html b/xref/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.html
index 6b8b2c3..9ee10ea 100644
--- a/xref/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.html
+++ b/xref/org/apache/hadoop/hbase/mapreduce/TableMapReduceUtil.html
@@ -773,7 +773,7 @@
 <a class="jxr_linenumber" name="763" href="#763">763</a> <em class="jxr_javadoccomment">   * Add HBase and its dependencies (only) to the job configuration.</em>
 <a class="jxr_linenumber" name="764" href="#764">764</a> <em class="jxr_javadoccomment">   * &lt;p&gt;</em>
 <a class="jxr_linenumber" name="765" href="#765">765</a> <em class="jxr_javadoccomment">   * This is intended as a low-level API, facilitating code reuse between this</em>
-<a class="jxr_linenumber" name="766" href="#766">766</a> <em class="jxr_javadoccomment">   * class and its mapred counterpart. It also of use to extenral tools that</em>
+<a class="jxr_linenumber" name="766" href="#766">766</a> <em class="jxr_javadoccomment">   * class and its mapred counterpart. It also of use to external tools that</em>
 <a class="jxr_linenumber" name="767" href="#767">767</a> <em class="jxr_javadoccomment">   * need to build a MapReduce job that interacts with HBase but want</em>
 <a class="jxr_linenumber" name="768" href="#768">768</a> <em class="jxr_javadoccomment">   * fine-grained control over the jars shipped to the cluster.</em>
 <a class="jxr_linenumber" name="769" href="#769">769</a> <em class="jxr_javadoccomment">   * &lt;/p&gt;</em>
@@ -782,224 +782,240 @@
 <a class="jxr_linenumber" name="772" href="#772">772</a> <em class="jxr_javadoccomment">   * @see &lt;a href="https://issues.apache.org/jira/browse/PIG-3285"&gt;PIG-3285&lt;/a&gt;</em>
 <a class="jxr_linenumber" name="773" href="#773">773</a> <em class="jxr_javadoccomment">   */</em>
 <a class="jxr_linenumber" name="774" href="#774">774</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> addHBaseDependencyJars(Configuration conf) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="775" href="#775">775</a>     addDependencyJars(conf,
-<a class="jxr_linenumber" name="776" href="#776">776</a>       <em class="jxr_comment">// explicitly pull a class from each module</em>
-<a class="jxr_linenumber" name="777" href="#777">777</a>       org.apache.hadoop.hbase.HConstants.<strong class="jxr_keyword">class</strong>,                      <em class="jxr_comment">// hbase-common</em>
-<a class="jxr_linenumber" name="778" href="#778">778</a>       org.apache.hadoop.hbase.protobuf.generated.ClientProtos.<strong class="jxr_keyword">class</strong>, <em class="jxr_comment">// hbase-protocol</em>
-<a class="jxr_linenumber" name="779" href="#779">779</a>       org.apache.hadoop.hbase.client.Put.<strong class="jxr_keyword">class</strong>,                      <em class="jxr_comment">// hbase-client</em>
-<a class="jxr_linenumber" name="780" href="#780">780</a>       org.apache.hadoop.hbase.CompatibilityFactory.<strong class="jxr_keyword">class</strong>,            <em class="jxr_comment">// hbase-hadoop-compat</em>
-<a class="jxr_linenumber" name="781" href="#781">781</a>       org.apache.hadoop.hbase.mapreduce.TableMapper.<strong class="jxr_keyword">class</strong>,           <em class="jxr_comment">// hbase-server</em>
-<a class="jxr_linenumber" name="782" href="#782">782</a>       <em class="jxr_comment">// pull necessary dependencies</em>
-<a class="jxr_linenumber" name="783" href="#783">783</a>       org.apache.zookeeper.ZooKeeper.<strong class="jxr_keyword">class</strong>,
-<a class="jxr_linenumber" name="784" href="#784">784</a>       io.netty.channel.Channel.<strong class="jxr_keyword">class</strong>,
-<a class="jxr_linenumber" name="785" href="#785">785</a>       com.google.protobuf.Message.<strong class="jxr_keyword">class</strong>,
-<a class="jxr_linenumber" name="786" href="#786">786</a>       com.google.common.collect.Lists.<strong class="jxr_keyword">class</strong>,
-<a class="jxr_linenumber" name="787" href="#787">787</a>       org.apache.htrace.Trace.<strong class="jxr_keyword">class</strong>,
-<a class="jxr_linenumber" name="788" href="#788">788</a>       com.codahale.metrics.MetricRegistry.<strong class="jxr_keyword">class</strong>);
-<a class="jxr_linenumber" name="789" href="#789">789</a>   }
-<a class="jxr_linenumber" name="790" href="#790">790</a> 
-<a class="jxr_linenumber" name="791" href="#791">791</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="792" href="#792">792</a> <em class="jxr_javadoccomment">   * Returns a classpath string built from the content of the "tmpjars" value in {@code conf}.</em>
-<a class="jxr_linenumber" name="793" href="#793">793</a> <em class="jxr_javadoccomment">   * Also exposed to shell scripts via `bin/hbase mapredcp`.</em>
-<a class="jxr_linenumber" name="794" href="#794">794</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="795" href="#795">795</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String buildDependencyClasspath(Configuration conf) {
-<a class="jxr_linenumber" name="796" href="#796">796</a>     <strong class="jxr_keyword">if</strong> (conf == <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="797" href="#797">797</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(<span class="jxr_string">"Must provide a configuration object."</span>);
-<a class="jxr_linenumber" name="798" href="#798">798</a>     }
-<a class="jxr_linenumber" name="799" href="#799">799</a>     Set&lt;String&gt; paths = <strong class="jxr_keyword">new</strong> HashSet&lt;String&gt;(conf.getStringCollection(<span class="jxr_string">"tmpjars"</span>));
-<a class="jxr_linenumber" name="800" href="#800">800</a>     <strong class="jxr_keyword">if</strong> (paths.size() == 0) {
-<a class="jxr_linenumber" name="801" href="#801">801</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(<span class="jxr_string">"Configuration contains no tmpjars."</span>);
-<a class="jxr_linenumber" name="802" href="#802">802</a>     }
-<a class="jxr_linenumber" name="803" href="#803">803</a>     StringBuilder sb = <strong class="jxr_keyword">new</strong> StringBuilder();
-<a class="jxr_linenumber" name="804" href="#804">804</a>     <strong class="jxr_keyword">for</strong> (String s : paths) {
-<a class="jxr_linenumber" name="805" href="#805">805</a>       <em class="jxr_comment">// entries can take the form 'file:/path/to/file.jar'.</em>
-<a class="jxr_linenumber" name="806" href="#806">806</a>       <strong class="jxr_keyword">int</strong> idx = s.indexOf(<span class="jxr_string">":"</span>);
-<a class="jxr_linenumber" name="807" href="#807">807</a>       <strong class="jxr_keyword">if</strong> (idx != -1) s = s.substring(idx + 1);
-<a class="jxr_linenumber" name="808" href="#808">808</a>       <strong class="jxr_keyword">if</strong> (sb.length() &gt; 0) sb.append(File.pathSeparator);
-<a class="jxr_linenumber" name="809" href="#809">809</a>       sb.append(s);
-<a class="jxr_linenumber" name="810" href="#810">810</a>     }
-<a class="jxr_linenumber" name="811" href="#811">811</a>     <strong class="jxr_keyword">return</strong> sb.toString();
-<a class="jxr_linenumber" name="812" href="#812">812</a>   }
-<a class="jxr_linenumber" name="813" href="#813">813</a> 
-<a class="jxr_linenumber" name="814" href="#814">814</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="815" href="#815">815</a> <em class="jxr_javadoccomment">   * Add the HBase dependency jars as well as jars for any of the configured</em>
-<a class="jxr_linenumber" name="816" href="#816">816</a> <em class="jxr_javadoccomment">   * job classes to the job configuration, so that JobClient will ship them</em>
-<a class="jxr_linenumber" name="817" href="#817">817</a> <em class="jxr_javadoccomment">   * to the cluster and add them to the DistributedCache.</em>
-<a class="jxr_linenumber" name="818" href="#818">818</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="819" href="#819">819</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> addDependencyJars(Job job) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="820" href="#820">820</a>     addHBaseDependencyJars(job.getConfiguration());
-<a class="jxr_linenumber" name="821" href="#821">821</a>     <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="822" href="#822">822</a>       addDependencyJars(job.getConfiguration(),
-<a class="jxr_linenumber" name="823" href="#823">823</a>           <em class="jxr_comment">// when making changes here, consider also mapred.TableMapReduceUtil</em>
-<a class="jxr_linenumber" name="824" href="#824">824</a>           <em class="jxr_comment">// pull job classes</em>
-<a class="jxr_linenumber" name="825" href="#825">825</a>           job.getMapOutputKeyClass(),
-<a class="jxr_linenumber" name="826" href="#826">826</a>           job.getMapOutputValueClass(),
-<a class="jxr_linenumber" name="827" href="#827">827</a>           job.getInputFormatClass(),
-<a class="jxr_linenumber" name="828" href="#828">828</a>           job.getOutputKeyClass(),
-<a class="jxr_linenumber" name="829" href="#829">829</a>           job.getOutputValueClass(),
-<a class="jxr_linenumber" name="830" href="#830">830</a>           job.getOutputFormatClass(),
-<a class="jxr_linenumber" name="831" href="#831">831</a>           job.getPartitionerClass(),
-<a class="jxr_linenumber" name="832" href="#832">832</a>           job.getCombinerClass());
-<a class="jxr_linenumber" name="833" href="#833">833</a>     } <strong class="jxr_keyword">catch</strong> (ClassNotFoundException e) {
-<a class="jxr_linenumber" name="834" href="#834">834</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(e);
-<a class="jxr_linenumber" name="835" href="#835">835</a>     }
-<a class="jxr_linenumber" name="836" href="#836">836</a>   }
-<a class="jxr_linenumber" name="837" href="#837">837</a> 
-<a class="jxr_linenumber" name="838" href="#838">838</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="839" href="#839">839</a> <em class="jxr_javadoccomment">   * Add the jars containing the given classes to the job's configuration</em>
-<a class="jxr_linenumber" name="840" href="#840">840</a> <em class="jxr_javadoccomment">   * such that JobClient will ship them to the cluster and add them to</em>
-<a class="jxr_linenumber" name="841" href="#841">841</a> <em class="jxr_javadoccomment">   * the DistributedCache.</em>
-<a class="jxr_linenumber" name="842" href="#842">842</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="843" href="#843">843</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> addDependencyJars(Configuration conf,
-<a class="jxr_linenumber" name="844" href="#844">844</a>       Class&lt;?&gt;... classes) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="845" href="#845">845</a> 
-<a class="jxr_linenumber" name="846" href="#846">846</a>     FileSystem localFs = FileSystem.getLocal(conf);
-<a class="jxr_linenumber" name="847" href="#847">847</a>     Set&lt;String&gt; jars = <strong class="jxr_keyword">new</strong> HashSet&lt;String&gt;();
-<a class="jxr_linenumber" name="848" href="#848">848</a>     <em class="jxr_comment">// Add jars that are already in the tmpjars variable</em>
-<a class="jxr_linenumber" name="849" href="#849">849</a>     jars.addAll(conf.getStringCollection(<span class="jxr_string">"tmpjars"</span>));
-<a class="jxr_linenumber" name="850" href="#850">850</a> 
-<a class="jxr_linenumber" name="851" href="#851">851</a>     <em class="jxr_comment">// add jars as we find them to a map of contents jar name so that we can avoid</em>
-<a class="jxr_linenumber" name="852" href="#852">852</a>     <em class="jxr_comment">// creating new jars for classes that have already been packaged.</em>
-<a class="jxr_linenumber" name="853" href="#853">853</a>     Map&lt;String, String&gt; packagedClasses = <strong class="jxr_keyword">new</strong> HashMap&lt;String, String&gt;();
-<a class="jxr_linenumber" name="854" href="#854">854</a> 
-<a class="jxr_linenumber" name="855" href="#855">855</a>     <em class="jxr_comment">// Add jars containing the specified classes</em>
-<a class="jxr_linenumber" name="856" href="#856">856</a>     <strong class="jxr_keyword">for</strong> (Class&lt;?&gt; clazz : classes) {
-<a class="jxr_linenumber" name="857" href="#857">857</a>       <strong class="jxr_keyword">if</strong> (clazz == <strong class="jxr_keyword">null</strong>) <strong class="jxr_keyword">continue</strong>;
-<a class="jxr_linenumber" name="858" href="#858">858</a> 
-<a class="jxr_linenumber" name="859" href="#859">859</a>       Path path = findOrCreateJar(clazz, localFs, packagedClasses);
-<a class="jxr_linenumber" name="860" href="#860">860</a>       <strong class="jxr_keyword">if</strong> (path == <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="861" href="#861">861</a>         LOG.warn(<span class="jxr_string">"Could not find jar for class "</span> + clazz +
-<a class="jxr_linenumber" name="862" href="#862">862</a>                  <span class="jxr_string">" in order to ship it to the cluster."</span>);
-<a class="jxr_linenumber" name="863" href="#863">863</a>         <strong class="jxr_keyword">continue</strong>;
-<a class="jxr_linenumber" name="864" href="#864">864</a>       }
-<a class="jxr_linenumber" name="865" href="#865">865</a>       <strong class="jxr_keyword">if</strong> (!localFs.exists(path)) {
-<a class="jxr_linenumber" name="866" href="#866">866</a>         LOG.warn(<span class="jxr_string">"Could not validate jar file "</span> + path + <span class="jxr_string">" for class "</span>
-<a class="jxr_linenumber" name="867" href="#867">867</a>                  + clazz);
-<a class="jxr_linenumber" name="868" href="#868">868</a>         <strong class="jxr_keyword">continue</strong>;
-<a class="jxr_linenumber" name="869" href="#869">869</a>       }
-<a class="jxr_linenumber" name="870" href="#870">870</a>       jars.add(path.toString());
-<a class="jxr_linenumber" name="871" href="#871">871</a>     }
-<a class="jxr_linenumber" name="872" href="#872">872</a>     <strong class="jxr_keyword">if</strong> (jars.isEmpty()) <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="873" href="#873">873</a> 
-<a class="jxr_linenumber" name="874" href="#874">874</a>     conf.set(<span class="jxr_string">"tmpjars"</span>, StringUtils.arrayToString(jars.toArray(<strong class="jxr_keyword">new</strong> String[jars.size()])));
-<a class="jxr_linenumber" name="875" href="#875">875</a>   }
-<a class="jxr_linenumber" name="876" href="#876">876</a> 
-<a class="jxr_linenumber" name="877" href="#877">877</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="878" href="#878">878</a> <em class="jxr_javadoccomment">   * Finds the Jar for a class or creates it if it doesn't exist. If the class is in</em>
-<a class="jxr_linenumber" name="879" href="#879">879</a> <em class="jxr_javadoccomment">   * a directory in the classpath, it creates a Jar on the fly with the</em>
-<a class="jxr_linenumber" name="880" href="#880">880</a> <em class="jxr_javadoccomment">   * contents of the directory and returns the path to that Jar. If a Jar is</em>
-<a class="jxr_linenumber" name="881" href="#881">881</a> <em class="jxr_javadoccomment">   * created, it is created in the system temporary directory. Otherwise,</em>
-<a class="jxr_linenumber" name="882" href="#882">882</a> <em class="jxr_javadoccomment">   * returns an existing jar that contains a class of the same name. Maintains</em>
-<a class="jxr_linenumber" name="883" href="#883">883</a> <em class="jxr_javadoccomment">   * a mapping from jar contents to the tmp jar created.</em>
-<a class="jxr_linenumber" name="884" href="#884">884</a> <em class="jxr_javadoccomment">   * @param my_class the class to find.</em>
-<a class="jxr_linenumber" name="885" href="#885">885</a> <em class="jxr_javadoccomment">   * @param fs the FileSystem with which to qualify the returned path.</em>
-<a class="jxr_linenumber" name="886" href="#886">886</a> <em class="jxr_javadoccomment">   * @param packagedClasses a map of class name to path.</em>
-<a class="jxr_linenumber" name="887" href="#887">887</a> <em class="jxr_javadoccomment">   * @return a jar file that contains the class.</em>
-<a class="jxr_linenumber" name="888" href="#888">888</a> <em class="jxr_javadoccomment">   * @throws IOException</em>
-<a class="jxr_linenumber" name="889" href="#889">889</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="890" href="#890">890</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> Path findOrCreateJar(Class&lt;?&gt; my_<strong class="jxr_keyword">class</strong>, FileSystem fs,
-<a class="jxr_linenumber" name="891" href="#891">891</a>       Map&lt;String, String&gt; packagedClasses)
-<a class="jxr_linenumber" name="892" href="#892">892</a>   <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="893" href="#893">893</a>     <em class="jxr_comment">// attempt to locate an existing jar for the class.</em>
-<a class="jxr_linenumber" name="894" href="#894">894</a>     String jar = findContainingJar(my_<strong class="jxr_keyword">class</strong>, packagedClasses);
-<a class="jxr_linenumber" name="895" href="#895">895</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == jar || jar.isEmpty()) {
-<a class="jxr_linenumber" name="896" href="#896">896</a>       jar = getJar(my_<strong class="jxr_keyword">class</strong>);
-<a class="jxr_linenumber" name="897" href="#897">897</a>       updateMap(jar, packagedClasses);
-<a class="jxr_linenumber" name="898" href="#898">898</a>     }
-<a class="jxr_linenumber" name="899" href="#899">899</a> 
-<a class="jxr_linenumber" name="900" href="#900">900</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == jar || jar.isEmpty()) {
-<a class="jxr_linenumber" name="901" href="#901">901</a>       <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="902" href="#902">902</a>     }
-<a class="jxr_linenumber" name="903" href="#903">903</a> 
-<a class="jxr_linenumber" name="904" href="#904">904</a>     LOG.debug(String.format(<span class="jxr_string">"For class %s, using jar %s"</span>, my_<strong class="jxr_keyword">class</strong>.getName(), jar));
-<a class="jxr_linenumber" name="905" href="#905">905</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> Path(jar).makeQualified(fs);
-<a class="jxr_linenumber" name="906" href="#906">906</a>   }
-<a class="jxr_linenumber" name="907" href="#907">907</a> 
-<a class="jxr_linenumber" name="908" href="#908">908</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="909" href="#909">909</a> <em class="jxr_javadoccomment">   * Add entries to &lt;code&gt;packagedClasses&lt;/code&gt; corresponding to class files</em>
-<a class="jxr_linenumber" name="910" href="#910">910</a> <em class="jxr_javadoccomment">   * contained in &lt;code&gt;jar&lt;/code&gt;.</em>
-<a class="jxr_linenumber" name="911" href="#911">911</a> <em class="jxr_javadoccomment">   * @param jar The jar who's content to list.</em>
-<a class="jxr_linenumber" name="912" href="#912">912</a> <em class="jxr_javadoccomment">   * @param packagedClasses map[class -&gt; jar]</em>
-<a class="jxr_linenumber" name="913" href="#913">913</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="914" href="#914">914</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> updateMap(String jar, Map&lt;String, String&gt; packagedClasses) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="915" href="#915">915</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == jar || jar.isEmpty()) {
-<a class="jxr_linenumber" name="916" href="#916">916</a>       <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="917" href="#917">917</a>     }
-<a class="jxr_linenumber" name="918" href="#918">918</a>     ZipFile zip = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="919" href="#919">919</a>     <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="920" href="#920">920</a>       zip = <strong class="jxr_keyword">new</strong> ZipFile(jar);
-<a class="jxr_linenumber" name="921" href="#921">921</a>       <strong class="jxr_keyword">for</strong> (Enumeration&lt;? <strong class="jxr_keyword">extends</strong> ZipEntry&gt; iter = zip.entries(); iter.hasMoreElements();) {
-<a class="jxr_linenumber" name="922" href="#922">922</a>         ZipEntry entry = iter.nextElement();
-<a class="jxr_linenumber" name="923" href="#923">923</a>         <strong class="jxr_keyword">if</strong> (entry.getName().endsWith(<span class="jxr_string">"class"</span>)) {
-<a class="jxr_linenumber" name="924" href="#924">924</a>           packagedClasses.put(entry.getName(), jar);
-<a class="jxr_linenumber" name="925" href="#925">925</a>         }
-<a class="jxr_linenumber" name="926" href="#926">926</a>       }
-<a class="jxr_linenumber" name="927" href="#927">927</a>     } <strong class="jxr_keyword">finally</strong> {
-<a class="jxr_linenumber" name="928" href="#928">928</a>       <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> != zip) zip.close();
-<a class="jxr_linenumber" name="929" href="#929">929</a>     }
-<a class="jxr_linenumber" name="930" href="#930">930</a>   }
-<a class="jxr_linenumber" name="931" href="#931">931</a> 
-<a class="jxr_linenumber" name="932" href="#932">932</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="933" href="#933">933</a> <em class="jxr_javadoccomment">   * Find a jar that contains a class of the same name, if any. It will return</em>
-<a class="jxr_linenumber" name="934" href="#934">934</a> <em class="jxr_javadoccomment">   * a jar file, even if that is not the first thing on the class path that</em>
-<a class="jxr_linenumber" name="935" href="#935">935</a> <em class="jxr_javadoccomment">   * has a class with the same name. Looks first on the classpath and then in</em>
-<a class="jxr_linenumber" name="936" href="#936">936</a> <em class="jxr_javadoccomment">   * the &lt;code&gt;packagedClasses&lt;/code&gt; map.</em>
-<a class="jxr_linenumber" name="937" href="#937">937</a> <em class="jxr_javadoccomment">   * @param my_class the class to find.</em>
-<a class="jxr_linenumber" name="938" href="#938">938</a> <em class="jxr_javadoccomment">   * @return a jar file that contains the class, or null.</em>
-<a class="jxr_linenumber" name="939" href="#939">939</a> <em class="jxr_javadoccomment">   * @throws IOException</em>
-<a class="jxr_linenumber" name="940" href="#940">940</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="941" href="#941">941</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> String findContainingJar(Class&lt;?&gt; my_<strong class="jxr_keyword">class</strong>, Map&lt;String, String&gt; packagedClasses)
-<a class="jxr_linenumber" name="942" href="#942">942</a>       <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="943" href="#943">943</a>     ClassLoader loader = my_<strong class="jxr_keyword">class</strong>.getClassLoader();
-<a class="jxr_linenumber" name="944" href="#944">944</a> 
-<a class="jxr_linenumber" name="945" href="#945">945</a>     String <strong class="jxr_keyword">class</strong>_file = my_<strong class="jxr_keyword">class</strong>.getName().replaceAll(<span class="jxr_string">"&#92;&#92;."</span>, <span class="jxr_string">"/"</span>) + <span class="jxr_string">".class"</span>;
-<a class="jxr_linenumber" name="946" href="#946">946</a> 
-<a class="jxr_linenumber" name="947" href="#947">947</a>     <strong class="jxr_keyword">if</strong> (loader != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="948" href="#948">948</a>       <em class="jxr_comment">// first search the classpath</em>
-<a class="jxr_linenumber" name="949" href="#949">949</a>       <strong class="jxr_keyword">for</strong> (Enumeration&lt;URL&gt; itr = loader.getResources(<strong class="jxr_keyword">class</strong>_file); itr.hasMoreElements();) {
-<a class="jxr_linenumber" name="950" href="#950">950</a>         URL url = itr.nextElement();
-<a class="jxr_linenumber" name="951" href="#951">951</a>         <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"jar"</span>.equals(url.getProtocol())) {
-<a class="jxr_linenumber" name="952" href="#952">952</a>           String toReturn = url.getPath();
-<a class="jxr_linenumber" name="953" href="#953">953</a>           <strong class="jxr_keyword">if</strong> (toReturn.startsWith(<span class="jxr_string">"file:"</span>)) {
-<a class="jxr_linenumber" name="954" href="#954">954</a>             toReturn = toReturn.substring(<span class="jxr_string">"file:"</span>.length());
-<a class="jxr_linenumber" name="955" href="#955">955</a>           }
-<a class="jxr_linenumber" name="956" href="#956">956</a>           <em class="jxr_comment">// URLDecoder is a misnamed class, since it actually decodes</em>
-<a class="jxr_linenumber" name="957" href="#957">957</a>           <em class="jxr_comment">// x-www-form-urlencoded MIME type rather than actual</em>
-<a class="jxr_linenumber" name="958" href="#958">958</a>           <em class="jxr_comment">// URL encoding (which the file path has). Therefore it would</em>
-<a class="jxr_linenumber" name="959" href="#959">959</a>           <em class="jxr_comment">// decode +s to ' 's which is incorrect (spaces are actually</em>
-<a class="jxr_linenumber" name="960" href="#960">960</a>           <em class="jxr_comment">// either unencoded or encoded as "%20"). Replace +s first, so</em>
-<a class="jxr_linenumber" name="961" href="#961">961</a>           <em class="jxr_comment">// that they are kept sacred during the decoding process.</em>
-<a class="jxr_linenumber" name="962" href="#962">962</a>           toReturn = toReturn.replaceAll(<span class="jxr_string">"&#92;&#92;+"</span>, <span class="jxr_string">"%2B"</span>);
-<a class="jxr_linenumber" name="963" href="#963">963</a>           toReturn = URLDecoder.decode(toReturn, <span class="jxr_string">"UTF-8"</span>);
-<a class="jxr_linenumber" name="964" href="#964">964</a>           <strong class="jxr_keyword">return</strong> toReturn.replaceAll(<span class="jxr_string">"!.*$"</span>, <span class="jxr_string">""</span>);
-<a class="jxr_linenumber" name="965" href="#965">965</a>         }
-<a class="jxr_linenumber" name="966" href="#966">966</a>       }
-<a class="jxr_linenumber" name="967" href="#967">967</a>     }
-<a class="jxr_linenumber" name="968" href="#968">968</a> 
-<a class="jxr_linenumber" name="969" href="#969">969</a>     <em class="jxr_comment">// now look in any jars we've packaged using JarFinder. Returns null when</em>
-<a class="jxr_linenumber" name="970" href="#970">970</a>     <em class="jxr_comment">// no jar is found.</em>
-<a class="jxr_linenumber" name="971" href="#971">971</a>     <strong class="jxr_keyword">return</strong> packagedClasses.get(<strong class="jxr_keyword">class</strong>_file);
-<a class="jxr_linenumber" name="972" href="#972">972</a>   }
-<a class="jxr_linenumber" name="973" href="#973">973</a> 
-<a class="jxr_linenumber" name="974" href="#974">974</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="975" href="#975">975</a> <em class="jxr_javadoccomment">   * Invoke 'getJar' on a custom JarFinder implementation. Useful for some job</em>
-<a class="jxr_linenumber" name="976" href="#976">976</a> <em class="jxr_javadoccomment">   * configuration contexts (HBASE-8140) and also for testing on MRv2.</em>
-<a class="jxr_linenumber" name="977" href="#977">977</a> <em class="jxr_javadoccomment">   * check if we have HADOOP-9426.</em>
-<a class="jxr_linenumber" name="978" href="#978">978</a> <em class="jxr_javadoccomment">   * @param my_class the class to find.</em>
-<a class="jxr_linenumber" name="979" href="#979">979</a> <em class="jxr_javadoccomment">   * @return a jar file that contains the class, or null.</em>
-<a class="jxr_linenumber" name="980" href="#980">980</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="981" href="#981">981</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> String getJar(Class&lt;?&gt; my_<strong class="jxr_keyword">class</strong>) {
-<a class="jxr_linenumber" name="982" href="#982">982</a>     String ret = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="983" href="#983">983</a>     <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="984" href="#984">984</a>       ret = JarFinder.getJar(my_<strong class="jxr_keyword">class</strong>);
-<a class="jxr_linenumber" name="985" href="#985">985</a>     } <strong class="jxr_keyword">catch</strong> (Exception e) {
-<a class="jxr_linenumber" name="986" href="#986">986</a>       <em class="jxr_comment">// toss all other exceptions, related to reflection failure</em>
-<a class="jxr_linenumber" name="987" href="#987">987</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> RuntimeException(<span class="jxr_string">"getJar invocation failed."</span>, e);
-<a class="jxr_linenumber" name="988" href="#988">988</a>     }
+<a class="jxr_linenumber" name="775" href="#775">775</a> 
+<a class="jxr_linenumber" name="776" href="#776">776</a>     <em class="jxr_comment">// PrefixTreeCodec is part of the hbase-prefix-tree module. If not included in MR jobs jar</em>
+<a class="jxr_linenumber" name="777" href="#777">777</a>     <em class="jxr_comment">// dependencies, MR jobs that write encoded hfiles will fail.</em>
+<a class="jxr_linenumber" name="778" href="#778">778</a>     <em class="jxr_comment">// We used reflection here so to prevent a circular module dependency.</em>
+<a class="jxr_linenumber" name="779" href="#779">779</a>     <em class="jxr_comment">// TODO - if we extract the MR into a module, make it depend on hbase-prefix-tree.</em>
+<a class="jxr_linenumber" name="780" href="#780">780</a>     Class prefixTreeCodecClass = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="781" href="#781">781</a>     <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="782" href="#782">782</a>       prefixTreeCodecClass =
+<a class="jxr_linenumber" name="783" href="#783">783</a>           Class.forName(<span class="jxr_string">"org.apache.hadoop.hbase.code.prefixtree.PrefixTreeCodec"</span>);
+<a class="jxr_linenumber" name="784" href="#784">784</a>     } <strong class="jxr_keyword">catch</strong> (ClassNotFoundException e) {
+<a class="jxr_linenumber" name="785" href="#785">785</a>       <em class="jxr_comment">// this will show up in unit tests but should not show in real deployments</em>
+<a class="jxr_linenumber" name="786" href="#786">786</a>       LOG.warn(<span class="jxr_string">"The hbase-prefix-tree module jar containing PrefixTreeCodec is not present."</span> +
+<a class="jxr_linenumber" name="787" href="#787">787</a>           <span class="jxr_string">"  Continuing without it."</span>);
+<a class="jxr_linenumber" name="788" href="#788">788</a>     }
+<a class="jxr_linenumber" name="789" href="#789">789</a> 
+<a class="jxr_linenumber" name="790" href="#790">790</a>     addDependencyJars(conf,
+<a class="jxr_linenumber" name="791" href="#791">791</a>       <em class="jxr_comment">// explicitly pull a class from each module</em>
+<a class="jxr_linenumber" name="792" href="#792">792</a>       org.apache.hadoop.hbase.HConstants.<strong class="jxr_keyword">class</strong>,                      <em class="jxr_comment">// hbase-common</em>
+<a class="jxr_linenumber" name="793" href="#793">793</a>       org.apache.hadoop.hbase.protobuf.generated.ClientProtos.<strong class="jxr_keyword">class</strong>, <em class="jxr_comment">// hbase-protocol</em>
+<a class="jxr_linenumber" name="794" href="#794">794</a>       org.apache.hadoop.hbase.client.Put.<strong class="jxr_keyword">class</strong>,                      <em class="jxr_comment">// hbase-client</em>
+<a class="jxr_linenumber" name="795" href="#795">795</a>       org.apache.hadoop.hbase.CompatibilityFactory.<strong class="jxr_keyword">class</strong>,            <em class="jxr_comment">// hbase-hadoop-compat</em>
+<a class="jxr_linenumber" name="796" href="#796">796</a>       org.apache.hadoop.hbase.mapreduce.TableMapper.<strong class="jxr_keyword">class</strong>,           <em class="jxr_comment">// hbase-server</em>
+<a class="jxr_linenumber" name="797" href="#797">797</a>       prefixTreeCodecClass, <em class="jxr_comment">//  hbase-prefix-tree (if null will be skipped)</em>
+<a class="jxr_linenumber" name="798" href="#798">798</a>       <em class="jxr_comment">// pull necessary dependencies</em>
+<a class="jxr_linenumber" name="799" href="#799">799</a>       org.apache.zookeeper.ZooKeeper.<strong class="jxr_keyword">class</strong>,
+<a class="jxr_linenumber" name="800" href="#800">800</a>       io.netty.channel.Channel.<strong class="jxr_keyword">class</strong>,
+<a class="jxr_linenumber" name="801" href="#801">801</a>       com.google.protobuf.Message.<strong class="jxr_keyword">class</strong>,
+<a class="jxr_linenumber" name="802" href="#802">802</a>       com.google.common.collect.Lists.<strong class="jxr_keyword">class</strong>,
+<a class="jxr_linenumber" name="803" href="#803">803</a>       org.apache.htrace.Trace.<strong class="jxr_keyword">class</strong>,
+<a class="jxr_linenumber" name="804" href="#804">804</a>       com.codahale.metrics.MetricRegistry.<strong class="jxr_keyword">class</strong>);
+<a class="jxr_linenumber" name="805" href="#805">805</a>   }
+<a class="jxr_linenumber" name="806" href="#806">806</a> 
+<a class="jxr_linenumber" name="807" href="#807">807</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="808" href="#808">808</a> <em class="jxr_javadoccomment">   * Returns a classpath string built from the content of the "tmpjars" value in {@code conf}.</em>
+<a class="jxr_linenumber" name="809" href="#809">809</a> <em class="jxr_javadoccomment">   * Also exposed to shell scripts via `bin/hbase mapredcp`.</em>
+<a class="jxr_linenumber" name="810" href="#810">810</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="811" href="#811">811</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String buildDependencyClasspath(Configuration conf) {
+<a class="jxr_linenumber" name="812" href="#812">812</a>     <strong class="jxr_keyword">if</strong> (conf == <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="813" href="#813">813</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(<span class="jxr_string">"Must provide a configuration object."</span>);
+<a class="jxr_linenumber" name="814" href="#814">814</a>     }
+<a class="jxr_linenumber" name="815" href="#815">815</a>     Set&lt;String&gt; paths = <strong class="jxr_keyword">new</strong> HashSet&lt;String&gt;(conf.getStringCollection(<span class="jxr_string">"tmpjars"</span>));
+<a class="jxr_linenumber" name="816" href="#816">816</a>     <strong class="jxr_keyword">if</strong> (paths.size() == 0) {
+<a class="jxr_linenumber" name="817" href="#817">817</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(<span class="jxr_string">"Configuration contains no tmpjars."</span>);
+<a class="jxr_linenumber" name="818" href="#818">818</a>     }
+<a class="jxr_linenumber" name="819" href="#819">819</a>     StringBuilder sb = <strong class="jxr_keyword">new</strong> StringBuilder();
+<a class="jxr_linenumber" name="820" href="#820">820</a>     <strong class="jxr_keyword">for</strong> (String s : paths) {
+<a class="jxr_linenumber" name="821" href="#821">821</a>       <em class="jxr_comment">// entries can take the form 'file:/path/to/file.jar'.</em>
+<a class="jxr_linenumber" name="822" href="#822">822</a>       <strong class="jxr_keyword">int</strong> idx = s.indexOf(<span class="jxr_string">":"</span>);
+<a class="jxr_linenumber" name="823" href="#823">823</a>       <strong class="jxr_keyword">if</strong> (idx != -1) s = s.substring(idx + 1);
+<a class="jxr_linenumber" name="824" href="#824">824</a>       <strong class="jxr_keyword">if</strong> (sb.length() &gt; 0) sb.append(File.pathSeparator);
+<a class="jxr_linenumber" name="825" href="#825">825</a>       sb.append(s);
+<a class="jxr_linenumber" name="826" href="#826">826</a>     }
+<a class="jxr_linenumber" name="827" href="#827">827</a>     <strong class="jxr_keyword">return</strong> sb.toString();
+<a class="jxr_linenumber" name="828" href="#828">828</a>   }
+<a class="jxr_linenumber" name="829" href="#829">829</a> 
+<a class="jxr_linenumber" name="830" href="#830">830</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="831" href="#831">831</a> <em class="jxr_javadoccomment">   * Add the HBase dependency jars as well as jars for any of the configured</em>
+<a class="jxr_linenumber" name="832" href="#832">832</a> <em class="jxr_javadoccomment">   * job classes to the job configuration, so that JobClient will ship them</em>
+<a class="jxr_linenumber" name="833" href="#833">833</a> <em class="jxr_javadoccomment">   * to the cluster and add them to the DistributedCache.</em>
+<a class="jxr_linenumber" name="834" href="#834">834</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="835" href="#835">835</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> addDependencyJars(Job job) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="836" href="#836">836</a>     addHBaseDependencyJars(job.getConfiguration());
+<a class="jxr_linenumber" name="837" href="#837">837</a>     <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="838" href="#838">838</a>       addDependencyJars(job.getConfiguration(),
+<a class="jxr_linenumber" name="839" href="#839">839</a>           <em class="jxr_comment">// when making changes here, consider also mapred.TableMapReduceUtil</em>
+<a class="jxr_linenumber" name="840" href="#840">840</a>           <em class="jxr_comment">// pull job classes</em>
+<a class="jxr_linenumber" name="841" href="#841">841</a>           job.getMapOutputKeyClass(),
+<a class="jxr_linenumber" name="842" href="#842">842</a>           job.getMapOutputValueClass(),
+<a class="jxr_linenumber" name="843" href="#843">843</a>           job.getInputFormatClass(),
+<a class="jxr_linenumber" name="844" href="#844">844</a>           job.getOutputKeyClass(),
+<a class="jxr_linenumber" name="845" href="#845">845</a>           job.getOutputValueClass(),
+<a class="jxr_linenumber" name="846" href="#846">846</a>           job.getOutputFormatClass(),
+<a class="jxr_linenumber" name="847" href="#847">847</a>           job.getPartitionerClass(),
+<a class="jxr_linenumber" name="848" href="#848">848</a>           job.getCombinerClass());
+<a class="jxr_linenumber" name="849" href="#849">849</a>     } <strong class="jxr_keyword">catch</strong> (ClassNotFoundException e) {
+<a class="jxr_linenumber" name="850" href="#850">850</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(e);
+<a class="jxr_linenumber" name="851" href="#851">851</a>     }
+<a class="jxr_linenumber" name="852" href="#852">852</a>   }
+<a class="jxr_linenumber" name="853" href="#853">853</a> 
+<a class="jxr_linenumber" name="854" href="#854">854</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="855" href="#855">855</a> <em class="jxr_javadoccomment">   * Add the jars containing the given classes to the job's configuration</em>
+<a class="jxr_linenumber" name="856" href="#856">856</a> <em class="jxr_javadoccomment">   * such that JobClient will ship them to the cluster and add them to</em>
+<a class="jxr_linenumber" name="857" href="#857">857</a> <em class="jxr_javadoccomment">   * the DistributedCache.</em>
+<a class="jxr_linenumber" name="858" href="#858">858</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="859" href="#859">859</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> addDependencyJars(Configuration conf,
+<a class="jxr_linenumber" name="860" href="#860">860</a>       Class&lt;?&gt;... classes) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="861" href="#861">861</a> 
+<a class="jxr_linenumber" name="862" href="#862">862</a>     FileSystem localFs = FileSystem.getLocal(conf);
+<a class="jxr_linenumber" name="863" href="#863">863</a>     Set&lt;String&gt; jars = <strong class="jxr_keyword">new</strong> HashSet&lt;String&gt;();
+<a class="jxr_linenumber" name="864" href="#864">864</a>     <em class="jxr_comment">// Add jars that are already in the tmpjars variable</em>
+<a class="jxr_linenumber" name="865" href="#865">865</a>     jars.addAll(conf.getStringCollection(<span class="jxr_string">"tmpjars"</span>));
+<a class="jxr_linenumber" name="866" href="#866">866</a> 
+<a class="jxr_linenumber" name="867" href="#867">867</a>     <em class="jxr_comment">// add jars as we find them to a map of contents jar name so that we can avoid</em>
+<a class="jxr_linenumber" name="868" href="#868">868</a>     <em class="jxr_comment">// creating new jars for classes that have already been packaged.</em>
+<a class="jxr_linenumber" name="869" href="#869">869</a>     Map&lt;String, String&gt; packagedClasses = <strong class="jxr_keyword">new</strong> HashMap&lt;String, String&gt;();
+<a class="jxr_linenumber" name="870" href="#870">870</a> 
+<a class="jxr_linenumber" name="871" href="#871">871</a>     <em class="jxr_comment">// Add jars containing the specified classes</em>
+<a class="jxr_linenumber" name="872" href="#872">872</a>     <strong class="jxr_keyword">for</strong> (Class&lt;?&gt; clazz : classes) {
+<a class="jxr_linenumber" name="873" href="#873">873</a>       <strong class="jxr_keyword">if</strong> (clazz == <strong class="jxr_keyword">null</strong>) <strong class="jxr_keyword">continue</strong>;
+<a class="jxr_linenumber" name="874" href="#874">874</a> 
+<a class="jxr_linenumber" name="875" href="#875">875</a>       Path path = findOrCreateJar(clazz, localFs, packagedClasses);
+<a class="jxr_linenumber" name="876" href="#876">876</a>       <strong class="jxr_keyword">if</strong> (path == <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="877" href="#877">877</a>         LOG.warn(<span class="jxr_string">"Could not find jar for class "</span> + clazz +
+<a class="jxr_linenumber" name="878" href="#878">878</a>                  <span class="jxr_string">" in order to ship it to the cluster."</span>);
+<a class="jxr_linenumber" name="879" href="#879">879</a>         <strong class="jxr_keyword">continue</strong>;
+<a class="jxr_linenumber" name="880" href="#880">880</a>       }
+<a class="jxr_linenumber" name="881" href="#881">881</a>       <strong class="jxr_keyword">if</strong> (!localFs.exists(path)) {
+<a class="jxr_linenumber" name="882" href="#882">882</a>         LOG.warn(<span class="jxr_string">"Could not validate jar file "</span> + path + <span class="jxr_string">" for class "</span>
+<a class="jxr_linenumber" name="883" href="#883">883</a>                  + clazz);
+<a class="jxr_linenumber" name="884" href="#884">884</a>         <strong class="jxr_keyword">continue</strong>;
+<a class="jxr_linenumber" name="885" href="#885">885</a>       }
+<a class="jxr_linenumber" name="886" href="#886">886</a>       jars.add(path.toString());
+<a class="jxr_linenumber" name="887" href="#887">887</a>     }
+<a class="jxr_linenumber" name="888" href="#888">888</a>     <strong class="jxr_keyword">if</strong> (jars.isEmpty()) <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="889" href="#889">889</a> 
+<a class="jxr_linenumber" name="890" href="#890">890</a>     conf.set(<span class="jxr_string">"tmpjars"</span>, StringUtils.arrayToString(jars.toArray(<strong class="jxr_keyword">new</strong> String[jars.size()])));
+<a class="jxr_linenumber" name="891" href="#891">891</a>   }
+<a class="jxr_linenumber" name="892" href="#892">892</a> 
+<a class="jxr_linenumber" name="893" href="#893">893</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="894" href="#894">894</a> <em class="jxr_javadoccomment">   * Finds the Jar for a class or creates it if it doesn't exist. If the class is in</em>
+<a class="jxr_linenumber" name="895" href="#895">895</a> <em class="jxr_javadoccomment">   * a directory in the classpath, it creates a Jar on the fly with the</em>
+<a class="jxr_linenumber" name="896" href="#896">896</a> <em class="jxr_javadoccomment">   * contents of the directory and returns the path to that Jar. If a Jar is</em>
+<a class="jxr_linenumber" name="897" href="#897">897</a> <em class="jxr_javadoccomment">   * created, it is created in the system temporary directory. Otherwise,</em>
+<a class="jxr_linenumber" name="898" href="#898">898</a> <em class="jxr_javadoccomment">   * returns an existing jar that contains a class of the same name. Maintains</em>
+<a class="jxr_linenumber" name="899" href="#899">899</a> <em class="jxr_javadoccomment">   * a mapping from jar contents to the tmp jar created.</em>
+<a class="jxr_linenumber" name="900" href="#900">900</a> <em class="jxr_javadoccomment">   * @param my_class the class to find.</em>
+<a class="jxr_linenumber" name="901" href="#901">901</a> <em class="jxr_javadoccomment">   * @param fs the FileSystem with which to qualify the returned path.</em>
+<a class="jxr_linenumber" name="902" href="#902">902</a> <em class="jxr_javadoccomment">   * @param packagedClasses a map of class name to path.</em>
+<a class="jxr_linenumber" name="903" href="#903">903</a> <em class="jxr_javadoccomment">   * @return a jar file that contains the class.</em>
+<a class="jxr_linenumber" name="904" href="#904">904</a> <em class="jxr_javadoccomment">   * @throws IOException</em>
+<a class="jxr_linenumber" name="905" href="#905">905</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="906" href="#906">906</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> Path findOrCreateJar(Class&lt;?&gt; my_<strong class="jxr_keyword">class</strong>, FileSystem fs,
+<a class="jxr_linenumber" name="907" href="#907">907</a>       Map&lt;String, String&gt; packagedClasses)
+<a class="jxr_linenumber" name="908" href="#908">908</a>   <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="909" href="#909">909</a>     <em class="jxr_comment">// attempt to locate an existing jar for the class.</em>
+<a class="jxr_linenumber" name="910" href="#910">910</a>     String jar = findContainingJar(my_<strong class="jxr_keyword">class</strong>, packagedClasses);
+<a class="jxr_linenumber" name="911" href="#911">911</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == jar || jar.isEmpty()) {
+<a class="jxr_linenumber" name="912" href="#912">912</a>       jar = getJar(my_<strong class="jxr_keyword">class</strong>);
+<a class="jxr_linenumber" name="913" href="#913">913</a>       updateMap(jar, packagedClasses);
+<a class="jxr_linenumber" name="914" href="#914">914</a>     }
+<a class="jxr_linenumber" name="915" href="#915">915</a> 
+<a class="jxr_linenumber" name="916" href="#916">916</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == jar || jar.isEmpty()) {
+<a class="jxr_linenumber" name="917" href="#917">917</a>       <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="918" href="#918">918</a>     }
+<a class="jxr_linenumber" name="919" href="#919">919</a> 
+<a class="jxr_linenumber" name="920" href="#920">920</a>     LOG.debug(String.format(<span class="jxr_string">"For class %s, using jar %s"</span>, my_<strong class="jxr_keyword">class</strong>.getName(), jar));
+<a class="jxr_linenumber" name="921" href="#921">921</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> Path(jar).makeQualified(fs);
+<a class="jxr_linenumber" name="922" href="#922">922</a>   }
+<a class="jxr_linenumber" name="923" href="#923">923</a> 
+<a class="jxr_linenumber" name="924" href="#924">924</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="925" href="#925">925</a> <em class="jxr_javadoccomment">   * Add entries to &lt;code&gt;packagedClasses&lt;/code&gt; corresponding to class files</em>
+<a class="jxr_linenumber" name="926" href="#926">926</a> <em class="jxr_javadoccomment">   * contained in &lt;code&gt;jar&lt;/code&gt;.</em>
+<a class="jxr_linenumber" name="927" href="#927">927</a> <em class="jxr_javadoccomment">   * @param jar The jar who's content to list.</em>
+<a class="jxr_linenumber" name="928" href="#928">928</a> <em class="jxr_javadoccomment">   * @param packagedClasses map[class -&gt; jar]</em>
+<a class="jxr_linenumber" name="929" href="#929">929</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="930" href="#930">930</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> updateMap(String jar, Map&lt;String, String&gt; packagedClasses) <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="931" href="#931">931</a>     <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> == jar || jar.isEmpty()) {
+<a class="jxr_linenumber" name="932" href="#932">932</a>       <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="933" href="#933">933</a>     }
+<a class="jxr_linenumber" name="934" href="#934">934</a>     ZipFile zip = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="935" href="#935">935</a>     <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="936" href="#936">936</a>       zip = <strong class="jxr_keyword">new</strong> ZipFile(jar);
+<a class="jxr_linenumber" name="937" href="#937">937</a>       <strong class="jxr_keyword">for</strong> (Enumeration&lt;? <strong class="jxr_keyword">extends</strong> ZipEntry&gt; iter = zip.entries(); iter.hasMoreElements();) {
+<a class="jxr_linenumber" name="938" href="#938">938</a>         ZipEntry entry = iter.nextElement();
+<a class="jxr_linenumber" name="939" href="#939">939</a>         <strong class="jxr_keyword">if</strong> (entry.getName().endsWith(<span class="jxr_string">"class"</span>)) {
+<a class="jxr_linenumber" name="940" href="#940">940</a>           packagedClasses.put(entry.getName(), jar);
+<a class="jxr_linenumber" name="941" href="#941">941</a>         }
+<a class="jxr_linenumber" name="942" href="#942">942</a>       }
+<a class="jxr_linenumber" name="943" href="#943">943</a>     } <strong class="jxr_keyword">finally</strong> {
+<a class="jxr_linenumber" name="944" href="#944">944</a>       <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">null</strong> != zip) zip.close();
+<a class="jxr_linenumber" name="945" href="#945">945</a>     }
+<a class="jxr_linenumber" name="946" href="#946">946</a>   }
+<a class="jxr_linenumber" name="947" href="#947">947</a> 
+<a class="jxr_linenumber" name="948" href="#948">948</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="949" href="#949">949</a> <em class="jxr_javadoccomment">   * Find a jar that contains a class of the same name, if any. It will return</em>
+<a class="jxr_linenumber" name="950" href="#950">950</a> <em class="jxr_javadoccomment">   * a jar file, even if that is not the first thing on the class path that</em>
+<a class="jxr_linenumber" name="951" href="#951">951</a> <em class="jxr_javadoccomment">   * has a class with the same name. Looks first on the classpath and then in</em>
+<a class="jxr_linenumber" name="952" href="#952">952</a> <em class="jxr_javadoccomment">   * the &lt;code&gt;packagedClasses&lt;/code&gt; map.</em>
+<a class="jxr_linenumber" name="953" href="#953">953</a> <em class="jxr_javadoccomment">   * @param my_class the class to find.</em>
+<a class="jxr_linenumber" name="954" href="#954">954</a> <em class="jxr_javadoccomment">   * @return a jar file that contains the class, or null.</em>
+<a class="jxr_linenumber" name="955" href="#955">955</a> <em class="jxr_javadoccomment">   * @throws IOException</em>
+<a class="jxr_linenumber" name="956" href="#956">956</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="957" href="#957">957</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> String findContainingJar(Class&lt;?&gt; my_<strong class="jxr_keyword">class</strong>, Map&lt;String, String&gt; packagedClasses)
+<a class="jxr_linenumber" name="958" href="#958">958</a>       <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="959" href="#959">959</a>     ClassLoader loader = my_<strong class="jxr_keyword">class</strong>.getClassLoader();
+<a class="jxr_linenumber" name="960" href="#960">960</a> 
+<a class="jxr_linenumber" name="961" href="#961">961</a>     String <strong class="jxr_keyword">class</strong>_file = my_<strong class="jxr_keyword">class</strong>.getName().replaceAll(<span class="jxr_string">"&#92;&#92;."</span>, <span class="jxr_string">"/"</span>) + <span class="jxr_string">".class"</span>;
+<a class="jxr_linenumber" name="962" href="#962">962</a> 
+<a class="jxr_linenumber" name="963" href="#963">963</a>     <strong class="jxr_keyword">if</strong> (loader != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="964" href="#964">964</a>       <em class="jxr_comment">// first search the classpath</em>
+<a class="jxr_linenumber" name="965" href="#965">965</a>       <strong class="jxr_keyword">for</strong> (Enumeration&lt;URL&gt; itr = loader.getResources(<strong class="jxr_keyword">class</strong>_file); itr.hasMoreElements();) {
+<a class="jxr_linenumber" name="966" href="#966">966</a>         URL url = itr.nextElement();
+<a class="jxr_linenumber" name="967" href="#967">967</a>         <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"jar"</span>.equals(url.getProtocol())) {
+<a class="jxr_linenumber" name="968" href="#968">968</a>           String toReturn = url.getPath();
+<a class="jxr_linenumber" name="969" href="#969">969</a>           <strong class="jxr_keyword">if</strong> (toReturn.startsWith(<span class="jxr_string">"file:"</span>)) {
+<a class="jxr_linenumber" name="970" href="#970">970</a>             toReturn = toReturn.substring(<span class="jxr_string">"file:"</span>.length());
+<a class="jxr_linenumber" name="971" href="#971">971</a>           }
+<a class="jxr_linenumber" name="972" href="#972">972</a>           <em class="jxr_comment">// URLDecoder is a misnamed class, since it actually decodes</em>
+<a class="jxr_linenumber" name="973" href="#973">973</a>           <em class="jxr_comment">// x-www-form-urlencoded MIME type rather than actual</em>
+<a class="jxr_linenumber" name="974" href="#974">974</a>           <em class="jxr_comment">// URL encoding (which the file path has). Therefore it would</em>
+<a class="jxr_linenumber" name="975" href="#975">975</a>           <em class="jxr_comment">// decode +s to ' 's which is incorrect (spaces are actually</em>
+<a class="jxr_linenumber" name="976" href="#976">976</a>           <em class="jxr_comment">// either unencoded or encoded as "%20"). Replace +s first, so</em>
+<a class="jxr_linenumber" name="977" href="#977">977</a>           <em class="jxr_comment">// that they are kept sacred during the decoding process.</em>
+<a class="jxr_linenumber" name="978" href="#978">978</a>           toReturn = toReturn.replaceAll(<span class="jxr_string">"&#92;&#92;+"</span>, <span class="jxr_string">"%2B"</span>);
+<a class="jxr_linenumber" name="979" href="#979">979</a>           toReturn = URLDecoder.decode(toReturn, <span class="jxr_string">"UTF-8"</span>);
+<a class="jxr_linenumber" name="980" href="#980">980</a>           <strong class="jxr_keyword">return</strong> toReturn.replaceAll(<span class="jxr_string">"!.*$"</span>, <span class="jxr_string">""</span>);
+<a class="jxr_linenumber" name="981" href="#981">981</a>         }
+<a class="jxr_linenumber" name="982" href="#982">982</a>       }
+<a class="jxr_linenumber" name="983" href="#983">983</a>     }
+<a class="jxr_linenumber" name="984" href="#984">984</a> 
+<a class="jxr_linenumber" name="985" href="#985">985</a>     <em class="jxr_comment">// now look in any jars we've packaged using JarFinder. Returns null when</em>
+<a class="jxr_linenumber" name="986" href="#986">986</a>     <em class="jxr_comment">// no jar is found.</em>
+<a class="jxr_linenumber" name="987" href="#987">987</a>     <strong class="jxr_keyword">return</strong> packagedClasses.get(<strong class="jxr_keyword">class</strong>_file);
+<a class="jxr_linenumber" name="988" href="#988">988</a>   }
 <a class="jxr_linenumber" name="989" href="#989">989</a> 
-<a class="jxr_linenumber" name="990" href="#990">990</a>     <strong class="jxr_keyword">return</strong> ret;
-<a class="jxr_linenumber" name="991" href="#991">991</a>   }
-<a class="jxr_linenumber" name="992" href="#992">992</a> }
+<a class="jxr_linenumber" name="990" href="#990">990</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="991" href="#991">991</a> <em class="jxr_javadoccomment">   * Invoke 'getJar' on a custom JarFinder implementation. Useful for some job</em>
+<a class="jxr_linenumber" name="992" href="#992">992</a> <em class="jxr_javadoccomment">   * configuration contexts (HBASE-8140) and also for testing on MRv2.</em>
+<a class="jxr_linenumber" name="993" href="#993">993</a> <em class="jxr_javadoccomment">   * check if we have HADOOP-9426.</em>
+<a class="jxr_linenumber" name="994" href="#994">994</a> <em class="jxr_javadoccomment">   * @param my_class the class to find.</em>
+<a class="jxr_linenumber" name="995" href="#995">995</a> <em class="jxr_javadoccomment">   * @return a jar file that contains the class, or null.</em>
+<a class="jxr_linenumber" name="996" href="#996">996</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="997" href="#997">997</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> String getJar(Class&lt;?&gt; my_<strong class="jxr_keyword">class</strong>) {
+<a class="jxr_linenumber" name="998" href="#998">998</a>     String ret = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="999" href="#999">999</a>     <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="1000" href="#1000">1000</a>       ret = JarFinder.getJar(my_<strong class="jxr_keyword">class</strong>);
+<a class="jxr_linenumber" name="1001" href="#1001">1001</a>     } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a class="jxr_linenumber" name="1002" href="#1002">1002</a>       <em class="jxr_comment">// toss all other exceptions, related to reflection failure</em>
+<a class="jxr_linenumber" name="1003" href="#1003">1003</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> RuntimeException(<span class="jxr_string">"getJar invocation failed."</span>, e);
+<a class="jxr_linenumber" name="1004" href="#1004">1004</a>     }
+<a class="jxr_linenumber" name="1005" href="#1005">1005</a> 
+<a class="jxr_linenumber" name="1006" href="#1006">1006</a>     <strong class="jxr_keyword">return</strong> ret;
+<a class="jxr_linenumber" name="1007" href="#1007">1007</a>   }
+<a class="jxr_linenumber" name="1008" href="#1008">1008</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/29e33858/xref/org/apache/hadoop/hbase/regionserver/StoreScanner.html
----------------------------------------------------------------------
diff --git a/xref/org/apache/hadoop/hbase/regionserver/StoreScanner.html b/xref/org/apache/hadoop/hbase/regionserver/StoreScanner.html
index e35c016..4039782 100644
--- a/xref/org/apache/hadoop/hbase/regionserver/StoreScanner.html
+++ b/xref/org/apache/hadoop/hbase/regionserver/StoreScanner.html
@@ -74,7 +74,7 @@
 <a class="jxr_linenumber" name="64" href="#64">64</a>    <strong class="jxr_keyword">protected</strong> <a href="../../../../../org/apache/hadoop/hbase/regionserver/KeyValueHeap.html">KeyValueHeap</a> heap;
 <a class="jxr_linenumber" name="65" href="#65">65</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">boolean</strong> cacheBlocks;
 <a class="jxr_linenumber" name="66" href="#66">66</a>  
-<a class="jxr_linenumber" name="67" href="#67">67</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">int</strong> countPerRow = 0;
+<a class="jxr_linenumber" name="67" href="#67">67</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">long</strong> countPerRow = 0;
 <a class="jxr_linenumber" name="68" href="#68">68</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">int</strong> storeLimit = -1;
 <a class="jxr_linenumber" name="69" href="#69">69</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">int</strong> storeOffset = 0;
 <a class="jxr_linenumber" name="70" href="#70">70</a>  

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/29e33858/xref/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.html
----------------------------------------------------------------------
diff --git a/xref/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.html b/xref/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.html
index 2c381b8..76304cf 100644
--- a/xref/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.html
+++ b/xref/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.html
@@ -295,79 +295,80 @@
 <a class="jxr_linenumber" name="285" href="#285">285</a>     }
 <a class="jxr_linenumber" name="286" href="#286">286</a>   }
 <a class="jxr_linenumber" name="287" href="#287">287</a> 
-<a class="jxr_linenumber" name="288" href="#288">288</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> SecretKey createSecretKey(byte[] raw) {
-<a class="jxr_linenumber" name="289" href="#289">289</a>     <strong class="jxr_keyword">return</strong> SecretManager.createSecretKey(raw);
+<a class="jxr_linenumber" name="288" href="#288">288</a>   <strong class="jxr_keyword">synchronized</strong> <strong class="jxr_keyword">long</strong> getLastKeyUpdate() {
+<a class="jxr_linenumber" name="289" href="#289">289</a>     <strong class="jxr_keyword">return</strong> lastKeyUpdate;
 <a class="jxr_linenumber" name="290" href="#290">290</a>   }
 <a class="jxr_linenumber" name="291" href="#291">291</a> 
-<a class="jxr_linenumber" name="292" href="#292">292</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.html">LeaderElector</a> <strong class="jxr_keyword">extends</strong> Thread <strong class="jxr_keyword">implements</strong> <a href="../../../../../../org/apache/hadoop/hbase/Stoppable.html">Stoppable</a> {
-<a class="jxr_linenumber" name="293" href="#293">293</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> stopped = false;
-<a class="jxr_linenumber" name="294" href="#294">294</a>     <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> Flag indicating whether we're in charge of rolling/expiring keys */</em>
-<a class="jxr_linenumber" name="295" href="#295">295</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> isMaster = false;
-<a class="jxr_linenumber" name="296" href="#296">296</a>     <strong class="jxr_keyword">private</strong> <a href="../../../../../../org/apache/hadoop/hbase/zookeeper/ZKLeaderManager.html">ZKLeaderManager</a> zkLeader;
-<a class="jxr_linenumber" name="297" href="#297">297</a> 
-<a class="jxr_linenumber" name="298" href="#298">298</a>     <strong class="jxr_keyword">public</strong> <a href="../../../../../../org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.html">LeaderElector</a>(<a href="../../../../../../org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.html">ZooKeeperWatcher</a> watcher, String serverName) {
-<a class="jxr_linenumber" name="299" href="#299">299</a>       setDaemon(<strong class="jxr_keyword">true</strong>);
-<a class="jxr_linenumber" name="300" href="#300">300</a>       setName(<span class="jxr_string">"ZKSecretWatcher-leaderElector"</span>);
-<a class="jxr_linenumber" name="301" href="#301">301</a>       zkLeader = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/zookeeper/ZKLeaderManager.html">ZKLeaderManager</a>(watcher,
-<a class="jxr_linenumber" name="302" href="#302">302</a>           ZKUtil.joinZNode(zkWatcher.getRootKeyZNode(), <span class="jxr_string">"keymaster"</span>),
-<a class="jxr_linenumber" name="303" href="#303">303</a>           Bytes.toBytes(serverName), <strong class="jxr_keyword">this</strong>);
-<a class="jxr_linenumber" name="304" href="#304">304</a>     }
-<a class="jxr_linenumber" name="305" href="#305">305</a> 
-<a class="jxr_linenumber" name="306" href="#306">306</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> isMaster() {
-<a class="jxr_linenumber" name="307" href="#307">307</a>       <strong class="jxr_keyword">return</strong> isMaster;
+<a class="jxr_linenumber" name="292" href="#292">292</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> SecretKey createSecretKey(byte[] raw) {
+<a class="jxr_linenumber" name="293" href="#293">293</a>     <strong class="jxr_keyword">return</strong> SecretManager.createSecretKey(raw);
+<a class="jxr_linenumber" name="294" href="#294">294</a>   }
+<a class="jxr_linenumber" name="295" href="#295">295</a> 
+<a class="jxr_linenumber" name="296" href="#296">296</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.html">LeaderElector</a> <strong class="jxr_keyword">extends</strong> Thread <strong class="jxr_keyword">implements</strong> <a href="../../../../../../org/apache/hadoop/hbase/Stoppable.html">Stoppable</a> {
+<a class="jxr_linenumber" name="297" href="#297">297</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> stopped = false;
+<a class="jxr_linenumber" name="298" href="#298">298</a>     <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> Flag indicating whether we're in charge of rolling/expiring keys */</em>
+<a class="jxr_linenumber" name="299" href="#299">299</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> isMaster = false;
+<a class="jxr_linenumber" name="300" href="#300">300</a>     <strong class="jxr_keyword">private</strong> <a href="../../../../../../org/apache/hadoop/hbase/zookeeper/ZKLeaderManager.html">ZKLeaderManager</a> zkLeader;
+<a class="jxr_linenumber" name="301" href="#301">301</a> 
+<a class="jxr_linenumber" name="302" href="#302">302</a>     <strong class="jxr_keyword">public</strong> <a href="../../../../../../org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.html">LeaderElector</a>(<a href="../../../../../../org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.html">ZooKeeperWatcher</a> watcher, String serverName) {
+<a class="jxr_linenumber" name="303" href="#303">303</a>       setDaemon(<strong class="jxr_keyword">true</strong>);
+<a class="jxr_linenumber" name="304" href="#304">304</a>       setName(<span class="jxr_string">"ZKSecretWatcher-leaderElector"</span>);
+<a class="jxr_linenumber" name="305" href="#305">305</a>       zkLeader = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/zookeeper/ZKLeaderManager.html">ZKLeaderManager</a>(watcher,
+<a class="jxr_linenumber" name="306" href="#306">306</a>           ZKUtil.joinZNode(zkWatcher.getRootKeyZNode(), <span class="jxr_string">"keymaster"</span>),
+<a class="jxr_linenumber" name="307" href="#307">307</a>           Bytes.toBytes(serverName), <strong class="jxr_keyword">this</strong>);
 <a class="jxr_linenumber" name="308" href="#308">308</a>     }
 <a class="jxr_linenumber" name="309" href="#309">309</a> 
-<a class="jxr_linenumber" name="310" href="#310">310</a>     @Override
-<a class="jxr_linenumber" name="311" href="#311">311</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> isStopped() {
-<a class="jxr_linenumber" name="312" href="#312">312</a>       <strong class="jxr_keyword">return</strong> stopped;
-<a class="jxr_linenumber" name="313" href="#313">313</a>     }
-<a class="jxr_linenumber" name="314" href="#314">314</a> 
-<a class="jxr_linenumber" name="315" href="#315">315</a>     @Override
-<a class="jxr_linenumber" name="316" href="#316">316</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> stop(String reason) {
-<a class="jxr_linenumber" name="317" href="#317">317</a>       <strong class="jxr_keyword">if</strong> (stopped) {
-<a class="jxr_linenumber" name="318" href="#318">318</a>         <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="319" href="#319">319</a>       }
-<a class="jxr_linenumber" name="320" href="#320">320</a> 
-<a class="jxr_linenumber" name="321" href="#321">321</a>       stopped = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="322" href="#322">322</a>       <em class="jxr_comment">// prevent further key generation when stopping</em>
-<a class="jxr_linenumber" name="323" href="#323">323</a>       <strong class="jxr_keyword">if</strong> (isMaster) {
-<a class="jxr_linenumber" name="324" href="#324">324</a>         zkLeader.stepDownAsLeader();
-<a class="jxr_linenumber" name="325" href="#325">325</a>       }
-<a class="jxr_linenumber" name="326" href="#326">326</a>       isMaster = false;
-<a class="jxr_linenumber" name="327" href="#327">327</a>       LOG.info(<span class="jxr_string">"Stopping leader election, because: "</span>+reason);
-<a class="jxr_linenumber" name="328" href="#328">328</a>       interrupt();
-<a class="jxr_linenumber" name="329" href="#329">329</a>     }
-<a class="jxr_linenumber" name="330" href="#330">330</a> 
-<a class="jxr_linenumber" name="331" href="#331">331</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> run() {
-<a class="jxr_linenumber" name="332" href="#332">332</a>       zkLeader.start();
-<a class="jxr_linenumber" name="333" href="#333">333</a>       zkLeader.waitToBecomeLeader();
-<a class="jxr_linenumber" name="334" href="#334">334</a>       isMaster = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="335" href="#335">335</a> 
-<a class="jxr_linenumber" name="336" href="#336">336</a>       <strong class="jxr_keyword">while</strong> (!stopped) {
-<a class="jxr_linenumber" name="337" href="#337">337</a>         <strong class="jxr_keyword">long</strong> now = EnvironmentEdgeManager.currentTime();
-<a class="jxr_linenumber" name="338" href="#338">338</a> 
-<a class="jxr_linenumber" name="339" href="#339">339</a>         <em class="jxr_comment">// clear any expired</em>
-<a class="jxr_linenumber" name="340" href="#340">340</a>         removeExpiredKeys();
-<a class="jxr_linenumber" name="341" href="#341">341</a>         <strong class="jxr_keyword">long</strong> localLastKeyUpdate;
-<a class="jxr_linenumber" name="342" href="#342">342</a>         <strong class="jxr_keyword">synchronized</strong> (<strong class="jxr_keyword">this</strong>) {
-<a class="jxr_linenumber" name="343" href="#343">343</a>           localLastKeyUpdate = lastKeyUpdate;
-<a class="jxr_linenumber" name="344" href="#344">344</a>         }
-<a class="jxr_linenumber" name="345" href="#345">345</a>         <strong class="jxr_keyword">if</strong> (localLastKeyUpdate + keyUpdateInterval &lt; now) {
-<a class="jxr_linenumber" name="346" href="#346">346</a>           <em class="jxr_comment">// roll a new master key</em>
-<a class="jxr_linenumber" name="347" href="#347">347</a>           rollCurrentKey();
-<a class="jxr_linenumber" name="348" href="#348">348</a>         }
-<a class="jxr_linenumber" name="349" href="#349">349</a> 
-<a class="jxr_linenumber" name="350" href="#350">350</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="351" href="#351">351</a>           Thread.sleep(5000);
-<a class="jxr_linenumber" name="352" href="#352">352</a>         } <strong class="jxr_keyword">catch</strong> (InterruptedException ie) {
-<a class="jxr_linenumber" name="353" href="#353">353</a>           <strong class="jxr_keyword">if</strong> (LOG.isDebugEnabled()) {
-<a class="jxr_linenumber" name="354" href="#354">354</a>             LOG.debug(<span class="jxr_string">"Interrupted waiting for next update"</span>, ie);
-<a class="jxr_linenumber" name="355" href="#355">355</a>           }
-<a class="jxr_linenumber" name="356" href="#356">356</a>         }
-<a class="jxr_linenumber" name="357" href="#357">357</a>       }
-<a class="jxr_linenumber" name="358" href="#358">358</a>     }
-<a class="jxr_linenumber" name="359" href="#359">359</a>   }
-<a class="jxr_linenumber" name="360" href="#360">360</a> }
+<a class="jxr_linenumber" name="310" href="#310">310</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> isMaster() {
+<a class="jxr_linenumber" name="311" href="#311">311</a>       <strong class="jxr_keyword">return</strong> isMaster;
+<a class="jxr_linenumber" name="312" href="#312">312</a>     }
+<a class="jxr_linenumber" name="313" href="#313">313</a> 
+<a class="jxr_linenumber" name="314" href="#314">314</a>     @Override
+<a class="jxr_linenumber" name="315" href="#315">315</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> isStopped() {
+<a class="jxr_linenumber" name="316" href="#316">316</a>       <strong class="jxr_keyword">return</strong> stopped;
+<a class="jxr_linenumber" name="317" href="#317">317</a>     }
+<a class="jxr_linenumber" name="318" href="#318">318</a> 
+<a class="jxr_linenumber" name="319" href="#319">319</a>     @Override
+<a class="jxr_linenumber" name="320" href="#320">320</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> stop(String reason) {
+<a class="jxr_linenumber" name="321" href="#321">321</a>       <strong class="jxr_keyword">if</strong> (stopped) {
+<a class="jxr_linenumber" name="322" href="#322">322</a>         <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="323" href="#323">323</a>       }
+<a class="jxr_linenumber" name="324" href="#324">324</a> 
+<a class="jxr_linenumber" name="325" href="#325">325</a>       stopped = <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="326" href="#326">326</a>       <em class="jxr_comment">// prevent further key generation when stopping</em>
+<a class="jxr_linenumber" name="327" href="#327">327</a>       <strong class="jxr_keyword">if</strong> (isMaster) {
+<a class="jxr_linenumber" name="328" href="#328">328</a>         zkLeader.stepDownAsLeader();
+<a class="jxr_linenumber" name="329" href="#329">329</a>       }
+<a class="jxr_linenumber" name="330" href="#330">330</a>       isMaster = false;
+<a class="jxr_linenumber" name="331" href="#331">331</a>       LOG.info(<span class="jxr_string">"Stopping leader election, because: "</span>+reason);
+<a class="jxr_linenumber" name="332" href="#332">332</a>       interrupt();
+<a class="jxr_linenumber" name="333" href="#333">333</a>     }
+<a class="jxr_linenumber" name="334" href="#334">334</a> 
+<a class="jxr_linenumber" name="335" href="#335">335</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> run() {
+<a class="jxr_linenumber" name="336" href="#336">336</a>       zkLeader.start();
+<a class="jxr_linenumber" name="337" href="#337">337</a>       zkLeader.waitToBecomeLeader();
+<a class="jxr_linenumber" name="338" href="#338">338</a>       isMaster = <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="339" href="#339">339</a> 
+<a class="jxr_linenumber" name="340" href="#340">340</a>       <strong class="jxr_keyword">while</strong> (!stopped) {
+<a class="jxr_linenumber" name="341" href="#341">341</a>         <strong class="jxr_keyword">long</strong> now = EnvironmentEdgeManager.currentTime();
+<a class="jxr_linenumber" name="342" href="#342">342</a> 
+<a class="jxr_linenumber" name="343" href="#343">343</a>         <em class="jxr_comment">// clear any expired</em>
+<a class="jxr_linenumber" name="344" href="#344">344</a>         removeExpiredKeys();
+<a class="jxr_linenumber" name="345" href="#345">345</a>         <strong class="jxr_keyword">long</strong> localLastKeyUpdate = getLastKeyUpdate();
+<a class="jxr_linenumber" name="346" href="#346">346</a>         <strong class="jxr_keyword">if</strong> (localLastKeyUpdate + keyUpdateInterval &lt; now) {
+<a class="jxr_linenumber" name="347" href="#347">347</a>           <em class="jxr_comment">// roll a new master key</em>
+<a class="jxr_linenumber" name="348" href="#348">348</a>           rollCurrentKey();
+<a class="jxr_linenumber" name="349" href="#349">349</a>         }
+<a class="jxr_linenumber" name="350" href="#350">350</a> 
+<a class="jxr_linenumber" name="351" href="#351">351</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="352" href="#352">352</a>           Thread.sleep(5000);
+<a class="jxr_linenumber" name="353" href="#353">353</a>         } <strong class="jxr_keyword">catch</strong> (InterruptedException ie) {
+<a class="jxr_linenumber" name="354" href="#354">354</a>           <strong class="jxr_keyword">if</strong> (LOG.isDebugEnabled()) {
+<a class="jxr_linenumber" name="355" href="#355">355</a>             LOG.debug(<span class="jxr_string">"Interrupted waiting for next update"</span>, ie);
+<a class="jxr_linenumber" name="356" href="#356">356</a>           }
+<a class="jxr_linenumber" name="357" href="#357">357</a>         }
+<a class="jxr_linenumber" name="358" href="#358">358</a>       }
+<a class="jxr_linenumber" name="359" href="#359">359</a>     }
+<a class="jxr_linenumber" name="360" href="#360">360</a>   }
+<a class="jxr_linenumber" name="361" href="#361">361</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>


Mime
View raw message