helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1415977 [14/14] - in /incubator/helix/site-content: ./ apidocs/reference/org/apache/helix/participant/ helix-admin-webapp/ helix-core/ involved/ mockservice/ xref-test/ xref-test/org/apache/helix/integration/ xref-test/org/apache/helix/mes...
Date Sat, 01 Dec 2012 11:21:28 GMT
Modified: incubator/helix/site-content/xref/org/apache/helix/model/IdealState.html
URL: http://svn.apache.org/viewvc/incubator/helix/site-content/xref/org/apache/helix/model/IdealState.html?rev=1415977&r1=1415976&r2=1415977&view=diff
==============================================================================
--- incubator/helix/site-content/xref/org/apache/helix/model/IdealState.html (original)
+++ incubator/helix/site-content/xref/org/apache/helix/model/IdealState.html Sat Dec  1 11:21:14 2012
@@ -236,7 +236,7 @@
 <a class="jxr_linenumber" name="226" href="#226">226</a>               .getListField(firstPartition).size());
 <a class="jxr_linenumber" name="227" href="#227">227</a>         }
 <a class="jxr_linenumber" name="228" href="#228">228</a>         logger
-<a class="jxr_linenumber" name="229" href="#229">229</a>             .warn(<span class="jxr_string">"could NOT found replicas in idealState. Use size of the first list instead. replica: "</span>
+<a class="jxr_linenumber" name="229" href="#229">229</a>             .warn(<span class="jxr_string">"could NOT find number of replicas in idealState. Use size of the first list instead. replica: "</span>
 <a class="jxr_linenumber" name="230" href="#230">230</a>                 + replica + <span class="jxr_string">", 1st partition: "</span> + firstPartition);
 <a class="jxr_linenumber" name="231" href="#231">231</a>         <strong class="jxr_keyword">break</strong>;
 <a class="jxr_linenumber" name="232" href="#232">232</a>       <strong class="jxr_keyword">case</strong> CUSTOMIZED:
@@ -251,7 +251,7 @@
 <a class="jxr_linenumber" name="241" href="#241">241</a>               .getMapField(firstPartition).size());
 <a class="jxr_linenumber" name="242" href="#242">242</a>         }
 <a class="jxr_linenumber" name="243" href="#243">243</a>         logger
-<a class="jxr_linenumber" name="244" href="#244">244</a>             .warn(<span class="jxr_string">"could NOT found replicas in idealState. Use size of the first map instead. replica: "</span>
+<a class="jxr_linenumber" name="244" href="#244">244</a>             .warn(<span class="jxr_string">"could NOT find replicas in idealState. Use size of the first map instead. replica: "</span>
 <a class="jxr_linenumber" name="245" href="#245">245</a>                 + replica + <span class="jxr_string">", 1st partition: "</span> + firstPartition);
 <a class="jxr_linenumber" name="246" href="#246">246</a>         <strong class="jxr_keyword">break</strong>;
 <a class="jxr_linenumber" name="247" href="#247">247</a>       <strong class="jxr_keyword">default</strong>:

Modified: incubator/helix/site-content/xref/org/apache/helix/monitoring/ZKPathDataDumpTask.html
URL: http://svn.apache.org/viewvc/incubator/helix/site-content/xref/org/apache/helix/monitoring/ZKPathDataDumpTask.html?rev=1415977&r1=1415976&r2=1415977&view=diff
==============================================================================
--- incubator/helix/site-content/xref/org/apache/helix/monitoring/ZKPathDataDumpTask.html (original)
+++ incubator/helix/site-content/xref/org/apache/helix/monitoring/ZKPathDataDumpTask.html Sat Dec  1 11:21:14 2012
@@ -95,86 +95,85 @@
 <a class="jxr_linenumber" name="85" href="#85">85</a>      } <strong class="jxr_keyword">catch</strong> (Exception e)
 <a class="jxr_linenumber" name="86" href="#86">86</a>      {
 <a class="jxr_linenumber" name="87" href="#87">87</a>        logger.error(e);
-<a class="jxr_linenumber" name="88" href="#88">88</a>        e.printStackTrace();
-<a class="jxr_linenumber" name="89" href="#89">89</a>      }
-<a class="jxr_linenumber" name="90" href="#90">90</a>    }
-<a class="jxr_linenumber" name="91" href="#91">91</a>  
-<a class="jxr_linenumber" name="92" href="#92">92</a>    <strong class="jxr_keyword">void</strong> scanPath(String path, <strong class="jxr_keyword">int</strong> thresholdNoChangeInMs)
-<a class="jxr_linenumber" name="93" href="#93">93</a>    {
-<a class="jxr_linenumber" name="94" href="#94">94</a>      logger.info(<span class="jxr_string">"Scannning path "</span> + path);
-<a class="jxr_linenumber" name="95" href="#95">95</a>      List&lt;String&gt; subPaths = _zkClient.getChildren(path);
-<a class="jxr_linenumber" name="96" href="#96">96</a>      <strong class="jxr_keyword">for</strong> (String subPath : subPaths)
-<a class="jxr_linenumber" name="97" href="#97">97</a>      {
-<a class="jxr_linenumber" name="98" href="#98">98</a>        <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="99" href="#99">99</a>        {
-<a class="jxr_linenumber" name="100" href="#100">100</a>         String nextPath = path + <span class="jxr_string">"/"</span> + subPath;
-<a class="jxr_linenumber" name="101" href="#101">101</a>         List&lt;String&gt; subSubPaths = _zkClient.getChildren(nextPath);
-<a class="jxr_linenumber" name="102" href="#102">102</a>         <strong class="jxr_keyword">for</strong> (String subsubPath : subSubPaths)
-<a class="jxr_linenumber" name="103" href="#103">103</a>         {
-<a class="jxr_linenumber" name="104" href="#104">104</a>           <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="105" href="#105">105</a>           {
-<a class="jxr_linenumber" name="106" href="#106">106</a>             checkAndDump(nextPath + <span class="jxr_string">"/"</span> + subsubPath, thresholdNoChangeInMs);
-<a class="jxr_linenumber" name="107" href="#107">107</a>           } <strong class="jxr_keyword">catch</strong> (Exception e)
-<a class="jxr_linenumber" name="108" href="#108">108</a>           {
-<a class="jxr_linenumber" name="109" href="#109">109</a>             logger.error(e);
-<a class="jxr_linenumber" name="110" href="#110">110</a>           }
-<a class="jxr_linenumber" name="111" href="#111">111</a>         }
-<a class="jxr_linenumber" name="112" href="#112">112</a>       } <strong class="jxr_keyword">catch</strong> (Exception e)
-<a class="jxr_linenumber" name="113" href="#113">113</a>       {
-<a class="jxr_linenumber" name="114" href="#114">114</a>         logger.error(e);
-<a class="jxr_linenumber" name="115" href="#115">115</a>       }
-<a class="jxr_linenumber" name="116" href="#116">116</a>     }
-<a class="jxr_linenumber" name="117" href="#117">117</a>   }
-<a class="jxr_linenumber" name="118" href="#118">118</a> 
-<a class="jxr_linenumber" name="119" href="#119">119</a>   <strong class="jxr_keyword">void</strong> checkAndDump(String path, <strong class="jxr_keyword">int</strong> thresholdNoChangeInMs)
-<a class="jxr_linenumber" name="120" href="#120">120</a>   {
-<a class="jxr_linenumber" name="121" href="#121">121</a>     List&lt;String&gt; subPaths = _zkClient.getChildren(path);
-<a class="jxr_linenumber" name="122" href="#122">122</a>     <strong class="jxr_keyword">if</strong>(subPaths.size() == 0)
-<a class="jxr_linenumber" name="123" href="#123">123</a>     {
-<a class="jxr_linenumber" name="124" href="#124">124</a>       subPaths.add(<span class="jxr_string">""</span>);
-<a class="jxr_linenumber" name="125" href="#125">125</a>     }
-<a class="jxr_linenumber" name="126" href="#126">126</a>     <strong class="jxr_keyword">for</strong> (String subPath : subPaths)
-<a class="jxr_linenumber" name="127" href="#127">127</a>     {
-<a class="jxr_linenumber" name="128" href="#128">128</a>       String fullPath = subPath.length() &gt; 0 ? path + <span class="jxr_string">"/"</span> + subPath : path;
-<a class="jxr_linenumber" name="129" href="#129">129</a>       Stat pathStat = _zkClient.getStat(fullPath);
-<a class="jxr_linenumber" name="130" href="#130">130</a> 
-<a class="jxr_linenumber" name="131" href="#131">131</a>       <strong class="jxr_keyword">long</strong> lastModifiedTimeInMs = pathStat.getMtime();
-<a class="jxr_linenumber" name="132" href="#132">132</a>       <strong class="jxr_keyword">long</strong> nowInMs = <strong class="jxr_keyword">new</strong> Date().getTime();
-<a class="jxr_linenumber" name="133" href="#133">133</a>       <em class="jxr_comment">// logger.info(nowInMs + " " + lastModifiedTimeInMs + " " + fullPath);</em>
-<a class="jxr_linenumber" name="134" href="#134">134</a> 
-<a class="jxr_linenumber" name="135" href="#135">135</a>       <em class="jxr_comment">// Check the last modified time</em>
-<a class="jxr_linenumber" name="136" href="#136">136</a>       <strong class="jxr_keyword">if</strong> (nowInMs &gt; lastModifiedTimeInMs)
-<a class="jxr_linenumber" name="137" href="#137">137</a>       {
-<a class="jxr_linenumber" name="138" href="#138">138</a>         <strong class="jxr_keyword">long</strong> timeDiff = nowInMs - lastModifiedTimeInMs;
-<a class="jxr_linenumber" name="139" href="#139">139</a>         <strong class="jxr_keyword">if</strong> (timeDiff &gt; thresholdNoChangeInMs)
-<a class="jxr_linenumber" name="140" href="#140">140</a>         {
-<a class="jxr_linenumber" name="141" href="#141">141</a>           logger.info(<span class="jxr_string">"Dumping status update path "</span> + fullPath + <span class="jxr_string">" "</span> + timeDiff + <span class="jxr_string">"MS has passed"</span>);
-<a class="jxr_linenumber" name="142" href="#142">142</a>           _zkClient.setZkSerializer(<strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/manager/zk/ZNRecordSerializer.html">ZNRecordSerializer</a>());
-<a class="jxr_linenumber" name="143" href="#143">143</a>           <a href="../../../../org/apache/helix/ZNRecord.html">ZNRecord</a> record = _zkClient.readData(fullPath);
-<a class="jxr_linenumber" name="144" href="#144">144</a> 
-<a class="jxr_linenumber" name="145" href="#145">145</a>           <em class="jxr_comment">// dump the node content into log file</em>
-<a class="jxr_linenumber" name="146" href="#146">146</a>           ObjectMapper mapper = <strong class="jxr_keyword">new</strong> ObjectMapper();
-<a class="jxr_linenumber" name="147" href="#147">147</a>           SerializationConfig serializationConfig = mapper.getSerializationConfig();
-<a class="jxr_linenumber" name="148" href="#148">148</a>           serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, <strong class="jxr_keyword">true</strong>);
-<a class="jxr_linenumber" name="149" href="#149">149</a> 
-<a class="jxr_linenumber" name="150" href="#150">150</a>           StringWriter sw = <strong class="jxr_keyword">new</strong> StringWriter();
-<a class="jxr_linenumber" name="151" href="#151">151</a>           <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="152" href="#152">152</a>           {
-<a class="jxr_linenumber" name="153" href="#153">153</a>             mapper.writeValue(sw, record);
-<a class="jxr_linenumber" name="154" href="#154">154</a>             logger.info(sw.toString());
-<a class="jxr_linenumber" name="155" href="#155">155</a>           } <strong class="jxr_keyword">catch</strong> (Exception e)
-<a class="jxr_linenumber" name="156" href="#156">156</a>           {
-<a class="jxr_linenumber" name="157" href="#157">157</a>             logger.warn(
-<a class="jxr_linenumber" name="158" href="#158">158</a>                     <span class="jxr_string">"Exception during serialization in ZKPathDataDumpTask.checkAndDump. This can mostly be ignored"</span>,
-<a class="jxr_linenumber" name="159" href="#159">159</a>                     e);
-<a class="jxr_linenumber" name="160" href="#160">160</a>           }
-<a class="jxr_linenumber" name="161" href="#161">161</a>           <em class="jxr_comment">// Delete the leaf data</em>
-<a class="jxr_linenumber" name="162" href="#162">162</a>           _zkClient.deleteRecursive(fullPath);
-<a class="jxr_linenumber" name="163" href="#163">163</a>         }
-<a class="jxr_linenumber" name="164" href="#164">164</a>       }
-<a class="jxr_linenumber" name="165" href="#165">165</a>     }
-<a class="jxr_linenumber" name="166" href="#166">166</a>   }
-<a class="jxr_linenumber" name="167" href="#167">167</a> }
+<a class="jxr_linenumber" name="88" href="#88">88</a>      }
+<a class="jxr_linenumber" name="89" href="#89">89</a>    }
+<a class="jxr_linenumber" name="90" href="#90">90</a>  
+<a class="jxr_linenumber" name="91" href="#91">91</a>    <strong class="jxr_keyword">void</strong> scanPath(String path, <strong class="jxr_keyword">int</strong> thresholdNoChangeInMs)
+<a class="jxr_linenumber" name="92" href="#92">92</a>    {
+<a class="jxr_linenumber" name="93" href="#93">93</a>      logger.info(<span class="jxr_string">"Scannning path "</span> + path);
+<a class="jxr_linenumber" name="94" href="#94">94</a>      List&lt;String&gt; subPaths = _zkClient.getChildren(path);
+<a class="jxr_linenumber" name="95" href="#95">95</a>      <strong class="jxr_keyword">for</strong> (String subPath : subPaths)
+<a class="jxr_linenumber" name="96" href="#96">96</a>      {
+<a class="jxr_linenumber" name="97" href="#97">97</a>        <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="98" href="#98">98</a>        {
+<a class="jxr_linenumber" name="99" href="#99">99</a>          String nextPath = path + <span class="jxr_string">"/"</span> + subPath;
+<a class="jxr_linenumber" name="100" href="#100">100</a>         List&lt;String&gt; subSubPaths = _zkClient.getChildren(nextPath);
+<a class="jxr_linenumber" name="101" href="#101">101</a>         <strong class="jxr_keyword">for</strong> (String subsubPath : subSubPaths)
+<a class="jxr_linenumber" name="102" href="#102">102</a>         {
+<a class="jxr_linenumber" name="103" href="#103">103</a>           <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="104" href="#104">104</a>           {
+<a class="jxr_linenumber" name="105" href="#105">105</a>             checkAndDump(nextPath + <span class="jxr_string">"/"</span> + subsubPath, thresholdNoChangeInMs);
+<a class="jxr_linenumber" name="106" href="#106">106</a>           } <strong class="jxr_keyword">catch</strong> (Exception e)
+<a class="jxr_linenumber" name="107" href="#107">107</a>           {
+<a class="jxr_linenumber" name="108" href="#108">108</a>             logger.error(e);
+<a class="jxr_linenumber" name="109" href="#109">109</a>           }
+<a class="jxr_linenumber" name="110" href="#110">110</a>         }
+<a class="jxr_linenumber" name="111" href="#111">111</a>       } <strong class="jxr_keyword">catch</strong> (Exception e)
+<a class="jxr_linenumber" name="112" href="#112">112</a>       {
+<a class="jxr_linenumber" name="113" href="#113">113</a>         logger.error(e);
+<a class="jxr_linenumber" name="114" href="#114">114</a>       }
+<a class="jxr_linenumber" name="115" href="#115">115</a>     }
+<a class="jxr_linenumber" name="116" href="#116">116</a>   }
+<a class="jxr_linenumber" name="117" href="#117">117</a> 
+<a class="jxr_linenumber" name="118" href="#118">118</a>   <strong class="jxr_keyword">void</strong> checkAndDump(String path, <strong class="jxr_keyword">int</strong> thresholdNoChangeInMs)
+<a class="jxr_linenumber" name="119" href="#119">119</a>   {
+<a class="jxr_linenumber" name="120" href="#120">120</a>     List&lt;String&gt; subPaths = _zkClient.getChildren(path);
+<a class="jxr_linenumber" name="121" href="#121">121</a>     <strong class="jxr_keyword">if</strong>(subPaths.size() == 0)
+<a class="jxr_linenumber" name="122" href="#122">122</a>     {
+<a class="jxr_linenumber" name="123" href="#123">123</a>       subPaths.add(<span class="jxr_string">""</span>);
+<a class="jxr_linenumber" name="124" href="#124">124</a>     }
+<a class="jxr_linenumber" name="125" href="#125">125</a>     <strong class="jxr_keyword">for</strong> (String subPath : subPaths)
+<a class="jxr_linenumber" name="126" href="#126">126</a>     {
+<a class="jxr_linenumber" name="127" href="#127">127</a>       String fullPath = subPath.length() &gt; 0 ? path + <span class="jxr_string">"/"</span> + subPath : path;
+<a class="jxr_linenumber" name="128" href="#128">128</a>       Stat pathStat = _zkClient.getStat(fullPath);
+<a class="jxr_linenumber" name="129" href="#129">129</a> 
+<a class="jxr_linenumber" name="130" href="#130">130</a>       <strong class="jxr_keyword">long</strong> lastModifiedTimeInMs = pathStat.getMtime();
+<a class="jxr_linenumber" name="131" href="#131">131</a>       <strong class="jxr_keyword">long</strong> nowInMs = <strong class="jxr_keyword">new</strong> Date().getTime();
+<a class="jxr_linenumber" name="132" href="#132">132</a>       <em class="jxr_comment">// logger.info(nowInMs + " " + lastModifiedTimeInMs + " " + fullPath);</em>
+<a class="jxr_linenumber" name="133" href="#133">133</a> 
+<a class="jxr_linenumber" name="134" href="#134">134</a>       <em class="jxr_comment">// Check the last modified time</em>
+<a class="jxr_linenumber" name="135" href="#135">135</a>       <strong class="jxr_keyword">if</strong> (nowInMs &gt; lastModifiedTimeInMs)
+<a class="jxr_linenumber" name="136" href="#136">136</a>       {
+<a class="jxr_linenumber" name="137" href="#137">137</a>         <strong class="jxr_keyword">long</strong> timeDiff = nowInMs - lastModifiedTimeInMs;
+<a class="jxr_linenumber" name="138" href="#138">138</a>         <strong class="jxr_keyword">if</strong> (timeDiff &gt; thresholdNoChangeInMs)
+<a class="jxr_linenumber" name="139" href="#139">139</a>         {
+<a class="jxr_linenumber" name="140" href="#140">140</a>           logger.info(<span class="jxr_string">"Dumping status update path "</span> + fullPath + <span class="jxr_string">" "</span> + timeDiff + <span class="jxr_string">"MS has passed"</span>);
+<a class="jxr_linenumber" name="141" href="#141">141</a>           _zkClient.setZkSerializer(<strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/manager/zk/ZNRecordSerializer.html">ZNRecordSerializer</a>());
+<a class="jxr_linenumber" name="142" href="#142">142</a>           <a href="../../../../org/apache/helix/ZNRecord.html">ZNRecord</a> record = _zkClient.readData(fullPath);
+<a class="jxr_linenumber" name="143" href="#143">143</a> 
+<a class="jxr_linenumber" name="144" href="#144">144</a>           <em class="jxr_comment">// dump the node content into log file</em>
+<a class="jxr_linenumber" name="145" href="#145">145</a>           ObjectMapper mapper = <strong class="jxr_keyword">new</strong> ObjectMapper();
+<a class="jxr_linenumber" name="146" href="#146">146</a>           SerializationConfig serializationConfig = mapper.getSerializationConfig();
+<a class="jxr_linenumber" name="147" href="#147">147</a>           serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, <strong class="jxr_keyword">true</strong>);
+<a class="jxr_linenumber" name="148" href="#148">148</a> 
+<a class="jxr_linenumber" name="149" href="#149">149</a>           StringWriter sw = <strong class="jxr_keyword">new</strong> StringWriter();
+<a class="jxr_linenumber" name="150" href="#150">150</a>           <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="151" href="#151">151</a>           {
+<a class="jxr_linenumber" name="152" href="#152">152</a>             mapper.writeValue(sw, record);
+<a class="jxr_linenumber" name="153" href="#153">153</a>             logger.info(sw.toString());
+<a class="jxr_linenumber" name="154" href="#154">154</a>           } <strong class="jxr_keyword">catch</strong> (Exception e)
+<a class="jxr_linenumber" name="155" href="#155">155</a>           {
+<a class="jxr_linenumber" name="156" href="#156">156</a>             logger.warn(
+<a class="jxr_linenumber" name="157" href="#157">157</a>                     <span class="jxr_string">"Exception during serialization in ZKPathDataDumpTask.checkAndDump. This can mostly be ignored"</span>,
+<a class="jxr_linenumber" name="158" href="#158">158</a>                     e);
+<a class="jxr_linenumber" name="159" href="#159">159</a>           }
+<a class="jxr_linenumber" name="160" href="#160">160</a>           <em class="jxr_comment">// Delete the leaf data</em>
+<a class="jxr_linenumber" name="161" href="#161">161</a>           _zkClient.deleteRecursive(fullPath);
+<a class="jxr_linenumber" name="162" href="#162">162</a>         }
+<a class="jxr_linenumber" name="163" href="#163">163</a>       }
+<a class="jxr_linenumber" name="164" href="#164">164</a>     }
+<a class="jxr_linenumber" name="165" href="#165">165</a>   }
+<a class="jxr_linenumber" name="166" href="#166">166</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

Modified: incubator/helix/site-content/xref/org/apache/helix/package-frame.html
URL: http://svn.apache.org/viewvc/incubator/helix/site-content/xref/org/apache/helix/package-frame.html?rev=1415977&r1=1415976&r2=1415977&view=diff
==============================================================================
--- incubator/helix/site-content/xref/org/apache/helix/package-frame.html (original)
+++ incubator/helix/site-content/xref/org/apache/helix/package-frame.html Sat Dec  1 11:21:14 2012
@@ -178,7 +178,7 @@
             	<a href="StopServiceResource.html" target="classFrame">StopThread</a>
           	</li>
           	          	<li>
-            	<a href="PropertyType.html" target="classFrame">Type</a>
+            	<a href="NotificationContext.html" target="classFrame">Type</a>
           	</li>
           	          	<li>
             	<a href="ZNRecord.html" target="classFrame">ZNRecord</a>

Modified: incubator/helix/site-content/xref/org/apache/helix/package-summary.html
URL: http://svn.apache.org/viewvc/incubator/helix/site-content/xref/org/apache/helix/package-summary.html?rev=1415977&r1=1415976&r2=1415977&view=diff
==============================================================================
--- incubator/helix/site-content/xref/org/apache/helix/package-summary.html (original)
+++ incubator/helix/site-content/xref/org/apache/helix/package-summary.html Sat Dec  1 11:21:14 2012
@@ -307,7 +307,7 @@
             	</tr>
 				            	<tr>
               		<td>
-                		<a href="PropertyType.html" target="classFrame">Type</a>
+                		<a href="NotificationContext.html" target="classFrame">Type</a>
               		</td>
             	</tr>
 				            	<tr>

Modified: incubator/helix/site-content/xref/org/apache/helix/participant/DistClusterControllerElection.html
URL: http://svn.apache.org/viewvc/incubator/helix/site-content/xref/org/apache/helix/participant/DistClusterControllerElection.html?rev=1415977&r1=1415976&r2=1415977&view=diff
==============================================================================
--- incubator/helix/site-content/xref/org/apache/helix/participant/DistClusterControllerElection.html (original)
+++ incubator/helix/site-content/xref/org/apache/helix/participant/DistClusterControllerElection.html Sat Dec  1 11:21:14 2012
@@ -37,8 +37,8 @@
 <a class="jxr_linenumber" name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.HelixManagerFactory;
 <a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.InstanceType;
 <a class="jxr_linenumber" name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.NotificationContext;
-<a class="jxr_linenumber" name="30" href="#30">30</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.PropertyType;
-<a class="jxr_linenumber" name="31" href="#31">31</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.PropertyKey.Builder;
+<a class="jxr_linenumber" name="30" href="#30">30</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.PropertyKey.Builder;
+<a class="jxr_linenumber" name="31" href="#31">31</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.PropertyType;
 <a class="jxr_linenumber" name="32" href="#32">32</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.controller.GenericHelixController;
 <a class="jxr_linenumber" name="33" href="#33">33</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.controller.HelixControllerMain;
 <a class="jxr_linenumber" name="34" href="#34">34</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.controller.restlet.ZKPropertyTransferServer;
@@ -46,171 +46,136 @@
 <a class="jxr_linenumber" name="36" href="#36">36</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.model.LiveInstance;
 <a class="jxr_linenumber" name="37" href="#37">37</a>  <strong class="jxr_keyword">import</strong> org.apache.log4j.Logger;
 <a class="jxr_linenumber" name="38" href="#38">38</a>  
-<a class="jxr_linenumber" name="39" href="#39">39</a>  
-<a class="jxr_linenumber" name="40" href="#40">40</a>  <em class="jxr_comment">// TODO: merge with GenericHelixController</em>
-<a class="jxr_linenumber" name="41" href="#41">41</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/helix/participant/DistClusterControllerElection.html">DistClusterControllerElection</a> <strong class="jxr_keyword">implements</strong> <a href="../../../../org/apache/helix/ControllerChangeListener.html">ControllerChangeListener</a>
-<a class="jxr_linenumber" name="42" href="#42">42</a>  {
-<a class="jxr_linenumber" name="43" href="#43">43</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> Logger                LOG         =
-<a class="jxr_linenumber" name="44" href="#44">44</a>                                                         Logger.getLogger(DistClusterControllerElection.<strong class="jxr_keyword">class</strong>);
-<a class="jxr_linenumber" name="45" href="#45">45</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String                 _zkAddr;
-<a class="jxr_linenumber" name="46" href="#46">46</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <a href="../../../../org/apache/helix/controller/GenericHelixController.html">GenericHelixController</a> _controller = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/controller/GenericHelixController.html">GenericHelixController</a>();
-<a class="jxr_linenumber" name="47" href="#47">47</a>    <strong class="jxr_keyword">private</strong> <a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a>                 _leader;
-<a class="jxr_linenumber" name="48" href="#48">48</a>  
-<a class="jxr_linenumber" name="49" href="#49">49</a>    <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/helix/participant/DistClusterControllerElection.html">DistClusterControllerElection</a>(String zkAddr)
-<a class="jxr_linenumber" name="50" href="#50">50</a>    {
-<a class="jxr_linenumber" name="51" href="#51">51</a>      _zkAddr = zkAddr;
-<a class="jxr_linenumber" name="52" href="#52">52</a>    }
-<a class="jxr_linenumber" name="53" href="#53">53</a>  
-<a class="jxr_linenumber" name="54" href="#54">54</a>    <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="55" href="#55">55</a>  <em class="jxr_javadoccomment">   * may be accessed by multiple threads: zk-client thread and</em>
-<a class="jxr_linenumber" name="56" href="#56">56</a>  <em class="jxr_javadoccomment">   * ZkHelixManager.disconnect()-&gt;reset() TODO: Refactor accessing HelixMaangerMain class</em>
-<a class="jxr_linenumber" name="57" href="#57">57</a>  <em class="jxr_javadoccomment">   * statically</em>
-<a class="jxr_linenumber" name="58" href="#58">58</a>  <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="59" href="#59">59</a>    @Override
-<a class="jxr_linenumber" name="60" href="#60">60</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">synchronized</strong> <strong class="jxr_keyword">void</strong> onControllerChange(<a href="../../../../org/apache/helix/NotificationContext.html">NotificationContext</a> changeContext)
-<a class="jxr_linenumber" name="61" href="#61">61</a>    {
-<a class="jxr_linenumber" name="62" href="#62">62</a>      <a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a> manager = changeContext.getManager();
-<a class="jxr_linenumber" name="63" href="#63">63</a>      <strong class="jxr_keyword">if</strong> (manager == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="64" href="#64">64</a>      {
-<a class="jxr_linenumber" name="65" href="#65">65</a>        LOG.error(<span class="jxr_string">"missing attributes in changeContext. requires HelixManager"</span>);
-<a class="jxr_linenumber" name="66" href="#66">66</a>        <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="67" href="#67">67</a>      }
-<a class="jxr_linenumber" name="68" href="#68">68</a>  
-<a class="jxr_linenumber" name="69" href="#69">69</a>      <a href="../../../../org/apache/helix/InstanceType.html">InstanceType</a> type = manager.getInstanceType();
-<a class="jxr_linenumber" name="70" href="#70">70</a>      <strong class="jxr_keyword">if</strong> (type != InstanceType.CONTROLLER &amp;&amp; type != InstanceType.CONTROLLER_PARTICIPANT)
-<a class="jxr_linenumber" name="71" href="#71">71</a>      {
-<a class="jxr_linenumber" name="72" href="#72">72</a>        LOG.error(<span class="jxr_string">"fail to become controller because incorrect instanceType (was "</span>
-<a class="jxr_linenumber" name="73" href="#73">73</a>            + type.toString() + <span class="jxr_string">", requires CONTROLLER | CONTROLLER_PARTICIPANT)"</span>);
-<a class="jxr_linenumber" name="74" href="#74">74</a>        <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="75" href="#75">75</a>      }
+<a class="jxr_linenumber" name="39" href="#39">39</a>  <em class="jxr_comment">// TODO: merge with GenericHelixController</em>
+<a class="jxr_linenumber" name="40" href="#40">40</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/helix/participant/DistClusterControllerElection.html">DistClusterControllerElection</a> <strong class="jxr_keyword">implements</strong> <a href="../../../../org/apache/helix/ControllerChangeListener.html">ControllerChangeListener</a> {
+<a class="jxr_linenumber" name="41" href="#41">41</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> Logger LOG = Logger.getLogger(DistClusterControllerElection.<strong class="jxr_keyword">class</strong>);
+<a class="jxr_linenumber" name="42" href="#42">42</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String _zkAddr;
+<a class="jxr_linenumber" name="43" href="#43">43</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <a href="../../../../org/apache/helix/controller/GenericHelixController.html">GenericHelixController</a> _controller = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/controller/GenericHelixController.html">GenericHelixController</a>();
+<a class="jxr_linenumber" name="44" href="#44">44</a>      <strong class="jxr_keyword">private</strong> <a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a> _leader;
+<a class="jxr_linenumber" name="45" href="#45">45</a>  
+<a class="jxr_linenumber" name="46" href="#46">46</a>      <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/helix/participant/DistClusterControllerElection.html">DistClusterControllerElection</a>(String zkAddr) {
+<a class="jxr_linenumber" name="47" href="#47">47</a>  	_zkAddr = zkAddr;
+<a class="jxr_linenumber" name="48" href="#48">48</a>      }
+<a class="jxr_linenumber" name="49" href="#49">49</a>  
+<a class="jxr_linenumber" name="50" href="#50">50</a>      <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="51" href="#51">51</a>  <em class="jxr_javadoccomment">     * may be accessed by multiple threads: zk-client thread and</em>
+<a class="jxr_linenumber" name="52" href="#52">52</a>  <em class="jxr_javadoccomment">     * ZkHelixManager.disconnect()-&gt;reset() TODO: Refactor accessing</em>
+<a class="jxr_linenumber" name="53" href="#53">53</a>  <em class="jxr_javadoccomment">     * HelixMaangerMain class statically</em>
+<a class="jxr_linenumber" name="54" href="#54">54</a>  <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="55" href="#55">55</a>      @Override
+<a class="jxr_linenumber" name="56" href="#56">56</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">synchronized</strong> <strong class="jxr_keyword">void</strong> onControllerChange(<a href="../../../../org/apache/helix/NotificationContext.html">NotificationContext</a> changeContext) {
+<a class="jxr_linenumber" name="57" href="#57">57</a>  	HelixManager manager = changeContext.getManager();
+<a class="jxr_linenumber" name="58" href="#58">58</a>  	<strong class="jxr_keyword">if</strong> (manager == <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="59" href="#59">59</a>  	    LOG.error(<span class="jxr_string">"missing attributes in changeContext. requires HelixManager"</span>);
+<a class="jxr_linenumber" name="60" href="#60">60</a>  	    <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="61" href="#61">61</a>  	}
+<a class="jxr_linenumber" name="62" href="#62">62</a>  
+<a class="jxr_linenumber" name="63" href="#63">63</a>  	InstanceType type = manager.getInstanceType();
+<a class="jxr_linenumber" name="64" href="#64">64</a>  	<strong class="jxr_keyword">if</strong> (type != InstanceType.CONTROLLER &amp;&amp; type != InstanceType.CONTROLLER_PARTICIPANT) {
+<a class="jxr_linenumber" name="65" href="#65">65</a>  	    LOG.error(<span class="jxr_string">"fail to become controller because incorrect instanceType (was "</span>
+<a class="jxr_linenumber" name="66" href="#66">66</a>  		    + type.toString() + <span class="jxr_string">", requires CONTROLLER | CONTROLLER_PARTICIPANT)"</span>);
+<a class="jxr_linenumber" name="67" href="#67">67</a>  	    <strong class="jxr_keyword">return</strong>;
+<a class="jxr_linenumber" name="68" href="#68">68</a>  	}
+<a class="jxr_linenumber" name="69" href="#69">69</a>  
+<a class="jxr_linenumber" name="70" href="#70">70</a>  	<strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="71" href="#71">71</a>  	    <strong class="jxr_keyword">if</strong> (changeContext.getType().equals(NotificationContext.Type.INIT)
+<a class="jxr_linenumber" name="72" href="#72">72</a>  		    || changeContext.getType().equals(NotificationContext.Type.CALLBACK)) {
+<a class="jxr_linenumber" name="73" href="#73">73</a>  		<em class="jxr_comment">// DataAccessor dataAccessor = manager.getDataAccessor();</em>
+<a class="jxr_linenumber" name="74" href="#74">74</a>  		HelixDataAccessor accessor = manager.getHelixDataAccessor();
+<a class="jxr_linenumber" name="75" href="#75">75</a>  		Builder keyBuilder = accessor.keyBuilder();
 <a class="jxr_linenumber" name="76" href="#76">76</a>  
-<a class="jxr_linenumber" name="77" href="#77">77</a>      <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="78" href="#78">78</a>      {
-<a class="jxr_linenumber" name="79" href="#79">79</a>        <strong class="jxr_keyword">if</strong> (changeContext.getType().equals(NotificationContext.Type.INIT)
-<a class="jxr_linenumber" name="80" href="#80">80</a>            || changeContext.getType().equals(NotificationContext.Type.CALLBACK))
-<a class="jxr_linenumber" name="81" href="#81">81</a>        {
-<a class="jxr_linenumber" name="82" href="#82">82</a>          <em class="jxr_comment">// DataAccessor dataAccessor = manager.getDataAccessor();</em>
-<a class="jxr_linenumber" name="83" href="#83">83</a>          <a href="../../../../org/apache/helix/HelixDataAccessor.html">HelixDataAccessor</a> accessor = manager.getHelixDataAccessor();
-<a class="jxr_linenumber" name="84" href="#84">84</a>          <a href="../../../../org/apache/helix/PropertyKey.html">Builder</a> keyBuilder = accessor.keyBuilder();
-<a class="jxr_linenumber" name="85" href="#85">85</a>  
-<a class="jxr_linenumber" name="86" href="#86">86</a>          <strong class="jxr_keyword">while</strong> (accessor.getProperty(keyBuilder.controllerLeader()) == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="87" href="#87">87</a>          {
-<a class="jxr_linenumber" name="88" href="#88">88</a>            <strong class="jxr_keyword">boolean</strong> success = tryUpdateController(manager);
-<a class="jxr_linenumber" name="89" href="#89">89</a>            <strong class="jxr_keyword">if</strong> (success)
-<a class="jxr_linenumber" name="90" href="#90">90</a>            {
-<a class="jxr_linenumber" name="91" href="#91">91</a>              updateHistory(manager);
-<a class="jxr_linenumber" name="92" href="#92">92</a>              <strong class="jxr_keyword">if</strong> (type == InstanceType.CONTROLLER)
-<a class="jxr_linenumber" name="93" href="#93">93</a>              {
-<a class="jxr_linenumber" name="94" href="#94">94</a>                HelixControllerMain.addListenersToController(manager, _controller);
-<a class="jxr_linenumber" name="95" href="#95">95</a>                manager.startTimerTasks();
-<a class="jxr_linenumber" name="96" href="#96">96</a>              }
-<a class="jxr_linenumber" name="97" href="#97">97</a>              <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (type == InstanceType.CONTROLLER_PARTICIPANT)
-<a class="jxr_linenumber" name="98" href="#98">98</a>              {
-<a class="jxr_linenumber" name="99" href="#99">99</a>                String clusterName = manager.getClusterName();
-<a class="jxr_linenumber" name="100" href="#100">100</a>               String controllerName = manager.getInstanceName();
-<a class="jxr_linenumber" name="101" href="#101">101</a>               _leader =
-<a class="jxr_linenumber" name="102" href="#102">102</a>                   HelixManagerFactory.getZKHelixManager(clusterName,
-<a class="jxr_linenumber" name="103" href="#103">103</a>                                                         controllerName,
-<a class="jxr_linenumber" name="104" href="#104">104</a>                                                         InstanceType.CONTROLLER,
-<a class="jxr_linenumber" name="105" href="#105">105</a>                                                         _zkAddr);
-<a class="jxr_linenumber" name="106" href="#106">106</a> 
-<a class="jxr_linenumber" name="107" href="#107">107</a>               _leader.connect();
-<a class="jxr_linenumber" name="108" href="#108">108</a>               _leader.startTimerTasks();
-<a class="jxr_linenumber" name="109" href="#109">109</a>               HelixControllerMain.addListenersToController(_leader, _controller);
-<a class="jxr_linenumber" name="110" href="#110">110</a>             }
-<a class="jxr_linenumber" name="111" href="#111">111</a> 
-<a class="jxr_linenumber" name="112" href="#112">112</a>           }
-<a class="jxr_linenumber" name="113" href="#113">113</a>         }
-<a class="jxr_linenumber" name="114" href="#114">114</a>       }
-<a class="jxr_linenumber" name="115" href="#115">115</a>       <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (changeContext.getType().equals(NotificationContext.Type.FINALIZE))
-<a class="jxr_linenumber" name="116" href="#116">116</a>       {
-<a class="jxr_linenumber" name="117" href="#117">117</a> 
-<a class="jxr_linenumber" name="118" href="#118">118</a>         <strong class="jxr_keyword">if</strong> (_leader != <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="119" href="#119">119</a>         {
-<a class="jxr_linenumber" name="120" href="#120">120</a>           _leader.disconnect();
-<a class="jxr_linenumber" name="121" href="#121">121</a>         }
-<a class="jxr_linenumber" name="122" href="#122">122</a>       }
-<a class="jxr_linenumber" name="123" href="#123">123</a> 
-<a class="jxr_linenumber" name="124" href="#124">124</a>     }
-<a class="jxr_linenumber" name="125" href="#125">125</a>     <strong class="jxr_keyword">catch</strong> (Exception e)
-<a class="jxr_linenumber" name="126" href="#126">126</a>     {
-<a class="jxr_linenumber" name="127" href="#127">127</a>       LOG.error(<span class="jxr_string">"Exception when trying to become leader"</span>, e);
-<a class="jxr_linenumber" name="128" href="#128">128</a>     }
-<a class="jxr_linenumber" name="129" href="#129">129</a>   }
-<a class="jxr_linenumber" name="130" href="#130">130</a> 
-<a class="jxr_linenumber" name="131" href="#131">131</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> tryUpdateController(<a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a> manager)
-<a class="jxr_linenumber" name="132" href="#132">132</a>   {
-<a class="jxr_linenumber" name="133" href="#133">133</a>     <em class="jxr_comment">// DataAccessor dataAccessor = manager.getDataAccessor();</em>
-<a class="jxr_linenumber" name="134" href="#134">134</a>     <a href="../../../../org/apache/helix/HelixDataAccessor.html">HelixDataAccessor</a> accessor = manager.getHelixDataAccessor();
-<a class="jxr_linenumber" name="135" href="#135">135</a>     <a href="../../../../org/apache/helix/PropertyKey.html">Builder</a> keyBuilder = accessor.keyBuilder();
-<a class="jxr_linenumber" name="136" href="#136">136</a> 
-<a class="jxr_linenumber" name="137" href="#137">137</a>     <a href="../../../../org/apache/helix/model/LiveInstance.html">LiveInstance</a> leader = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/LiveInstance.html">LiveInstance</a>(manager.getInstanceName());
-<a class="jxr_linenumber" name="138" href="#138">138</a>     <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="139" href="#139">139</a>     {
-<a class="jxr_linenumber" name="140" href="#140">140</a>       leader.setLiveInstance(ManagementFactory.getRuntimeMXBean().getName());
-<a class="jxr_linenumber" name="141" href="#141">141</a>       <em class="jxr_comment">// TODO: this session id is not the leader's session id in distributed mode</em>
-<a class="jxr_linenumber" name="142" href="#142">142</a>       leader.setSessionId(manager.getSessionId());
-<a class="jxr_linenumber" name="143" href="#143">143</a>       leader.setHelixVersion(manager.getVersion());
-<a class="jxr_linenumber" name="144" href="#144">144</a>       <strong class="jxr_keyword">if</strong>(ZKPropertyTransferServer.getInstance() != <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="145" href="#145">145</a>       {
-<a class="jxr_linenumber" name="146" href="#146">146</a>         String zkPropertyTransferServiceUrl = ZKPropertyTransferServer.getInstance().getWebserviceUrl();
-<a class="jxr_linenumber" name="147" href="#147">147</a>         <strong class="jxr_keyword">if</strong>(zkPropertyTransferServiceUrl != <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="148" href="#148">148</a>         {
-<a class="jxr_linenumber" name="149" href="#149">149</a>           leader.setWebserviceUrl(zkPropertyTransferServiceUrl);
-<a class="jxr_linenumber" name="150" href="#150">150</a>         }
-<a class="jxr_linenumber" name="151" href="#151">151</a>       }
-<a class="jxr_linenumber" name="152" href="#152">152</a>       <strong class="jxr_keyword">else</strong>
-<a class="jxr_linenumber" name="153" href="#153">153</a>       {
-<a class="jxr_linenumber" name="154" href="#154">154</a>         LOG.warn(<span class="jxr_string">"ZKPropertyTransferServer instnace is null"</span>);
-<a class="jxr_linenumber" name="155" href="#155">155</a>       }
-<a class="jxr_linenumber" name="156" href="#156">156</a>       <strong class="jxr_keyword">boolean</strong> success = accessor.createProperty(keyBuilder.controllerLeader(), leader);
-<a class="jxr_linenumber" name="157" href="#157">157</a>       <strong class="jxr_keyword">if</strong> (success)
-<a class="jxr_linenumber" name="158" href="#158">158</a>       {
-<a class="jxr_linenumber" name="159" href="#159">159</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="160" href="#160">160</a>       }
-<a class="jxr_linenumber" name="161" href="#161">161</a>       <strong class="jxr_keyword">else</strong>
-<a class="jxr_linenumber" name="162" href="#162">162</a>       {
-<a class="jxr_linenumber" name="163" href="#163">163</a>         LOG.info(<span class="jxr_string">"Unable to become leader probably because some other controller becames the leader"</span>);
-<a class="jxr_linenumber" name="164" href="#164">164</a>       }
-<a class="jxr_linenumber" name="165" href="#165">165</a>     }
-<a class="jxr_linenumber" name="166" href="#166">166</a>     <strong class="jxr_keyword">catch</strong> (Exception e)
-<a class="jxr_linenumber" name="167" href="#167">167</a>     {
-<a class="jxr_linenumber" name="168" href="#168">168</a>       LOG.error(<span class="jxr_string">"Exception when trying to updating leader record in cluster:"</span>
-<a class="jxr_linenumber" name="169" href="#169">169</a>                     + manager.getClusterName()
-<a class="jxr_linenumber" name="170" href="#170">170</a>                     + <span class="jxr_string">". Need to check again whether leader node has been created or not"</span>,
-<a class="jxr_linenumber" name="171" href="#171">171</a>                 e);
-<a class="jxr_linenumber" name="172" href="#172">172</a>     }
-<a class="jxr_linenumber" name="173" href="#173">173</a> 
-<a class="jxr_linenumber" name="174" href="#174">174</a>     leader = accessor.getProperty(keyBuilder.controllerLeader());
-<a class="jxr_linenumber" name="175" href="#175">175</a>     <strong class="jxr_keyword">if</strong> (leader != <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="176" href="#176">176</a>     {
-<a class="jxr_linenumber" name="177" href="#177">177</a>       String leaderName = leader.getInstanceName(); <em class="jxr_comment">// leader.getLeader();</em>
-<a class="jxr_linenumber" name="178" href="#178">178</a>       LOG.info(<span class="jxr_string">"Leader exists for cluster:"</span> + manager.getClusterName()
-<a class="jxr_linenumber" name="179" href="#179">179</a>           + <span class="jxr_string">", currentLeader:"</span> + leaderName);
-<a class="jxr_linenumber" name="180" href="#180">180</a> 
-<a class="jxr_linenumber" name="181" href="#181">181</a>       <strong class="jxr_keyword">if</strong> (leaderName != <strong class="jxr_keyword">null</strong> &amp;&amp; leaderName.equals(manager.getInstanceName()))
-<a class="jxr_linenumber" name="182" href="#182">182</a>       {
-<a class="jxr_linenumber" name="183" href="#183">183</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="184" href="#184">184</a>       }
-<a class="jxr_linenumber" name="185" href="#185">185</a>     }
-<a class="jxr_linenumber" name="186" href="#186">186</a> 
-<a class="jxr_linenumber" name="187" href="#187">187</a>     <strong class="jxr_keyword">return</strong> false;
-<a class="jxr_linenumber" name="188" href="#188">188</a>   }
-<a class="jxr_linenumber" name="189" href="#189">189</a> 
-<a class="jxr_linenumber" name="190" href="#190">190</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> updateHistory(<a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a> manager)
-<a class="jxr_linenumber" name="191" href="#191">191</a>   {
-<a class="jxr_linenumber" name="192" href="#192">192</a>     <a href="../../../../org/apache/helix/HelixDataAccessor.html">HelixDataAccessor</a> accessor = manager.getHelixDataAccessor();
-<a class="jxr_linenumber" name="193" href="#193">193</a>     <a href="../../../../org/apache/helix/PropertyKey.html">Builder</a> keyBuilder = accessor.keyBuilder();
-<a class="jxr_linenumber" name="194" href="#194">194</a> 
-<a class="jxr_linenumber" name="195" href="#195">195</a>     <a href="../../../../org/apache/helix/model/LeaderHistory.html">LeaderHistory</a> history = accessor.getProperty(keyBuilder.controllerLeaderHistory());
-<a class="jxr_linenumber" name="196" href="#196">196</a>     <strong class="jxr_keyword">if</strong> (history == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="197" href="#197">197</a>     {
-<a class="jxr_linenumber" name="198" href="#198">198</a>       history = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/LeaderHistory.html">LeaderHistory</a>(PropertyType.HISTORY.toString());
-<a class="jxr_linenumber" name="199" href="#199">199</a>     }
-<a class="jxr_linenumber" name="200" href="#200">200</a>     history.updateHistory(manager.getClusterName(), manager.getInstanceName());
-<a class="jxr_linenumber" name="201" href="#201">201</a>     accessor.setProperty(keyBuilder.controllerLeaderHistory(), history);
-<a class="jxr_linenumber" name="202" href="#202">202</a>   }
-<a class="jxr_linenumber" name="203" href="#203">203</a> }
+<a class="jxr_linenumber" name="77" href="#77">77</a>  		<strong class="jxr_keyword">while</strong> (accessor.getProperty(keyBuilder.controllerLeader()) == <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="78" href="#78">78</a>  		    <strong class="jxr_keyword">boolean</strong> success = tryUpdateController(manager);
+<a class="jxr_linenumber" name="79" href="#79">79</a>  		    <strong class="jxr_keyword">if</strong> (success) {
+<a class="jxr_linenumber" name="80" href="#80">80</a>  			updateHistory(manager);
+<a class="jxr_linenumber" name="81" href="#81">81</a>  			<strong class="jxr_keyword">if</strong> (type == InstanceType.CONTROLLER) {
+<a class="jxr_linenumber" name="82" href="#82">82</a>  			    HelixControllerMain.addListenersToController(manager, _controller);
+<a class="jxr_linenumber" name="83" href="#83">83</a>  			    manager.startTimerTasks();
+<a class="jxr_linenumber" name="84" href="#84">84</a>  			} <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (type == InstanceType.CONTROLLER_PARTICIPANT) {
+<a class="jxr_linenumber" name="85" href="#85">85</a>  			    String clusterName = manager.getClusterName();
+<a class="jxr_linenumber" name="86" href="#86">86</a>  			    String controllerName = manager.getInstanceName();
+<a class="jxr_linenumber" name="87" href="#87">87</a>  			    _leader = HelixManagerFactory.getZKHelixManager(clusterName,
+<a class="jxr_linenumber" name="88" href="#88">88</a>  				    controllerName, InstanceType.CONTROLLER, _zkAddr);
+<a class="jxr_linenumber" name="89" href="#89">89</a>  
+<a class="jxr_linenumber" name="90" href="#90">90</a>  			    _leader.connect();
+<a class="jxr_linenumber" name="91" href="#91">91</a>  			    _leader.startTimerTasks();
+<a class="jxr_linenumber" name="92" href="#92">92</a>  			    HelixControllerMain.addListenersToController(_leader, _controller);
+<a class="jxr_linenumber" name="93" href="#93">93</a>  			}
+<a class="jxr_linenumber" name="94" href="#94">94</a>  
+<a class="jxr_linenumber" name="95" href="#95">95</a>  		    }
+<a class="jxr_linenumber" name="96" href="#96">96</a>  		}
+<a class="jxr_linenumber" name="97" href="#97">97</a>  	    } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (changeContext.getType().equals(NotificationContext.Type.FINALIZE)) {
+<a class="jxr_linenumber" name="98" href="#98">98</a>  
+<a class="jxr_linenumber" name="99" href="#99">99</a>  		<strong class="jxr_keyword">if</strong> (_leader != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="100" href="#100">100</a> 		    _leader.disconnect();
+<a class="jxr_linenumber" name="101" href="#101">101</a> 		}
+<a class="jxr_linenumber" name="102" href="#102">102</a> 	    }
+<a class="jxr_linenumber" name="103" href="#103">103</a> 
+<a class="jxr_linenumber" name="104" href="#104">104</a> 	} <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a class="jxr_linenumber" name="105" href="#105">105</a> 	    LOG.error(<span class="jxr_string">"Exception when trying to become leader"</span>, e);
+<a class="jxr_linenumber" name="106" href="#106">106</a> 	}
+<a class="jxr_linenumber" name="107" href="#107">107</a>     }
+<a class="jxr_linenumber" name="108" href="#108">108</a> 
+<a class="jxr_linenumber" name="109" href="#109">109</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> tryUpdateController(<a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a> manager) {
+<a class="jxr_linenumber" name="110" href="#110">110</a> 	<em class="jxr_comment">// DataAccessor dataAccessor = manager.getDataAccessor();</em>
+<a class="jxr_linenumber" name="111" href="#111">111</a> 	HelixDataAccessor accessor = manager.getHelixDataAccessor();
+<a class="jxr_linenumber" name="112" href="#112">112</a> 	Builder keyBuilder = accessor.keyBuilder();
+<a class="jxr_linenumber" name="113" href="#113">113</a> 
+<a class="jxr_linenumber" name="114" href="#114">114</a> 	LiveInstance leader = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/LiveInstance.html">LiveInstance</a>(manager.getInstanceName());
+<a class="jxr_linenumber" name="115" href="#115">115</a> 	<strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="116" href="#116">116</a> 	    leader.setLiveInstance(ManagementFactory.getRuntimeMXBean().getName());
+<a class="jxr_linenumber" name="117" href="#117">117</a> 	    <em class="jxr_comment">// TODO: this session id is not the leader's session id in</em>
+<a class="jxr_linenumber" name="118" href="#118">118</a> 	    <em class="jxr_comment">// distributed mode</em>
+<a class="jxr_linenumber" name="119" href="#119">119</a> 	    leader.setSessionId(manager.getSessionId());
+<a class="jxr_linenumber" name="120" href="#120">120</a> 	    leader.setHelixVersion(manager.getVersion());
+<a class="jxr_linenumber" name="121" href="#121">121</a> 	    <strong class="jxr_keyword">if</strong> (ZKPropertyTransferServer.getInstance() != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="122" href="#122">122</a> 		String zkPropertyTransferServiceUrl = ZKPropertyTransferServer.getInstance()
+<a class="jxr_linenumber" name="123" href="#123">123</a> 		        .getWebserviceUrl();
+<a class="jxr_linenumber" name="124" href="#124">124</a> 		<strong class="jxr_keyword">if</strong> (zkPropertyTransferServiceUrl != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="125" href="#125">125</a> 		    leader.setWebserviceUrl(zkPropertyTransferServiceUrl);
+<a class="jxr_linenumber" name="126" href="#126">126</a> 		}
+<a class="jxr_linenumber" name="127" href="#127">127</a> 	    } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="128" href="#128">128</a> 		LOG.warn(<span class="jxr_string">"ZKPropertyTransferServer instnace is null"</span>);
+<a class="jxr_linenumber" name="129" href="#129">129</a> 	    }
+<a class="jxr_linenumber" name="130" href="#130">130</a> 	    <strong class="jxr_keyword">boolean</strong> success = accessor.createProperty(keyBuilder.controllerLeader(), leader);
+<a class="jxr_linenumber" name="131" href="#131">131</a> 	    <strong class="jxr_keyword">if</strong> (success) {
+<a class="jxr_linenumber" name="132" href="#132">132</a> 		<strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="133" href="#133">133</a> 	    } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="134" href="#134">134</a> 		LOG.info(<span class="jxr_string">"Unable to become leader probably because some other controller becames the leader"</span>);
+<a class="jxr_linenumber" name="135" href="#135">135</a> 	    }
+<a class="jxr_linenumber" name="136" href="#136">136</a> 	} <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a class="jxr_linenumber" name="137" href="#137">137</a> 	    LOG.error(
+<a class="jxr_linenumber" name="138" href="#138">138</a> 		    <span class="jxr_string">"Exception when trying to updating leader record in cluster:"</span>
+<a class="jxr_linenumber" name="139" href="#139">139</a> 		            + manager.getClusterName()
+<a class="jxr_linenumber" name="140" href="#140">140</a> 		            + <span class="jxr_string">". Need to check again whether leader node has been created or not"</span>,
+<a class="jxr_linenumber" name="141" href="#141">141</a> 		    e);
+<a class="jxr_linenumber" name="142" href="#142">142</a> 	}
+<a class="jxr_linenumber" name="143" href="#143">143</a> 
+<a class="jxr_linenumber" name="144" href="#144">144</a> 	leader = accessor.getProperty(keyBuilder.controllerLeader());
+<a class="jxr_linenumber" name="145" href="#145">145</a> 	<strong class="jxr_keyword">if</strong> (leader != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="146" href="#146">146</a> 	    String leaderSessionId = leader.getSessionId();
+<a class="jxr_linenumber" name="147" href="#147">147</a> 	    LOG.info(<span class="jxr_string">"Leader exists for cluster: "</span> + manager.getClusterName() + <span class="jxr_string">", currentLeader: "</span>
+<a class="jxr_linenumber" name="148" href="#148">148</a> 		    + leader.getInstanceName() + <span class="jxr_string">", leaderSessionId: "</span> + leaderSessionId);
+<a class="jxr_linenumber" name="149" href="#149">149</a> 
+<a class="jxr_linenumber" name="150" href="#150">150</a> 	    <strong class="jxr_keyword">if</strong> (leaderSessionId != <strong class="jxr_keyword">null</strong> &amp;&amp; leaderSessionId.equals(manager.getSessionId())) {
+<a class="jxr_linenumber" name="151" href="#151">151</a> 		<strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="152" href="#152">152</a> 	    }
+<a class="jxr_linenumber" name="153" href="#153">153</a> 	}
+<a class="jxr_linenumber" name="154" href="#154">154</a> 	<strong class="jxr_keyword">return</strong> false;
+<a class="jxr_linenumber" name="155" href="#155">155</a>     }
+<a class="jxr_linenumber" name="156" href="#156">156</a> 
+<a class="jxr_linenumber" name="157" href="#157">157</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> updateHistory(<a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a> manager) {
+<a class="jxr_linenumber" name="158" href="#158">158</a> 	HelixDataAccessor accessor = manager.getHelixDataAccessor();
+<a class="jxr_linenumber" name="159" href="#159">159</a> 	Builder keyBuilder = accessor.keyBuilder();
+<a class="jxr_linenumber" name="160" href="#160">160</a> 
+<a class="jxr_linenumber" name="161" href="#161">161</a> 	LeaderHistory history = accessor.getProperty(keyBuilder.controllerLeaderHistory());
+<a class="jxr_linenumber" name="162" href="#162">162</a> 	<strong class="jxr_keyword">if</strong> (history == <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="163" href="#163">163</a> 	    history = <strong class="jxr_keyword">new</strong> LeaderHistory(PropertyType.HISTORY.toString());
+<a class="jxr_linenumber" name="164" href="#164">164</a> 	}
+<a class="jxr_linenumber" name="165" href="#165">165</a> 	history.updateHistory(manager.getClusterName(), manager.getInstanceName());
+<a class="jxr_linenumber" name="166" href="#166">166</a> 	accessor.setProperty(keyBuilder.controllerLeaderHistory(), history);
+<a class="jxr_linenumber" name="167" href="#167">167</a>     }
+<a class="jxr_linenumber" name="168" href="#168">168</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

Modified: incubator/helix/site-content/xref/org/apache/helix/util/StatusUpdateUtil.html
URL: http://svn.apache.org/viewvc/incubator/helix/site-content/xref/org/apache/helix/util/StatusUpdateUtil.html?rev=1415977&r1=1415976&r2=1415977&view=diff
==============================================================================
--- incubator/helix/site-content/xref/org/apache/helix/util/StatusUpdateUtil.html (original)
+++ incubator/helix/site-content/xref/org/apache/helix/util/StatusUpdateUtil.html Sat Dec  1 11:21:14 2012
@@ -517,130 +517,133 @@
 <a class="jxr_linenumber" name="507" href="#507">507</a> 
 <a class="jxr_linenumber" name="508" href="#508">508</a>         <em class="jxr_comment">// For now write participant StatusUpdates to log4j. </em>
 <a class="jxr_linenumber" name="509" href="#509">509</a>         <em class="jxr_comment">// we are using restlet as another data channel to report to controller.</em>
-<a class="jxr_linenumber" name="510" href="#510">510</a>         
-<a class="jxr_linenumber" name="511" href="#511">511</a>         _logger.info(<span class="jxr_string">"StatusUpdate path:"</span> + propertyKey.getPath() + <span class="jxr_string">", updates:"</span>
+<a class="jxr_linenumber" name="510" href="#510">510</a>         <strong class="jxr_keyword">if</strong>(_logger.isTraceEnabled()){
+<a class="jxr_linenumber" name="511" href="#511">511</a>            _logger.trace(<span class="jxr_string">"StatusUpdate path:"</span> + propertyKey.getPath() + <span class="jxr_string">", updates:"</span>
 <a class="jxr_linenumber" name="512" href="#512">512</a>               + statusUpdateRecord);
-<a class="jxr_linenumber" name="513" href="#513">513</a>         accessor.updateProperty(propertyKey, <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/StatusUpdate.html">StatusUpdate</a>(statusUpdateRecord));
-<a class="jxr_linenumber" name="514" href="#514">514</a>         
-<a class="jxr_linenumber" name="515" href="#515">515</a>       }
-<a class="jxr_linenumber" name="516" href="#516">516</a>       _recordedMessages.put(message.getMsgId(), message.getMsgId());
-<a class="jxr_linenumber" name="517" href="#517">517</a>     }
-<a class="jxr_linenumber" name="518" href="#518">518</a> 
-<a class="jxr_linenumber" name="519" href="#519">519</a>     <strong class="jxr_keyword">if</strong> (instanceName.equalsIgnoreCase(<span class="jxr_string">"Controller"</span>))
-<a class="jxr_linenumber" name="520" href="#520">520</a>     {
-<a class="jxr_linenumber" name="521" href="#521">521</a>       accessor.updateProperty(keyBuilder.controllerTaskStatus(statusUpdateSubPath,
-<a class="jxr_linenumber" name="522" href="#522">522</a>                                                               statusUpdateKey),
-<a class="jxr_linenumber" name="523" href="#523">523</a>                               <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/StatusUpdate.html">StatusUpdate</a>(record));
-<a class="jxr_linenumber" name="524" href="#524">524</a>     }
-<a class="jxr_linenumber" name="525" href="#525">525</a>     <strong class="jxr_keyword">else</strong>
-<a class="jxr_linenumber" name="526" href="#526">526</a>     {
-<a class="jxr_linenumber" name="527" href="#527">527</a>       
-<a class="jxr_linenumber" name="528" href="#528">528</a>       <a href="../../../../org/apache/helix/PropertyKey.html">PropertyKey</a> propertyKey =
-<a class="jxr_linenumber" name="529" href="#529">529</a>           keyBuilder.stateTransitionStatus(instanceName,
-<a class="jxr_linenumber" name="530" href="#530">530</a>                                            sessionId,
-<a class="jxr_linenumber" name="531" href="#531">531</a>                                            statusUpdateSubPath,
-<a class="jxr_linenumber" name="532" href="#532">532</a>                                            statusUpdateKey);
-<a class="jxr_linenumber" name="533" href="#533">533</a>       <em class="jxr_comment">// For now write participant StatusUpdates to log4j. </em>
-<a class="jxr_linenumber" name="534" href="#534">534</a>       <em class="jxr_comment">// we are using restlet as another data channel to report to controller.</em>
-<a class="jxr_linenumber" name="535" href="#535">535</a>       _logger.info(<span class="jxr_string">"StatusUpdate path:"</span> + propertyKey.getPath() + <span class="jxr_string">", updates:"</span> + record);
-<a class="jxr_linenumber" name="536" href="#536">536</a>       accessor.updateProperty(propertyKey, <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/StatusUpdate.html">StatusUpdate</a>(record));
-<a class="jxr_linenumber" name="537" href="#537">537</a>     }
-<a class="jxr_linenumber" name="538" href="#538">538</a> 
-<a class="jxr_linenumber" name="539" href="#539">539</a>     <em class="jxr_comment">// If the error level is ERROR, also write the record to "ERROR" ZNode</em>
-<a class="jxr_linenumber" name="540" href="#540">540</a>     <strong class="jxr_keyword">if</strong> (Level.HELIX_ERROR == level)
-<a class="jxr_linenumber" name="541" href="#541">541</a>     {
-<a class="jxr_linenumber" name="542" href="#542">542</a>       publishErrorRecord(record, message, accessor);
-<a class="jxr_linenumber" name="543" href="#543">543</a>     }
-<a class="jxr_linenumber" name="544" href="#544">544</a>   }
-<a class="jxr_linenumber" name="545" href="#545">545</a> 
-<a class="jxr_linenumber" name="546" href="#546">546</a>   <strong class="jxr_keyword">private</strong> String getStatusUpdateKey(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message)
-<a class="jxr_linenumber" name="547" href="#547">547</a>   {
-<a class="jxr_linenumber" name="548" href="#548">548</a>     <strong class="jxr_keyword">if</strong> (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
-<a class="jxr_linenumber" name="549" href="#549">549</a>     {
-<a class="jxr_linenumber" name="550" href="#550">550</a>       <strong class="jxr_keyword">return</strong> message.getPartitionName();
-<a class="jxr_linenumber" name="551" href="#551">551</a>     }
-<a class="jxr_linenumber" name="552" href="#552">552</a>     <strong class="jxr_keyword">return</strong> message.getMsgId();
-<a class="jxr_linenumber" name="553" href="#553">553</a>   }
-<a class="jxr_linenumber" name="554" href="#554">554</a> 
-<a class="jxr_linenumber" name="555" href="#555">555</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="556" href="#556">556</a> <em class="jxr_javadoccomment">   * Generate the sub-path under STATUSUPDATE or ERROR path for a status update</em>
-<a class="jxr_linenumber" name="557" href="#557">557</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="558" href="#558">558</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="559" href="#559">559</a>   String getStatusUpdateSubPath(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message)
-<a class="jxr_linenumber" name="560" href="#560">560</a>   {
-<a class="jxr_linenumber" name="561" href="#561">561</a>     <strong class="jxr_keyword">if</strong> (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
-<a class="jxr_linenumber" name="562" href="#562">562</a>     {
-<a class="jxr_linenumber" name="563" href="#563">563</a>       <strong class="jxr_keyword">return</strong> message.getResourceName();
-<a class="jxr_linenumber" name="564" href="#564">564</a>     }
-<a class="jxr_linenumber" name="565" href="#565">565</a>     <strong class="jxr_keyword">else</strong>
-<a class="jxr_linenumber" name="566" href="#566">566</a>     {
-<a class="jxr_linenumber" name="567" href="#567">567</a>       <strong class="jxr_keyword">return</strong> message.getMsgType();
-<a class="jxr_linenumber" name="568" href="#568">568</a>     }
-<a class="jxr_linenumber" name="569" href="#569">569</a>   }
-<a class="jxr_linenumber" name="570" href="#570">570</a> 
-<a class="jxr_linenumber" name="571" href="#571">571</a>   String getStatusUpdateRecordName(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message)
-<a class="jxr_linenumber" name="572" href="#572">572</a>   {
-<a class="jxr_linenumber" name="573" href="#573">573</a>     <strong class="jxr_keyword">if</strong> (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
-<a class="jxr_linenumber" name="574" href="#574">574</a>     {
-<a class="jxr_linenumber" name="575" href="#575">575</a>       <strong class="jxr_keyword">return</strong> message.getTgtSessionId() + <span class="jxr_string">"__"</span> + message.getResourceName();
-<a class="jxr_linenumber" name="576" href="#576">576</a>     }
-<a class="jxr_linenumber" name="577" href="#577">577</a>     <strong class="jxr_keyword">return</strong> message.getMsgId();
-<a class="jxr_linenumber" name="578" href="#578">578</a>   }
-<a class="jxr_linenumber" name="579" href="#579">579</a> 
-<a class="jxr_linenumber" name="580" href="#580">580</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="581" href="#581">581</a> <em class="jxr_javadoccomment">   * Write an error record to zookeeper to the zookeeper store.</em>
-<a class="jxr_linenumber" name="582" href="#582">582</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="583" href="#583">583</a> <em class="jxr_javadoccomment">   * @param record</em>
-<a class="jxr_linenumber" name="584" href="#584">584</a> <em class="jxr_javadoccomment">   *          the status update record</em>
-<a class="jxr_linenumber" name="585" href="#585">585</a> <em class="jxr_javadoccomment">   * @param message</em>
-<a class="jxr_linenumber" name="586" href="#586">586</a> <em class="jxr_javadoccomment">   *          the message to be logged</em>
-<a class="jxr_linenumber" name="587" href="#587">587</a> <em class="jxr_javadoccomment">   * @param accessor</em>
-<a class="jxr_linenumber" name="588" href="#588">588</a> <em class="jxr_javadoccomment">   *          the zookeeper data accessor that writes the status update to zookeeper</em>
-<a class="jxr_linenumber" name="589" href="#589">589</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="590" href="#590">590</a>   <strong class="jxr_keyword">void</strong> publishErrorRecord(<a href="../../../../org/apache/helix/ZNRecord.html">ZNRecord</a> record, <a href="../../../../org/apache/helix/model/Message.html">Message</a> message, <a href="../../../../org/apache/helix/HelixDataAccessor.html">HelixDataAccessor</a> accessor)
-<a class="jxr_linenumber" name="591" href="#591">591</a>   {
-<a class="jxr_linenumber" name="592" href="#592">592</a>     String instanceName = message.getTgtName();
-<a class="jxr_linenumber" name="593" href="#593">593</a>     String statusUpdateSubPath = getStatusUpdateSubPath(message);
-<a class="jxr_linenumber" name="594" href="#594">594</a>     String statusUpdateKey = getStatusUpdateKey(message);
-<a class="jxr_linenumber" name="595" href="#595">595</a>     String sessionId = message.getExecutionSessionId();
-<a class="jxr_linenumber" name="596" href="#596">596</a>     <strong class="jxr_keyword">if</strong> (sessionId == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="597" href="#597">597</a>     {
-<a class="jxr_linenumber" name="598" href="#598">598</a>       sessionId = message.getTgtSessionId();
-<a class="jxr_linenumber" name="599" href="#599">599</a>     }
-<a class="jxr_linenumber" name="600" href="#600">600</a>     <strong class="jxr_keyword">if</strong> (sessionId == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="601" href="#601">601</a>     {
-<a class="jxr_linenumber" name="602" href="#602">602</a>       sessionId = <span class="jxr_string">"*"</span>;
-<a class="jxr_linenumber" name="603" href="#603">603</a>     }
-<a class="jxr_linenumber" name="604" href="#604">604</a> 
-<a class="jxr_linenumber" name="605" href="#605">605</a>     <a href="../../../../org/apache/helix/PropertyKey.html">Builder</a> keyBuilder = accessor.keyBuilder();
-<a class="jxr_linenumber" name="606" href="#606">606</a> 
-<a class="jxr_linenumber" name="607" href="#607">607</a>     <em class="jxr_comment">// TODO remove the hard code: "controller"</em>
-<a class="jxr_linenumber" name="608" href="#608">608</a>     <strong class="jxr_keyword">if</strong> (instanceName.equalsIgnoreCase(<span class="jxr_string">"controller"</span>))
-<a class="jxr_linenumber" name="609" href="#609">609</a>     {
-<a class="jxr_linenumber" name="610" href="#610">610</a>       <em class="jxr_comment">// TODO need to fix: ERRORS_CONTROLLER doesn't have a form of</em>
-<a class="jxr_linenumber" name="611" href="#611">611</a>       <em class="jxr_comment">// ../{sessionId}/{subPath}</em>
-<a class="jxr_linenumber" name="612" href="#612">612</a>       <em class="jxr_comment">// accessor.setProperty(PropertyType.ERRORS_CONTROLLER, record,</em>
-<a class="jxr_linenumber" name="613" href="#613">613</a>       <em class="jxr_comment">// statusUpdateSubPath);</em>
-<a class="jxr_linenumber" name="614" href="#614">614</a>       accessor.setProperty(keyBuilder.controllerTaskError(statusUpdateSubPath),
-<a class="jxr_linenumber" name="615" href="#615">615</a>                            <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/Error.html">Error</a>(record));
-<a class="jxr_linenumber" name="616" href="#616">616</a>     }
-<a class="jxr_linenumber" name="617" href="#617">617</a>     <strong class="jxr_keyword">else</strong>
-<a class="jxr_linenumber" name="618" href="#618">618</a>     {
-<a class="jxr_linenumber" name="619" href="#619">619</a>       <em class="jxr_comment">// accessor.updateProperty(PropertyType.ERRORS,</em>
-<a class="jxr_linenumber" name="620" href="#620">620</a>       <em class="jxr_comment">// record,</em>
-<a class="jxr_linenumber" name="621" href="#621">621</a>       <em class="jxr_comment">// instanceName,</em>
-<a class="jxr_linenumber" name="622" href="#622">622</a>       <em class="jxr_comment">// sessionId,</em>
-<a class="jxr_linenumber" name="623" href="#623">623</a>       <em class="jxr_comment">// statusUpdateSubPath,</em>
-<a class="jxr_linenumber" name="624" href="#624">624</a>       <em class="jxr_comment">// statusUpdateKey);</em>
-<a class="jxr_linenumber" name="625" href="#625">625</a>       accessor.updateProperty(keyBuilder.stateTransitionError(instanceName,
-<a class="jxr_linenumber" name="626" href="#626">626</a>                                                               sessionId,
-<a class="jxr_linenumber" name="627" href="#627">627</a>                                                               statusUpdateSubPath,
-<a class="jxr_linenumber" name="628" href="#628">628</a>                                                               statusUpdateKey),
-<a class="jxr_linenumber" name="629" href="#629">629</a>                               <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/Error.html">Error</a>(record));
-<a class="jxr_linenumber" name="630" href="#630">630</a> 
-<a class="jxr_linenumber" name="631" href="#631">631</a>     }
-<a class="jxr_linenumber" name="632" href="#632">632</a>   }
-<a class="jxr_linenumber" name="633" href="#633">633</a> }
+<a class="jxr_linenumber" name="513" href="#513">513</a>         }
+<a class="jxr_linenumber" name="514" href="#514">514</a>         accessor.updateProperty(propertyKey, <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/StatusUpdate.html">StatusUpdate</a>(statusUpdateRecord));
+<a class="jxr_linenumber" name="515" href="#515">515</a>         
+<a class="jxr_linenumber" name="516" href="#516">516</a>       }
+<a class="jxr_linenumber" name="517" href="#517">517</a>       _recordedMessages.put(message.getMsgId(), message.getMsgId());
+<a class="jxr_linenumber" name="518" href="#518">518</a>     }
+<a class="jxr_linenumber" name="519" href="#519">519</a> 
+<a class="jxr_linenumber" name="520" href="#520">520</a>     <strong class="jxr_keyword">if</strong> (instanceName.equalsIgnoreCase(<span class="jxr_string">"Controller"</span>))
+<a class="jxr_linenumber" name="521" href="#521">521</a>     {
+<a class="jxr_linenumber" name="522" href="#522">522</a>       accessor.updateProperty(keyBuilder.controllerTaskStatus(statusUpdateSubPath,
+<a class="jxr_linenumber" name="523" href="#523">523</a>                                                               statusUpdateKey),
+<a class="jxr_linenumber" name="524" href="#524">524</a>                               <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/StatusUpdate.html">StatusUpdate</a>(record));
+<a class="jxr_linenumber" name="525" href="#525">525</a>     }
+<a class="jxr_linenumber" name="526" href="#526">526</a>     <strong class="jxr_keyword">else</strong>
+<a class="jxr_linenumber" name="527" href="#527">527</a>     {
+<a class="jxr_linenumber" name="528" href="#528">528</a>       
+<a class="jxr_linenumber" name="529" href="#529">529</a>       <a href="../../../../org/apache/helix/PropertyKey.html">PropertyKey</a> propertyKey =
+<a class="jxr_linenumber" name="530" href="#530">530</a>           keyBuilder.stateTransitionStatus(instanceName,
+<a class="jxr_linenumber" name="531" href="#531">531</a>                                            sessionId,
+<a class="jxr_linenumber" name="532" href="#532">532</a>                                            statusUpdateSubPath,
+<a class="jxr_linenumber" name="533" href="#533">533</a>                                            statusUpdateKey);
+<a class="jxr_linenumber" name="534" href="#534">534</a>       <em class="jxr_comment">// For now write participant StatusUpdates to log4j. </em>
+<a class="jxr_linenumber" name="535" href="#535">535</a>       <em class="jxr_comment">// we are using restlet as another data channel to report to controller.</em>
+<a class="jxr_linenumber" name="536" href="#536">536</a>       <strong class="jxr_keyword">if</strong>(_logger.isTraceEnabled()){
+<a class="jxr_linenumber" name="537" href="#537">537</a>         _logger.trace(<span class="jxr_string">"StatusUpdate path:"</span> + propertyKey.getPath() + <span class="jxr_string">", updates:"</span> + record);
+<a class="jxr_linenumber" name="538" href="#538">538</a>       }
+<a class="jxr_linenumber" name="539" href="#539">539</a>       accessor.updateProperty(propertyKey, <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/StatusUpdate.html">StatusUpdate</a>(record));
+<a class="jxr_linenumber" name="540" href="#540">540</a>     }
+<a class="jxr_linenumber" name="541" href="#541">541</a> 
+<a class="jxr_linenumber" name="542" href="#542">542</a>     <em class="jxr_comment">// If the error level is ERROR, also write the record to "ERROR" ZNode</em>
+<a class="jxr_linenumber" name="543" href="#543">543</a>     <strong class="jxr_keyword">if</strong> (Level.HELIX_ERROR == level)
+<a class="jxr_linenumber" name="544" href="#544">544</a>     {
+<a class="jxr_linenumber" name="545" href="#545">545</a>       publishErrorRecord(record, message, accessor);
+<a class="jxr_linenumber" name="546" href="#546">546</a>     }
+<a class="jxr_linenumber" name="547" href="#547">547</a>   }
+<a class="jxr_linenumber" name="548" href="#548">548</a> 
+<a class="jxr_linenumber" name="549" href="#549">549</a>   <strong class="jxr_keyword">private</strong> String getStatusUpdateKey(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message)
+<a class="jxr_linenumber" name="550" href="#550">550</a>   {
+<a class="jxr_linenumber" name="551" href="#551">551</a>     <strong class="jxr_keyword">if</strong> (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
+<a class="jxr_linenumber" name="552" href="#552">552</a>     {
+<a class="jxr_linenumber" name="553" href="#553">553</a>       <strong class="jxr_keyword">return</strong> message.getPartitionName();
+<a class="jxr_linenumber" name="554" href="#554">554</a>     }
+<a class="jxr_linenumber" name="555" href="#555">555</a>     <strong class="jxr_keyword">return</strong> message.getMsgId();
+<a class="jxr_linenumber" name="556" href="#556">556</a>   }
+<a class="jxr_linenumber" name="557" href="#557">557</a> 
+<a class="jxr_linenumber" name="558" href="#558">558</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="559" href="#559">559</a> <em class="jxr_javadoccomment">   * Generate the sub-path under STATUSUPDATE or ERROR path for a status update</em>
+<a class="jxr_linenumber" name="560" href="#560">560</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="561" href="#561">561</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="562" href="#562">562</a>   String getStatusUpdateSubPath(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message)
+<a class="jxr_linenumber" name="563" href="#563">563</a>   {
+<a class="jxr_linenumber" name="564" href="#564">564</a>     <strong class="jxr_keyword">if</strong> (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
+<a class="jxr_linenumber" name="565" href="#565">565</a>     {
+<a class="jxr_linenumber" name="566" href="#566">566</a>       <strong class="jxr_keyword">return</strong> message.getResourceName();
+<a class="jxr_linenumber" name="567" href="#567">567</a>     }
+<a class="jxr_linenumber" name="568" href="#568">568</a>     <strong class="jxr_keyword">else</strong>
+<a class="jxr_linenumber" name="569" href="#569">569</a>     {
+<a class="jxr_linenumber" name="570" href="#570">570</a>       <strong class="jxr_keyword">return</strong> message.getMsgType();
+<a class="jxr_linenumber" name="571" href="#571">571</a>     }
+<a class="jxr_linenumber" name="572" href="#572">572</a>   }
+<a class="jxr_linenumber" name="573" href="#573">573</a> 
+<a class="jxr_linenumber" name="574" href="#574">574</a>   String getStatusUpdateRecordName(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message)
+<a class="jxr_linenumber" name="575" href="#575">575</a>   {
+<a class="jxr_linenumber" name="576" href="#576">576</a>     <strong class="jxr_keyword">if</strong> (message.getMsgType().equalsIgnoreCase(MessageType.STATE_TRANSITION.toString()))
+<a class="jxr_linenumber" name="577" href="#577">577</a>     {
+<a class="jxr_linenumber" name="578" href="#578">578</a>       <strong class="jxr_keyword">return</strong> message.getTgtSessionId() + <span class="jxr_string">"__"</span> + message.getResourceName();
+<a class="jxr_linenumber" name="579" href="#579">579</a>     }
+<a class="jxr_linenumber" name="580" href="#580">580</a>     <strong class="jxr_keyword">return</strong> message.getMsgId();
+<a class="jxr_linenumber" name="581" href="#581">581</a>   }
+<a class="jxr_linenumber" name="582" href="#582">582</a> 
+<a class="jxr_linenumber" name="583" href="#583">583</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="584" href="#584">584</a> <em class="jxr_javadoccomment">   * Write an error record to zookeeper to the zookeeper store.</em>
+<a class="jxr_linenumber" name="585" href="#585">585</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="586" href="#586">586</a> <em class="jxr_javadoccomment">   * @param record</em>
+<a class="jxr_linenumber" name="587" href="#587">587</a> <em class="jxr_javadoccomment">   *          the status update record</em>
+<a class="jxr_linenumber" name="588" href="#588">588</a> <em class="jxr_javadoccomment">   * @param message</em>
+<a class="jxr_linenumber" name="589" href="#589">589</a> <em class="jxr_javadoccomment">   *          the message to be logged</em>
+<a class="jxr_linenumber" name="590" href="#590">590</a> <em class="jxr_javadoccomment">   * @param accessor</em>
+<a class="jxr_linenumber" name="591" href="#591">591</a> <em class="jxr_javadoccomment">   *          the zookeeper data accessor that writes the status update to zookeeper</em>
+<a class="jxr_linenumber" name="592" href="#592">592</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="593" href="#593">593</a>   <strong class="jxr_keyword">void</strong> publishErrorRecord(<a href="../../../../org/apache/helix/ZNRecord.html">ZNRecord</a> record, <a href="../../../../org/apache/helix/model/Message.html">Message</a> message, <a href="../../../../org/apache/helix/HelixDataAccessor.html">HelixDataAccessor</a> accessor)
+<a class="jxr_linenumber" name="594" href="#594">594</a>   {
+<a class="jxr_linenumber" name="595" href="#595">595</a>     String instanceName = message.getTgtName();
+<a class="jxr_linenumber" name="596" href="#596">596</a>     String statusUpdateSubPath = getStatusUpdateSubPath(message);
+<a class="jxr_linenumber" name="597" href="#597">597</a>     String statusUpdateKey = getStatusUpdateKey(message);
+<a class="jxr_linenumber" name="598" href="#598">598</a>     String sessionId = message.getExecutionSessionId();
+<a class="jxr_linenumber" name="599" href="#599">599</a>     <strong class="jxr_keyword">if</strong> (sessionId == <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="600" href="#600">600</a>     {
+<a class="jxr_linenumber" name="601" href="#601">601</a>       sessionId = message.getTgtSessionId();
+<a class="jxr_linenumber" name="602" href="#602">602</a>     }
+<a class="jxr_linenumber" name="603" href="#603">603</a>     <strong class="jxr_keyword">if</strong> (sessionId == <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="604" href="#604">604</a>     {
+<a class="jxr_linenumber" name="605" href="#605">605</a>       sessionId = <span class="jxr_string">"*"</span>;
+<a class="jxr_linenumber" name="606" href="#606">606</a>     }
+<a class="jxr_linenumber" name="607" href="#607">607</a> 
+<a class="jxr_linenumber" name="608" href="#608">608</a>     <a href="../../../../org/apache/helix/PropertyKey.html">Builder</a> keyBuilder = accessor.keyBuilder();
+<a class="jxr_linenumber" name="609" href="#609">609</a> 
+<a class="jxr_linenumber" name="610" href="#610">610</a>     <em class="jxr_comment">// TODO remove the hard code: "controller"</em>
+<a class="jxr_linenumber" name="611" href="#611">611</a>     <strong class="jxr_keyword">if</strong> (instanceName.equalsIgnoreCase(<span class="jxr_string">"controller"</span>))
+<a class="jxr_linenumber" name="612" href="#612">612</a>     {
+<a class="jxr_linenumber" name="613" href="#613">613</a>       <em class="jxr_comment">// TODO need to fix: ERRORS_CONTROLLER doesn't have a form of</em>
+<a class="jxr_linenumber" name="614" href="#614">614</a>       <em class="jxr_comment">// ../{sessionId}/{subPath}</em>
+<a class="jxr_linenumber" name="615" href="#615">615</a>       <em class="jxr_comment">// accessor.setProperty(PropertyType.ERRORS_CONTROLLER, record,</em>
+<a class="jxr_linenumber" name="616" href="#616">616</a>       <em class="jxr_comment">// statusUpdateSubPath);</em>
+<a class="jxr_linenumber" name="617" href="#617">617</a>       accessor.setProperty(keyBuilder.controllerTaskError(statusUpdateSubPath),
+<a class="jxr_linenumber" name="618" href="#618">618</a>                            <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/Error.html">Error</a>(record));
+<a class="jxr_linenumber" name="619" href="#619">619</a>     }
+<a class="jxr_linenumber" name="620" href="#620">620</a>     <strong class="jxr_keyword">else</strong>
+<a class="jxr_linenumber" name="621" href="#621">621</a>     {
+<a class="jxr_linenumber" name="622" href="#622">622</a>       <em class="jxr_comment">// accessor.updateProperty(PropertyType.ERRORS,</em>
+<a class="jxr_linenumber" name="623" href="#623">623</a>       <em class="jxr_comment">// record,</em>
+<a class="jxr_linenumber" name="624" href="#624">624</a>       <em class="jxr_comment">// instanceName,</em>
+<a class="jxr_linenumber" name="625" href="#625">625</a>       <em class="jxr_comment">// sessionId,</em>
+<a class="jxr_linenumber" name="626" href="#626">626</a>       <em class="jxr_comment">// statusUpdateSubPath,</em>
+<a class="jxr_linenumber" name="627" href="#627">627</a>       <em class="jxr_comment">// statusUpdateKey);</em>
+<a class="jxr_linenumber" name="628" href="#628">628</a>       accessor.updateProperty(keyBuilder.stateTransitionError(instanceName,
+<a class="jxr_linenumber" name="629" href="#629">629</a>                                                               sessionId,
+<a class="jxr_linenumber" name="630" href="#630">630</a>                                                               statusUpdateSubPath,
+<a class="jxr_linenumber" name="631" href="#631">631</a>                                                               statusUpdateKey),
+<a class="jxr_linenumber" name="632" href="#632">632</a>                               <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/model/Error.html">Error</a>(record));
+<a class="jxr_linenumber" name="633" href="#633">633</a> 
+<a class="jxr_linenumber" name="634" href="#634">634</a>     }
+<a class="jxr_linenumber" name="635" href="#635">635</a>   }
+<a class="jxr_linenumber" name="636" href="#636">636</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