helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1406467 [14/19] - in /incubator/helix/site-content: ./ apidocs/assets/ apidocs/reference/ apidocs/reference/org/apache/helix/ apidocs/reference/org/apache/helix/examples/ apidocs/reference/org/apache/helix/manager/file/ apidocs/reference/o...
Date Wed, 07 Nov 2012 05:11:34 GMT
Modified: incubator/helix/site-content/xref/org/apache/helix/PropertyType.html
URL: http://svn.apache.org/viewvc/incubator/helix/site-content/xref/org/apache/helix/PropertyType.html?rev=1406467&r1=1406466&r2=1406467&view=diff
==============================================================================
--- incubator/helix/site-content/xref/org/apache/helix/PropertyType.html (original)
+++ incubator/helix/site-content/xref/org/apache/helix/PropertyType.html Wed Nov  7 05:11:27 2012
@@ -29,7 +29,7 @@
 <a class="jxr_linenumber" name="19" href="#19">19</a>  <em class="jxr_comment"> * under the License.</em>
 <a class="jxr_linenumber" name="20" href="#20">20</a>  <em class="jxr_comment"> */</em>
 <a class="jxr_linenumber" name="21" href="#21">21</a>  
-<a class="jxr_linenumber" name="22" href="#22">22</a>  enum <a href="../../../org/apache/helix/PropertyType.html">Type</a>
+<a class="jxr_linenumber" name="22" href="#22">22</a>  enum <a href="../../../org/apache/helix/NotificationContext.html">Type</a>
 <a class="jxr_linenumber" name="23" href="#23">23</a>  {
 <a class="jxr_linenumber" name="24" href="#24">24</a>    CLUSTER, INSTANCE, CONTROLLER, RESOURCE;
 <a class="jxr_linenumber" name="25" href="#25">25</a>  }
@@ -70,7 +70,7 @@
 <a class="jxr_linenumber" name="60" href="#60">60</a>  
 <a class="jxr_linenumber" name="61" href="#61">61</a>    <em class="jxr_comment">// @formatter:on</em>
 <a class="jxr_linenumber" name="62" href="#62">62</a>  
-<a class="jxr_linenumber" name="63" href="#63">63</a>    <a href="../../../org/apache/helix/PropertyType.html">Type</a>    type;
+<a class="jxr_linenumber" name="63" href="#63">63</a>    <a href="../../../org/apache/helix/NotificationContext.html">Type</a>    type;
 <a class="jxr_linenumber" name="64" href="#64">64</a>    
 <a class="jxr_linenumber" name="65" href="#65">65</a>    <strong class="jxr_keyword">boolean</strong> isPersistent;
 <a class="jxr_linenumber" name="66" href="#66">66</a>  
@@ -88,12 +88,12 @@
 <a class="jxr_linenumber" name="78" href="#78">78</a>  
 <a class="jxr_linenumber" name="79" href="#79">79</a>    <strong class="jxr_keyword">boolean</strong> usePropertyTransferServer;
 <a class="jxr_linenumber" name="80" href="#80">80</a>  
-<a class="jxr_linenumber" name="81" href="#81">81</a>    <strong class="jxr_keyword">private</strong> <a href="../../../org/apache/helix/PropertyType.html">PropertyType</a>(<a href="../../../org/apache/helix/PropertyType.html">Type</a> type, <strong class="jxr_keyword">boolean</strong> isPersistent, <strong class="jxr_keyword">boolean</strong> mergeOnUpdate)
+<a class="jxr_linenumber" name="81" href="#81">81</a>    <strong class="jxr_keyword">private</strong> <a href="../../../org/apache/helix/PropertyType.html">PropertyType</a>(<a href="../../../org/apache/helix/NotificationContext.html">Type</a> type, <strong class="jxr_keyword">boolean</strong> isPersistent, <strong class="jxr_keyword">boolean</strong> mergeOnUpdate)
 <a class="jxr_linenumber" name="82" href="#82">82</a>    {
 <a class="jxr_linenumber" name="83" href="#83">83</a>      <strong class="jxr_keyword">this</strong>(type, isPersistent, mergeOnUpdate, false);
 <a class="jxr_linenumber" name="84" href="#84">84</a>    }
 <a class="jxr_linenumber" name="85" href="#85">85</a>  
-<a class="jxr_linenumber" name="86" href="#86">86</a>    <strong class="jxr_keyword">private</strong> <a href="../../../org/apache/helix/PropertyType.html">PropertyType</a>(<a href="../../../org/apache/helix/PropertyType.html">Type</a> type,
+<a class="jxr_linenumber" name="86" href="#86">86</a>    <strong class="jxr_keyword">private</strong> <a href="../../../org/apache/helix/PropertyType.html">PropertyType</a>(<a href="../../../org/apache/helix/NotificationContext.html">Type</a> type,
 <a class="jxr_linenumber" name="87" href="#87">87</a>                         <strong class="jxr_keyword">boolean</strong> isPersistent,
 <a class="jxr_linenumber" name="88" href="#88">88</a>                         <strong class="jxr_keyword">boolean</strong> mergeOnUpdate,
 <a class="jxr_linenumber" name="89" href="#89">89</a>                         <strong class="jxr_keyword">boolean</strong> updateOnlyOnExists)
@@ -101,7 +101,7 @@
 <a class="jxr_linenumber" name="91" href="#91">91</a>      <strong class="jxr_keyword">this</strong>(type, isPersistent, mergeOnUpdate, false, false);
 <a class="jxr_linenumber" name="92" href="#92">92</a>    }
 <a class="jxr_linenumber" name="93" href="#93">93</a>  
-<a class="jxr_linenumber" name="94" href="#94">94</a>    <strong class="jxr_keyword">private</strong> <a href="../../../org/apache/helix/PropertyType.html">PropertyType</a>(<a href="../../../org/apache/helix/PropertyType.html">Type</a> type,
+<a class="jxr_linenumber" name="94" href="#94">94</a>    <strong class="jxr_keyword">private</strong> <a href="../../../org/apache/helix/PropertyType.html">PropertyType</a>(<a href="../../../org/apache/helix/NotificationContext.html">Type</a> type,
 <a class="jxr_linenumber" name="95" href="#95">95</a>                         <strong class="jxr_keyword">boolean</strong> isPersistent,
 <a class="jxr_linenumber" name="96" href="#96">96</a>                         <strong class="jxr_keyword">boolean</strong> mergeOnUpdate,
 <a class="jxr_linenumber" name="97" href="#97">97</a>                         <strong class="jxr_keyword">boolean</strong> updateOnlyOnExists,
@@ -110,7 +110,7 @@
 <a class="jxr_linenumber" name="100" href="#100">100</a>     <strong class="jxr_keyword">this</strong>(type, isPersistent, mergeOnUpdate, updateOnlyOnExists, createOnlyIfAbsent, false);
 <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>   <strong class="jxr_keyword">private</strong> <a href="../../../org/apache/helix/PropertyType.html">PropertyType</a>(<a href="../../../org/apache/helix/PropertyType.html">Type</a> type,
+<a class="jxr_linenumber" name="103" href="#103">103</a>   <strong class="jxr_keyword">private</strong> <a href="../../../org/apache/helix/PropertyType.html">PropertyType</a>(<a href="../../../org/apache/helix/NotificationContext.html">Type</a> type,
 <a class="jxr_linenumber" name="104" href="#104">104</a>                        <strong class="jxr_keyword">boolean</strong> isPersistent,
 <a class="jxr_linenumber" name="105" href="#105">105</a>                        <strong class="jxr_keyword">boolean</strong> mergeOnUpdate,
 <a class="jxr_linenumber" name="106" href="#106">106</a>                        <strong class="jxr_keyword">boolean</strong> updateOnlyOnExists,
@@ -126,7 +126,7 @@
 <a class="jxr_linenumber" name="116" href="#116">116</a>          false);
 <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">private</strong> <a href="../../../org/apache/helix/PropertyType.html">PropertyType</a>(<a href="../../../org/apache/helix/PropertyType.html">Type</a> type,
+<a class="jxr_linenumber" name="119" href="#119">119</a>   <strong class="jxr_keyword">private</strong> <a href="../../../org/apache/helix/PropertyType.html">PropertyType</a>(<a href="../../../org/apache/helix/NotificationContext.html">Type</a> type,
 <a class="jxr_linenumber" name="120" href="#120">120</a>                        <strong class="jxr_keyword">boolean</strong> isPersistent,
 <a class="jxr_linenumber" name="121" href="#121">121</a>                        <strong class="jxr_keyword">boolean</strong> mergeOnUpdate,
 <a class="jxr_linenumber" name="122" href="#122">122</a>                        <strong class="jxr_keyword">boolean</strong> updateOnlyOnExists,
@@ -153,12 +153,12 @@
 <a class="jxr_linenumber" name="143" href="#143">143</a>     <strong class="jxr_keyword">this</strong>.createOnlyIfAbsent = createIfAbsent;
 <a class="jxr_linenumber" name="144" href="#144">144</a>   }
 <a class="jxr_linenumber" name="145" href="#145">145</a> 
-<a class="jxr_linenumber" name="146" href="#146">146</a>   <strong class="jxr_keyword">public</strong> <a href="../../../org/apache/helix/PropertyType.html">Type</a> getType()
+<a class="jxr_linenumber" name="146" href="#146">146</a>   <strong class="jxr_keyword">public</strong> <a href="../../../org/apache/helix/NotificationContext.html">Type</a> getType()
 <a class="jxr_linenumber" name="147" href="#147">147</a>   {
 <a class="jxr_linenumber" name="148" href="#148">148</a>     <strong class="jxr_keyword">return</strong> type;
 <a class="jxr_linenumber" name="149" href="#149">149</a>   }
 <a class="jxr_linenumber" name="150" href="#150">150</a> 
-<a class="jxr_linenumber" name="151" href="#151">151</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setType(<a href="../../../org/apache/helix/PropertyType.html">Type</a> type)
+<a class="jxr_linenumber" name="151" href="#151">151</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setType(<a href="../../../org/apache/helix/NotificationContext.html">Type</a> type)
 <a class="jxr_linenumber" name="152" href="#152">152</a>   {
 <a class="jxr_linenumber" name="153" href="#153">153</a>     <strong class="jxr_keyword">this</strong>.type = type;
 <a class="jxr_linenumber" name="154" href="#154">154</a>   }

Modified: incubator/helix/site-content/xref/org/apache/helix/controller/HelixControllerMain.html
URL: http://svn.apache.org/viewvc/incubator/helix/site-content/xref/org/apache/helix/controller/HelixControllerMain.html?rev=1406467&r1=1406466&r2=1406467&view=diff
==============================================================================
--- incubator/helix/site-content/xref/org/apache/helix/controller/HelixControllerMain.html (original)
+++ incubator/helix/site-content/xref/org/apache/helix/controller/HelixControllerMain.html Wed Nov  7 05:11:27 2012
@@ -209,75 +209,74 @@
 <a class="jxr_linenumber" name="199" href="#199">199</a>       }
 <a class="jxr_linenumber" name="200" href="#200">200</a>     } <strong class="jxr_keyword">catch</strong> (Exception e)
 <a class="jxr_linenumber" name="201" href="#201">201</a>     {
-<a class="jxr_linenumber" name="202" href="#202">202</a>       <em class="jxr_comment">// TODO Auto-generated catch block</em>
-<a class="jxr_linenumber" name="203" href="#203">203</a>       e.printStackTrace();
-<a class="jxr_linenumber" name="204" href="#204">204</a>     }
-<a class="jxr_linenumber" name="205" href="#205">205</a> 
-<a class="jxr_linenumber" name="206" href="#206">206</a>     <strong class="jxr_keyword">return</strong> manager;
-<a class="jxr_linenumber" name="207" href="#207">207</a>   }
-<a class="jxr_linenumber" name="208" href="#208">208</a> 
-<a class="jxr_linenumber" name="209" href="#209">209</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> main(String[] args) <strong class="jxr_keyword">throws</strong> Exception
-<a class="jxr_linenumber" name="210" href="#210">210</a>   {
-<a class="jxr_linenumber" name="211" href="#211">211</a>     <em class="jxr_comment">// read the config;</em>
-<a class="jxr_linenumber" name="212" href="#212">212</a>     <em class="jxr_comment">// check if the this process is the master wait indefinitely</em>
-<a class="jxr_linenumber" name="213" href="#213">213</a>     <em class="jxr_comment">// other approach is always process the events but when updating the zk</em>
-<a class="jxr_linenumber" name="214" href="#214">214</a>     <em class="jxr_comment">// check if this is master.</em>
-<a class="jxr_linenumber" name="215" href="#215">215</a>     <em class="jxr_comment">// This is difficult to get right</em>
-<a class="jxr_linenumber" name="216" href="#216">216</a>     <em class="jxr_comment">// get the clusters to manage</em>
-<a class="jxr_linenumber" name="217" href="#217">217</a>     <em class="jxr_comment">// for each cluster create a manager</em>
-<a class="jxr_linenumber" name="218" href="#218">218</a>     <em class="jxr_comment">// add the respective listeners for each manager</em>
-<a class="jxr_linenumber" name="219" href="#219">219</a>     CommandLine cmd = processCommandLineArgs(args);
-<a class="jxr_linenumber" name="220" href="#220">220</a>     String zkConnectString = cmd.getOptionValue(zkServerAddress);
-<a class="jxr_linenumber" name="221" href="#221">221</a>     String clusterName = cmd.getOptionValue(cluster);
-<a class="jxr_linenumber" name="222" href="#222">222</a>     String controllerMode = STANDALONE;
-<a class="jxr_linenumber" name="223" href="#223">223</a>     String controllerName = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="224" href="#224">224</a>     <strong class="jxr_keyword">int</strong> propertyTransServicePort = -1;
-<a class="jxr_linenumber" name="225" href="#225">225</a>     
-<a class="jxr_linenumber" name="226" href="#226">226</a>     <strong class="jxr_keyword">if</strong> (cmd.hasOption(mode))
-<a class="jxr_linenumber" name="227" href="#227">227</a>     {
-<a class="jxr_linenumber" name="228" href="#228">228</a>       controllerMode = cmd.getOptionValue(mode);
-<a class="jxr_linenumber" name="229" href="#229">229</a>     }
-<a class="jxr_linenumber" name="230" href="#230">230</a>     
-<a class="jxr_linenumber" name="231" href="#231">231</a>     <strong class="jxr_keyword">if</strong>(cmd.hasOption(propertyTransferServicePort))
-<a class="jxr_linenumber" name="232" href="#232">232</a>     {
-<a class="jxr_linenumber" name="233" href="#233">233</a>         propertyTransServicePort = Integer.parseInt(cmd.getOptionValue(propertyTransferServicePort));
-<a class="jxr_linenumber" name="234" href="#234">234</a>     }
-<a class="jxr_linenumber" name="235" href="#235">235</a>     <strong class="jxr_keyword">if</strong> (controllerMode.equalsIgnoreCase(DISTRIBUTED) &amp;&amp; !cmd.hasOption(name))
-<a class="jxr_linenumber" name="236" href="#236">236</a>     {
-<a class="jxr_linenumber" name="237" href="#237">237</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(
-<a class="jxr_linenumber" name="238" href="#238">238</a>           <span class="jxr_string">"A unique cluster controller name is required in DISTRIBUTED mode"</span>);
-<a class="jxr_linenumber" name="239" href="#239">239</a>     }
-<a class="jxr_linenumber" name="240" href="#240">240</a> 
-<a class="jxr_linenumber" name="241" href="#241">241</a>     controllerName = cmd.getOptionValue(name);
-<a class="jxr_linenumber" name="242" href="#242">242</a> 
-<a class="jxr_linenumber" name="243" href="#243">243</a>     <em class="jxr_comment">// Espresso_driver.py will consume this</em>
-<a class="jxr_linenumber" name="244" href="#244">244</a>     logger.info(<span class="jxr_string">"Cluster manager started, zkServer: "</span> + zkConnectString + <span class="jxr_string">", clusterName:"</span>
-<a class="jxr_linenumber" name="245" href="#245">245</a>         + clusterName + <span class="jxr_string">", controllerName:"</span> + controllerName + <span class="jxr_string">", mode:"</span> + controllerMode);
-<a class="jxr_linenumber" name="246" href="#246">246</a> 
-<a class="jxr_linenumber" name="247" href="#247">247</a>     <strong class="jxr_keyword">if</strong> (propertyTransServicePort &gt; 0)
-<a class="jxr_linenumber" name="248" href="#248">248</a>     {
-<a class="jxr_linenumber" name="249" href="#249">249</a>       ZKPropertyTransferServer.getInstance().init(propertyTransServicePort, zkConnectString);
-<a class="jxr_linenumber" name="250" href="#250">250</a>     }
-<a class="jxr_linenumber" name="251" href="#251">251</a>     
-<a class="jxr_linenumber" name="252" href="#252">252</a>     <a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a> manager = startHelixController(zkConnectString, clusterName, controllerName,
-<a class="jxr_linenumber" name="253" href="#253">253</a>         controllerMode);
-<a class="jxr_linenumber" name="254" href="#254">254</a>     <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="255" href="#255">255</a>     {
-<a class="jxr_linenumber" name="256" href="#256">256</a>       Thread.currentThread().join();
-<a class="jxr_linenumber" name="257" href="#257">257</a>     } 
-<a class="jxr_linenumber" name="258" href="#258">258</a>     <strong class="jxr_keyword">catch</strong> (InterruptedException e)
-<a class="jxr_linenumber" name="259" href="#259">259</a>     {
-<a class="jxr_linenumber" name="260" href="#260">260</a>       logger.info(<span class="jxr_string">"controller:"</span> + controllerName + <span class="jxr_string">", "</span> + Thread.currentThread().getName()
-<a class="jxr_linenumber" name="261" href="#261">261</a>           + <span class="jxr_string">" interrupted"</span>);
-<a class="jxr_linenumber" name="262" href="#262">262</a>     }
-<a class="jxr_linenumber" name="263" href="#263">263</a>     <strong class="jxr_keyword">finally</strong>
-<a class="jxr_linenumber" name="264" href="#264">264</a>     {
-<a class="jxr_linenumber" name="265" href="#265">265</a>       manager.disconnect();
-<a class="jxr_linenumber" name="266" href="#266">266</a>       ZKPropertyTransferServer.getInstance().shutdown();
-<a class="jxr_linenumber" name="267" href="#267">267</a>     }
-<a class="jxr_linenumber" name="268" href="#268">268</a> 
-<a class="jxr_linenumber" name="269" href="#269">269</a>   }
-<a class="jxr_linenumber" name="270" href="#270">270</a> }
+<a class="jxr_linenumber" name="202" href="#202">202</a>       logger.error(<span class="jxr_string">"Exception while starting controller"</span>,e);
+<a class="jxr_linenumber" name="203" href="#203">203</a>     }
+<a class="jxr_linenumber" name="204" href="#204">204</a> 
+<a class="jxr_linenumber" name="205" href="#205">205</a>     <strong class="jxr_keyword">return</strong> manager;
+<a class="jxr_linenumber" name="206" href="#206">206</a>   }
+<a class="jxr_linenumber" name="207" href="#207">207</a> 
+<a class="jxr_linenumber" name="208" href="#208">208</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> main(String[] args) <strong class="jxr_keyword">throws</strong> Exception
+<a class="jxr_linenumber" name="209" href="#209">209</a>   {
+<a class="jxr_linenumber" name="210" href="#210">210</a>     <em class="jxr_comment">// read the config;</em>
+<a class="jxr_linenumber" name="211" href="#211">211</a>     <em class="jxr_comment">// check if the this process is the master wait indefinitely</em>
+<a class="jxr_linenumber" name="212" href="#212">212</a>     <em class="jxr_comment">// other approach is always process the events but when updating the zk</em>
+<a class="jxr_linenumber" name="213" href="#213">213</a>     <em class="jxr_comment">// check if this is master.</em>
+<a class="jxr_linenumber" name="214" href="#214">214</a>     <em class="jxr_comment">// This is difficult to get right</em>
+<a class="jxr_linenumber" name="215" href="#215">215</a>     <em class="jxr_comment">// get the clusters to manage</em>
+<a class="jxr_linenumber" name="216" href="#216">216</a>     <em class="jxr_comment">// for each cluster create a manager</em>
+<a class="jxr_linenumber" name="217" href="#217">217</a>     <em class="jxr_comment">// add the respective listeners for each manager</em>
+<a class="jxr_linenumber" name="218" href="#218">218</a>     CommandLine cmd = processCommandLineArgs(args);
+<a class="jxr_linenumber" name="219" href="#219">219</a>     String zkConnectString = cmd.getOptionValue(zkServerAddress);
+<a class="jxr_linenumber" name="220" href="#220">220</a>     String clusterName = cmd.getOptionValue(cluster);
+<a class="jxr_linenumber" name="221" href="#221">221</a>     String controllerMode = STANDALONE;
+<a class="jxr_linenumber" name="222" href="#222">222</a>     String controllerName = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="223" href="#223">223</a>     <strong class="jxr_keyword">int</strong> propertyTransServicePort = -1;
+<a class="jxr_linenumber" name="224" href="#224">224</a>     
+<a class="jxr_linenumber" name="225" href="#225">225</a>     <strong class="jxr_keyword">if</strong> (cmd.hasOption(mode))
+<a class="jxr_linenumber" name="226" href="#226">226</a>     {
+<a class="jxr_linenumber" name="227" href="#227">227</a>       controllerMode = cmd.getOptionValue(mode);
+<a class="jxr_linenumber" name="228" href="#228">228</a>     }
+<a class="jxr_linenumber" name="229" href="#229">229</a>     
+<a class="jxr_linenumber" name="230" href="#230">230</a>     <strong class="jxr_keyword">if</strong>(cmd.hasOption(propertyTransferServicePort))
+<a class="jxr_linenumber" name="231" href="#231">231</a>     {
+<a class="jxr_linenumber" name="232" href="#232">232</a>         propertyTransServicePort = Integer.parseInt(cmd.getOptionValue(propertyTransferServicePort));
+<a class="jxr_linenumber" name="233" href="#233">233</a>     }
+<a class="jxr_linenumber" name="234" href="#234">234</a>     <strong class="jxr_keyword">if</strong> (controllerMode.equalsIgnoreCase(DISTRIBUTED) &amp;&amp; !cmd.hasOption(name))
+<a class="jxr_linenumber" name="235" href="#235">235</a>     {
+<a class="jxr_linenumber" name="236" href="#236">236</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(
+<a class="jxr_linenumber" name="237" href="#237">237</a>           <span class="jxr_string">"A unique cluster controller name is required in DISTRIBUTED mode"</span>);
+<a class="jxr_linenumber" name="238" href="#238">238</a>     }
+<a class="jxr_linenumber" name="239" href="#239">239</a> 
+<a class="jxr_linenumber" name="240" href="#240">240</a>     controllerName = cmd.getOptionValue(name);
+<a class="jxr_linenumber" name="241" href="#241">241</a> 
+<a class="jxr_linenumber" name="242" href="#242">242</a>     <em class="jxr_comment">// Espresso_driver.py will consume this</em>
+<a class="jxr_linenumber" name="243" href="#243">243</a>     logger.info(<span class="jxr_string">"Cluster manager started, zkServer: "</span> + zkConnectString + <span class="jxr_string">", clusterName:"</span>
+<a class="jxr_linenumber" name="244" href="#244">244</a>         + clusterName + <span class="jxr_string">", controllerName:"</span> + controllerName + <span class="jxr_string">", mode:"</span> + controllerMode);
+<a class="jxr_linenumber" name="245" href="#245">245</a> 
+<a class="jxr_linenumber" name="246" href="#246">246</a>     <strong class="jxr_keyword">if</strong> (propertyTransServicePort &gt; 0)
+<a class="jxr_linenumber" name="247" href="#247">247</a>     {
+<a class="jxr_linenumber" name="248" href="#248">248</a>       ZKPropertyTransferServer.getInstance().init(propertyTransServicePort, zkConnectString);
+<a class="jxr_linenumber" name="249" href="#249">249</a>     }
+<a class="jxr_linenumber" name="250" href="#250">250</a>     
+<a class="jxr_linenumber" name="251" href="#251">251</a>     <a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a> manager = startHelixController(zkConnectString, clusterName, controllerName,
+<a class="jxr_linenumber" name="252" href="#252">252</a>         controllerMode);
+<a class="jxr_linenumber" name="253" href="#253">253</a>     <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="254" href="#254">254</a>     {
+<a class="jxr_linenumber" name="255" href="#255">255</a>       Thread.currentThread().join();
+<a class="jxr_linenumber" name="256" href="#256">256</a>     } 
+<a class="jxr_linenumber" name="257" href="#257">257</a>     <strong class="jxr_keyword">catch</strong> (InterruptedException e)
+<a class="jxr_linenumber" name="258" href="#258">258</a>     {
+<a class="jxr_linenumber" name="259" href="#259">259</a>       logger.info(<span class="jxr_string">"controller:"</span> + controllerName + <span class="jxr_string">", "</span> + Thread.currentThread().getName()
+<a class="jxr_linenumber" name="260" href="#260">260</a>           + <span class="jxr_string">" interrupted"</span>);
+<a class="jxr_linenumber" name="261" href="#261">261</a>     }
+<a class="jxr_linenumber" name="262" href="#262">262</a>     <strong class="jxr_keyword">finally</strong>
+<a class="jxr_linenumber" name="263" href="#263">263</a>     {
+<a class="jxr_linenumber" name="264" href="#264">264</a>       manager.disconnect();
+<a class="jxr_linenumber" name="265" href="#265">265</a>       ZKPropertyTransferServer.getInstance().shutdown();
+<a class="jxr_linenumber" name="266" href="#266">266</a>     }
+<a class="jxr_linenumber" name="267" href="#267">267</a> 
+<a class="jxr_linenumber" name="268" href="#268">268</a>   }
+<a class="jxr_linenumber" name="269" href="#269">269</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/examples/ExampleProcess.html
URL: http://svn.apache.org/viewvc/incubator/helix/site-content/xref/org/apache/helix/examples/ExampleProcess.html?rev=1406467&r1=1406466&r2=1406467&view=diff
==============================================================================
--- incubator/helix/site-content/xref/org/apache/helix/examples/ExampleProcess.html (original)
+++ incubator/helix/site-content/xref/org/apache/helix/examples/ExampleProcess.html Wed Nov  7 05:11:27 2012
@@ -49,86 +49,86 @@
 <a class="jxr_linenumber" name="39" href="#39">39</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.participant.statemachine.StateModelFactory;
 <a class="jxr_linenumber" name="40" href="#40">40</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.tools.ClusterStateVerifier;
 <a class="jxr_linenumber" name="41" href="#41">41</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">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/helix/examples/ExampleProcess.html">ExampleProcess</a>
-<a class="jxr_linenumber" name="44" href="#44">44</a>  {
-<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> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String zkServer = <span class="jxr_string">"zkSvr"</span>;
-<a class="jxr_linenumber" name="47" href="#47">47</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String cluster = <span class="jxr_string">"cluster"</span>;
-<a class="jxr_linenumber" name="48" href="#48">48</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String hostAddress = <span class="jxr_string">"host"</span>;
-<a class="jxr_linenumber" name="49" href="#49">49</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String hostPort = <span class="jxr_string">"port"</span>;
-<a class="jxr_linenumber" name="50" href="#50">50</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String relayCluster = <span class="jxr_string">"relayCluster"</span>;
-<a class="jxr_linenumber" name="51" href="#51">51</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String help = <span class="jxr_string">"help"</span>;
-<a class="jxr_linenumber" name="52" href="#52">52</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String configFile = <span class="jxr_string">"configFile"</span>;
-<a class="jxr_linenumber" name="53" href="#53">53</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String stateModel = <span class="jxr_string">"stateModelType"</span>;
-<a class="jxr_linenumber" name="54" href="#54">54</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String transDelay = <span class="jxr_string">"transDelay"</span>;
-<a class="jxr_linenumber" name="55" href="#55">55</a>  
-<a class="jxr_linenumber" name="56" href="#56">56</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String zkConnectString;
-<a class="jxr_linenumber" name="57" href="#57">57</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String clusterName;
-<a class="jxr_linenumber" name="58" href="#58">58</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String instanceName;
-<a class="jxr_linenumber" name="59" href="#59">59</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String stateModelType;
-<a class="jxr_linenumber" name="60" href="#60">60</a>    <strong class="jxr_keyword">private</strong> <a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a> manager;
-<a class="jxr_linenumber" name="61" href="#61">61</a>  
-<a class="jxr_linenumber" name="62" href="#62">62</a>  <em class="jxr_comment">//  private StateMachineEngine genericStateMachineHandler;</em>
-<a class="jxr_linenumber" name="63" href="#63">63</a>  
-<a class="jxr_linenumber" name="64" href="#64">64</a>    <strong class="jxr_keyword">private</strong> String _file = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="65" href="#65">65</a>    <strong class="jxr_keyword">private</strong> StateModelFactory&lt;StateModel&gt; stateModelFactory;
-<a class="jxr_linenumber" name="66" href="#66">66</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> delay;
-<a class="jxr_linenumber" name="67" href="#67">67</a>  
-<a class="jxr_linenumber" name="68" href="#68">68</a>    <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/helix/examples/ExampleProcess.html">ExampleProcess</a>(String zkConnectString, String clusterName,
-<a class="jxr_linenumber" name="69" href="#69">69</a>        String instanceName, String file, String stateModel, <strong class="jxr_keyword">int</strong> delay)
-<a class="jxr_linenumber" name="70" href="#70">70</a>    {
-<a class="jxr_linenumber" name="71" href="#71">71</a>      <strong class="jxr_keyword">this</strong>.zkConnectString = zkConnectString;
-<a class="jxr_linenumber" name="72" href="#72">72</a>      <strong class="jxr_keyword">this</strong>.clusterName = clusterName;
-<a class="jxr_linenumber" name="73" href="#73">73</a>      <strong class="jxr_keyword">this</strong>.instanceName = instanceName;
-<a class="jxr_linenumber" name="74" href="#74">74</a>      <strong class="jxr_keyword">this</strong>._file = file;
-<a class="jxr_linenumber" name="75" href="#75">75</a>      stateModelType = stateModel;
-<a class="jxr_linenumber" name="76" href="#76">76</a>      <strong class="jxr_keyword">this</strong>.delay = delay;
-<a class="jxr_linenumber" name="77" href="#77">77</a>    }
-<a class="jxr_linenumber" name="78" href="#78">78</a>  
-<a class="jxr_linenumber" name="79" href="#79">79</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> start() <strong class="jxr_keyword">throws</strong> Exception
-<a class="jxr_linenumber" name="80" href="#80">80</a>    {
-<a class="jxr_linenumber" name="81" href="#81">81</a>      <strong class="jxr_keyword">if</strong> (_file == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="82" href="#82">82</a>      {
-<a class="jxr_linenumber" name="83" href="#83">83</a>        manager = HelixManagerFactory.getZKHelixManager(clusterName,
-<a class="jxr_linenumber" name="84" href="#84">84</a>                                                            instanceName,
-<a class="jxr_linenumber" name="85" href="#85">85</a>                                                            InstanceType.PARTICIPANT,
-<a class="jxr_linenumber" name="86" href="#86">86</a>                                                            zkConnectString);
-<a class="jxr_linenumber" name="87" href="#87">87</a>  
-<a class="jxr_linenumber" name="88" href="#88">88</a>      }
-<a class="jxr_linenumber" name="89" href="#89">89</a>      <strong class="jxr_keyword">else</strong>
-<a class="jxr_linenumber" name="90" href="#90">90</a>      {
-<a class="jxr_linenumber" name="91" href="#91">91</a>        manager = HelixManagerFactory.getStaticFileHelixManager(clusterName,
-<a class="jxr_linenumber" name="92" href="#92">92</a>                                                                    instanceName,
-<a class="jxr_linenumber" name="93" href="#93">93</a>                                                                    InstanceType.PARTICIPANT,
-<a class="jxr_linenumber" name="94" href="#94">94</a>                                                                    _file);
-<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>  
-<a class="jxr_linenumber" name="98" href="#98">98</a>      <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"MasterSlave"</span>.equalsIgnoreCase(stateModelType))
+<a class="jxr_linenumber" name="42" href="#42">42</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/helix/examples/ExampleProcess.html">ExampleProcess</a>
+<a class="jxr_linenumber" name="43" href="#43">43</a>  {
+<a class="jxr_linenumber" name="44" href="#44">44</a>  
+<a class="jxr_linenumber" name="45" href="#45">45</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String zkServer = <span class="jxr_string">"zkSvr"</span>;
+<a class="jxr_linenumber" name="46" href="#46">46</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String cluster = <span class="jxr_string">"cluster"</span>;
+<a class="jxr_linenumber" name="47" href="#47">47</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String hostAddress = <span class="jxr_string">"host"</span>;
+<a class="jxr_linenumber" name="48" href="#48">48</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String hostPort = <span class="jxr_string">"port"</span>;
+<a class="jxr_linenumber" name="49" href="#49">49</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String relayCluster = <span class="jxr_string">"relayCluster"</span>;
+<a class="jxr_linenumber" name="50" href="#50">50</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String help = <span class="jxr_string">"help"</span>;
+<a class="jxr_linenumber" name="51" href="#51">51</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String configFile = <span class="jxr_string">"configFile"</span>;
+<a class="jxr_linenumber" name="52" href="#52">52</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String stateModel = <span class="jxr_string">"stateModelType"</span>;
+<a class="jxr_linenumber" name="53" href="#53">53</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String transDelay = <span class="jxr_string">"transDelay"</span>;
+<a class="jxr_linenumber" name="54" href="#54">54</a>  
+<a class="jxr_linenumber" name="55" href="#55">55</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String zkConnectString;
+<a class="jxr_linenumber" name="56" href="#56">56</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String clusterName;
+<a class="jxr_linenumber" name="57" href="#57">57</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String instanceName;
+<a class="jxr_linenumber" name="58" href="#58">58</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String stateModelType;
+<a class="jxr_linenumber" name="59" href="#59">59</a>    <strong class="jxr_keyword">private</strong> <a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a> manager;
+<a class="jxr_linenumber" name="60" href="#60">60</a>  
+<a class="jxr_linenumber" name="61" href="#61">61</a>    <em class="jxr_comment">// private StateMachineEngine genericStateMachineHandler;</em>
+<a class="jxr_linenumber" name="62" href="#62">62</a>  
+<a class="jxr_linenumber" name="63" href="#63">63</a>    <strong class="jxr_keyword">private</strong> String _file = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="64" href="#64">64</a>    <strong class="jxr_keyword">private</strong> StateModelFactory&lt;StateModel&gt; stateModelFactory;
+<a class="jxr_linenumber" name="65" href="#65">65</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> delay;
+<a class="jxr_linenumber" name="66" href="#66">66</a>  
+<a class="jxr_linenumber" name="67" href="#67">67</a>    <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/helix/examples/ExampleProcess.html">ExampleProcess</a>(String zkConnectString, String clusterName,
+<a class="jxr_linenumber" name="68" href="#68">68</a>        String instanceName, String file, String stateModel, <strong class="jxr_keyword">int</strong> delay)
+<a class="jxr_linenumber" name="69" href="#69">69</a>    {
+<a class="jxr_linenumber" name="70" href="#70">70</a>      <strong class="jxr_keyword">this</strong>.zkConnectString = zkConnectString;
+<a class="jxr_linenumber" name="71" href="#71">71</a>      <strong class="jxr_keyword">this</strong>.clusterName = clusterName;
+<a class="jxr_linenumber" name="72" href="#72">72</a>      <strong class="jxr_keyword">this</strong>.instanceName = instanceName;
+<a class="jxr_linenumber" name="73" href="#73">73</a>      <strong class="jxr_keyword">this</strong>._file = file;
+<a class="jxr_linenumber" name="74" href="#74">74</a>      stateModelType = stateModel;
+<a class="jxr_linenumber" name="75" href="#75">75</a>      <strong class="jxr_keyword">this</strong>.delay = delay;
+<a class="jxr_linenumber" name="76" href="#76">76</a>    }
+<a class="jxr_linenumber" name="77" href="#77">77</a>  
+<a class="jxr_linenumber" name="78" href="#78">78</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> start() <strong class="jxr_keyword">throws</strong> Exception
+<a class="jxr_linenumber" name="79" href="#79">79</a>    {
+<a class="jxr_linenumber" name="80" href="#80">80</a>      <strong class="jxr_keyword">if</strong> (_file == <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="81" href="#81">81</a>      {
+<a class="jxr_linenumber" name="82" href="#82">82</a>        manager = HelixManagerFactory.getZKHelixManager(clusterName,
+<a class="jxr_linenumber" name="83" href="#83">83</a>            instanceName, InstanceType.PARTICIPANT, zkConnectString);
+<a class="jxr_linenumber" name="84" href="#84">84</a>  
+<a class="jxr_linenumber" name="85" href="#85">85</a>      } <strong class="jxr_keyword">else</strong>
+<a class="jxr_linenumber" name="86" href="#86">86</a>      {
+<a class="jxr_linenumber" name="87" href="#87">87</a>        manager = HelixManagerFactory.getStaticFileHelixManager(clusterName,
+<a class="jxr_linenumber" name="88" href="#88">88</a>            instanceName, InstanceType.PARTICIPANT, _file);
+<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">if</strong> (<span class="jxr_string">"MasterSlave"</span>.equalsIgnoreCase(stateModelType))
+<a class="jxr_linenumber" name="93" href="#93">93</a>      {
+<a class="jxr_linenumber" name="94" href="#94">94</a>        stateModelFactory = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModelFactory</a>(delay);
+<a class="jxr_linenumber" name="95" href="#95">95</a>      } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"OnlineOffline"</span>.equalsIgnoreCase(stateModelType))
+<a class="jxr_linenumber" name="96" href="#96">96</a>      {
+<a class="jxr_linenumber" name="97" href="#97">97</a>        stateModelFactory = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/examples/OnlineOfflineStateModelFactory.html">OnlineOfflineStateModelFactory</a>(delay);
+<a class="jxr_linenumber" name="98" href="#98">98</a>      } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"LeaderStandby"</span>.equalsIgnoreCase(stateModelType))
 <a class="jxr_linenumber" name="99" href="#99">99</a>      {
-<a class="jxr_linenumber" name="100" href="#100">100</a>       stateModelFactory = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModelFactory</a>(delay);
-<a class="jxr_linenumber" name="101" href="#101">101</a>     } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"OnlineOffline"</span>.equalsIgnoreCase(stateModelType))
-<a class="jxr_linenumber" name="102" href="#102">102</a>     {
-<a class="jxr_linenumber" name="103" href="#103">103</a>       stateModelFactory = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/examples/OnlineOfflineStateModelFactory.html">OnlineOfflineStateModelFactory</a>(delay);
-<a class="jxr_linenumber" name="104" href="#104">104</a>     } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"LeaderStandby"</span>.equalsIgnoreCase(stateModelType))
-<a class="jxr_linenumber" name="105" href="#105">105</a>     {
-<a class="jxr_linenumber" name="106" href="#106">106</a>       stateModelFactory = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/examples/LeaderStandbyStateModelFactory.html">LeaderStandbyStateModelFactory</a>(delay);
-<a class="jxr_linenumber" name="107" href="#107">107</a>     }
-<a class="jxr_linenumber" name="108" href="#108">108</a> <em class="jxr_comment">//    genericStateMachineHandler = new StateMachineEngine();</em>
-<a class="jxr_linenumber" name="109" href="#109">109</a> <em class="jxr_comment">//    genericStateMachineHandler.registerStateModelFactory(stateModelType, stateModelFactory);</em>
-<a class="jxr_linenumber" name="110" href="#110">110</a>     
-<a class="jxr_linenumber" name="111" href="#111">111</a>     <a href="../../../../org/apache/helix/participant/StateMachineEngine.html">StateMachineEngine</a> stateMach = manager.getStateMachineEngine();
-<a class="jxr_linenumber" name="112" href="#112">112</a>     stateMach.registerStateModelFactory(stateModelType, stateModelFactory);
-<a class="jxr_linenumber" name="113" href="#113">113</a>     manager.connect();
-<a class="jxr_linenumber" name="114" href="#114">114</a>     manager.getMessagingService().registerMessageHandlerFactory(
-<a class="jxr_linenumber" name="115" href="#115">115</a>         MessageType.STATE_TRANSITION.toString(), stateMach);
-<a class="jxr_linenumber" name="116" href="#116">116</a>     <strong class="jxr_keyword">if</strong> (_file != <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="117" href="#117">117</a>     {
-<a class="jxr_linenumber" name="118" href="#118">118</a>       ClusterStateVerifier.verifyFileBasedClusterStates(_file, instanceName,
-<a class="jxr_linenumber" name="119" href="#119">119</a>           stateModelFactory);
-<a class="jxr_linenumber" name="120" href="#120">120</a> 
-<a class="jxr_linenumber" name="121" href="#121">121</a>     }
+<a class="jxr_linenumber" name="100" href="#100">100</a>       stateModelFactory = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/examples/LeaderStandbyStateModelFactory.html">LeaderStandbyStateModelFactory</a>(delay);
+<a class="jxr_linenumber" name="101" href="#101">101</a>     }
+<a class="jxr_linenumber" name="102" href="#102">102</a>     <em class="jxr_comment">// genericStateMachineHandler = new StateMachineEngine();</em>
+<a class="jxr_linenumber" name="103" href="#103">103</a>     <em class="jxr_comment">// genericStateMachineHandler.registerStateModelFactory(stateModelType,</em>
+<a class="jxr_linenumber" name="104" href="#104">104</a>     <em class="jxr_comment">// stateModelFactory);</em>
+<a class="jxr_linenumber" name="105" href="#105">105</a> 
+<a class="jxr_linenumber" name="106" href="#106">106</a>     <a href="../../../../org/apache/helix/participant/StateMachineEngine.html">StateMachineEngine</a> stateMach = manager.getStateMachineEngine();
+<a class="jxr_linenumber" name="107" href="#107">107</a>     stateMach.registerStateModelFactory(stateModelType, stateModelFactory);
+<a class="jxr_linenumber" name="108" href="#108">108</a>     manager.connect();
+<a class="jxr_linenumber" name="109" href="#109">109</a>     manager.getMessagingService().registerMessageHandlerFactory(
+<a class="jxr_linenumber" name="110" href="#110">110</a>         MessageType.STATE_TRANSITION.toString(), stateMach);
+<a class="jxr_linenumber" name="111" href="#111">111</a>     <strong class="jxr_keyword">if</strong> (_file != <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="112" href="#112">112</a>     {
+<a class="jxr_linenumber" name="113" href="#113">113</a>       ClusterStateVerifier.verifyFileBasedClusterStates(_file, instanceName,
+<a class="jxr_linenumber" name="114" href="#114">114</a>           stateModelFactory);
+<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">public</strong> <strong class="jxr_keyword">void</strong> stop()
+<a class="jxr_linenumber" name="120" href="#120">120</a>   {
+<a class="jxr_linenumber" name="121" href="#121">121</a>     manager.disconnect();
 <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>   @SuppressWarnings(<span class="jxr_string">"static-access"</span>)
@@ -201,86 +201,87 @@
 <a class="jxr_linenumber" name="191" href="#191">191</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> printUsage(Options cliOptions)
 <a class="jxr_linenumber" name="192" href="#192">192</a>   {
 <a class="jxr_linenumber" name="193" href="#193">193</a>     HelpFormatter helpFormatter = <strong class="jxr_keyword">new</strong> HelpFormatter();
-<a class="jxr_linenumber" name="194" href="#194">194</a>     helpFormatter.printHelp(<span class="jxr_string">"java "</span> + ExampleProcess.<strong class="jxr_keyword">class</strong>.getName(), cliOptions);
-<a class="jxr_linenumber" name="195" href="#195">195</a>   }
-<a class="jxr_linenumber" name="196" href="#196">196</a> 
-<a class="jxr_linenumber" name="197" href="#197">197</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> CommandLine processCommandLineArgs(String[] cliArgs)
-<a class="jxr_linenumber" name="198" href="#198">198</a>       <strong class="jxr_keyword">throws</strong> Exception
-<a class="jxr_linenumber" name="199" href="#199">199</a>   {
-<a class="jxr_linenumber" name="200" href="#200">200</a>     CommandLineParser cliParser = <strong class="jxr_keyword">new</strong> GnuParser();
-<a class="jxr_linenumber" name="201" href="#201">201</a>     Options cliOptions = constructCommandLineOptions();
-<a class="jxr_linenumber" name="202" href="#202">202</a>     <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="203" href="#203">203</a>     {
-<a class="jxr_linenumber" name="204" href="#204">204</a>       <strong class="jxr_keyword">return</strong> cliParser.parse(cliOptions, cliArgs);
-<a class="jxr_linenumber" name="205" href="#205">205</a>     } <strong class="jxr_keyword">catch</strong> (ParseException pe)
-<a class="jxr_linenumber" name="206" href="#206">206</a>     {
-<a class="jxr_linenumber" name="207" href="#207">207</a>       System.err
-<a class="jxr_linenumber" name="208" href="#208">208</a>           .println(<span class="jxr_string">"CommandLineClient: failed to parse command-line options: "</span>
-<a class="jxr_linenumber" name="209" href="#209">209</a>               + pe.toString());
-<a class="jxr_linenumber" name="210" href="#210">210</a>       printUsage(cliOptions);
-<a class="jxr_linenumber" name="211" href="#211">211</a>       System.exit(1);
-<a class="jxr_linenumber" name="212" href="#212">212</a>     }
-<a class="jxr_linenumber" name="213" href="#213">213</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="214" href="#214">214</a>   }
-<a class="jxr_linenumber" name="215" href="#215">215</a> 
-<a class="jxr_linenumber" name="216" href="#216">216</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> main(String[] args) <strong class="jxr_keyword">throws</strong> Exception
-<a class="jxr_linenumber" name="217" href="#217">217</a>   {
-<a class="jxr_linenumber" name="218" href="#218">218</a>     String zkConnectString = <span class="jxr_string">"localhost:2181"</span>;
-<a class="jxr_linenumber" name="219" href="#219">219</a>     String clusterName = <span class="jxr_string">"storage-integration-cluster"</span>;
-<a class="jxr_linenumber" name="220" href="#220">220</a>     String instanceName = <span class="jxr_string">"localhost_8905"</span>;
-<a class="jxr_linenumber" name="221" href="#221">221</a>     String file = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="222" href="#222">222</a>     String stateModelValue = <span class="jxr_string">"MasterSlave"</span>;
-<a class="jxr_linenumber" name="223" href="#223">223</a>     <strong class="jxr_keyword">int</strong> delay = 0;
-<a class="jxr_linenumber" name="224" href="#224">224</a>     <strong class="jxr_keyword">boolean</strong> skipZeroArgs = <strong class="jxr_keyword">true</strong>;<em class="jxr_comment">// false is for dev testing</em>
-<a class="jxr_linenumber" name="225" href="#225">225</a>     <strong class="jxr_keyword">if</strong> (!skipZeroArgs || args.length &gt; 0)
-<a class="jxr_linenumber" name="226" href="#226">226</a>     {
-<a class="jxr_linenumber" name="227" href="#227">227</a>       CommandLine cmd = processCommandLineArgs(args);
-<a class="jxr_linenumber" name="228" href="#228">228</a>       zkConnectString = cmd.getOptionValue(zkServer);
-<a class="jxr_linenumber" name="229" href="#229">229</a>       clusterName = cmd.getOptionValue(cluster);
-<a class="jxr_linenumber" name="230" href="#230">230</a> 
-<a class="jxr_linenumber" name="231" href="#231">231</a>       String host = cmd.getOptionValue(hostAddress);
-<a class="jxr_linenumber" name="232" href="#232">232</a>       String portString = cmd.getOptionValue(hostPort);
-<a class="jxr_linenumber" name="233" href="#233">233</a>       <strong class="jxr_keyword">int</strong> port = Integer.parseInt(portString);
-<a class="jxr_linenumber" name="234" href="#234">234</a>       instanceName = host + <span class="jxr_string">"_"</span> + port;
-<a class="jxr_linenumber" name="235" href="#235">235</a> 
-<a class="jxr_linenumber" name="236" href="#236">236</a>       file = cmd.getOptionValue(configFile);
-<a class="jxr_linenumber" name="237" href="#237">237</a>       <strong class="jxr_keyword">if</strong> (file != <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="238" href="#238">238</a>       {
-<a class="jxr_linenumber" name="239" href="#239">239</a>         File f = <strong class="jxr_keyword">new</strong> File(file);
-<a class="jxr_linenumber" name="240" href="#240">240</a>         <strong class="jxr_keyword">if</strong> (!f.exists())
-<a class="jxr_linenumber" name="241" href="#241">241</a>         {
-<a class="jxr_linenumber" name="242" href="#242">242</a>           System.err.println(<span class="jxr_string">"static config file doesn't exist"</span>);
-<a class="jxr_linenumber" name="243" href="#243">243</a>           System.exit(1);
-<a class="jxr_linenumber" name="244" href="#244">244</a>         }
-<a class="jxr_linenumber" name="245" href="#245">245</a>       }
-<a class="jxr_linenumber" name="246" href="#246">246</a> 
-<a class="jxr_linenumber" name="247" href="#247">247</a>       stateModelValue = cmd.getOptionValue(stateModel);
-<a class="jxr_linenumber" name="248" href="#248">248</a>       <strong class="jxr_keyword">if</strong> (cmd.hasOption(transDelay))
-<a class="jxr_linenumber" name="249" href="#249">249</a>       {
-<a class="jxr_linenumber" name="250" href="#250">250</a>         <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="251" href="#251">251</a>         {
-<a class="jxr_linenumber" name="252" href="#252">252</a>           delay = Integer.parseInt(cmd.getOptionValue(transDelay));
-<a class="jxr_linenumber" name="253" href="#253">253</a>           <strong class="jxr_keyword">if</strong> (delay &lt; 0)
-<a class="jxr_linenumber" name="254" href="#254">254</a>           {
-<a class="jxr_linenumber" name="255" href="#255">255</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> Exception(<span class="jxr_string">"delay must be positive"</span>);
-<a class="jxr_linenumber" name="256" href="#256">256</a>           }
-<a class="jxr_linenumber" name="257" href="#257">257</a>         } <strong class="jxr_keyword">catch</strong> (Exception e)
-<a class="jxr_linenumber" name="258" href="#258">258</a>         {
-<a class="jxr_linenumber" name="259" href="#259">259</a>           e.printStackTrace();
-<a class="jxr_linenumber" name="260" href="#260">260</a>           delay = 0;
-<a class="jxr_linenumber" name="261" href="#261">261</a>         }
-<a class="jxr_linenumber" name="262" href="#262">262</a>       }
-<a class="jxr_linenumber" name="263" href="#263">263</a>     }
-<a class="jxr_linenumber" name="264" href="#264">264</a>     <em class="jxr_comment">// Espresso_driver.py will consume this</em>
-<a class="jxr_linenumber" name="265" href="#265">265</a>     System.out.println(<span class="jxr_string">"Starting Process with ZK:"</span> + zkConnectString);
-<a class="jxr_linenumber" name="266" href="#266">266</a> 
-<a class="jxr_linenumber" name="267" href="#267">267</a>     <a href="../../../../org/apache/helix/examples/ExampleProcess.html">ExampleProcess</a> process = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/examples/ExampleProcess.html">ExampleProcess</a>(zkConnectString, clusterName,
-<a class="jxr_linenumber" name="268" href="#268">268</a>         instanceName, file, stateModelValue, delay);
-<a class="jxr_linenumber" name="269" href="#269">269</a> 
-<a class="jxr_linenumber" name="270" href="#270">270</a>     process.start();
-<a class="jxr_linenumber" name="271" href="#271">271</a>     Thread.currentThread().join();
-<a class="jxr_linenumber" name="272" href="#272">272</a>   }
-<a class="jxr_linenumber" name="273" href="#273">273</a> }
+<a class="jxr_linenumber" name="194" href="#194">194</a>     helpFormatter.printHelp(<span class="jxr_string">"java "</span> + ExampleProcess.<strong class="jxr_keyword">class</strong>.getName(),
+<a class="jxr_linenumber" name="195" href="#195">195</a>         cliOptions);
+<a class="jxr_linenumber" name="196" href="#196">196</a>   }
+<a class="jxr_linenumber" name="197" href="#197">197</a> 
+<a class="jxr_linenumber" name="198" href="#198">198</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> CommandLine processCommandLineArgs(String[] cliArgs)
+<a class="jxr_linenumber" name="199" href="#199">199</a>       <strong class="jxr_keyword">throws</strong> Exception
+<a class="jxr_linenumber" name="200" href="#200">200</a>   {
+<a class="jxr_linenumber" name="201" href="#201">201</a>     CommandLineParser cliParser = <strong class="jxr_keyword">new</strong> GnuParser();
+<a class="jxr_linenumber" name="202" href="#202">202</a>     Options cliOptions = constructCommandLineOptions();
+<a class="jxr_linenumber" name="203" href="#203">203</a>     <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="204" href="#204">204</a>     {
+<a class="jxr_linenumber" name="205" href="#205">205</a>       <strong class="jxr_keyword">return</strong> cliParser.parse(cliOptions, cliArgs);
+<a class="jxr_linenumber" name="206" href="#206">206</a>     } <strong class="jxr_keyword">catch</strong> (ParseException pe)
+<a class="jxr_linenumber" name="207" href="#207">207</a>     {
+<a class="jxr_linenumber" name="208" href="#208">208</a>       System.err
+<a class="jxr_linenumber" name="209" href="#209">209</a>           .println(<span class="jxr_string">"CommandLineClient: failed to parse command-line options: "</span>
+<a class="jxr_linenumber" name="210" href="#210">210</a>               + pe.toString());
+<a class="jxr_linenumber" name="211" href="#211">211</a>       printUsage(cliOptions);
+<a class="jxr_linenumber" name="212" href="#212">212</a>       System.exit(1);
+<a class="jxr_linenumber" name="213" href="#213">213</a>     }
+<a class="jxr_linenumber" name="214" href="#214">214</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="215" href="#215">215</a>   }
+<a class="jxr_linenumber" name="216" href="#216">216</a> 
+<a class="jxr_linenumber" name="217" href="#217">217</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> main(String[] args) <strong class="jxr_keyword">throws</strong> Exception
+<a class="jxr_linenumber" name="218" href="#218">218</a>   {
+<a class="jxr_linenumber" name="219" href="#219">219</a>     String zkConnectString = <span class="jxr_string">"localhost:2181"</span>;
+<a class="jxr_linenumber" name="220" href="#220">220</a>     String clusterName = <span class="jxr_string">"storage-integration-cluster"</span>;
+<a class="jxr_linenumber" name="221" href="#221">221</a>     String instanceName = <span class="jxr_string">"localhost_8905"</span>;
+<a class="jxr_linenumber" name="222" href="#222">222</a>     String file = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="223" href="#223">223</a>     String stateModelValue = <span class="jxr_string">"MasterSlave"</span>;
+<a class="jxr_linenumber" name="224" href="#224">224</a>     <strong class="jxr_keyword">int</strong> delay = 0;
+<a class="jxr_linenumber" name="225" href="#225">225</a>     <strong class="jxr_keyword">boolean</strong> skipZeroArgs = <strong class="jxr_keyword">true</strong>;<em class="jxr_comment">// false is for dev testing</em>
+<a class="jxr_linenumber" name="226" href="#226">226</a>     <strong class="jxr_keyword">if</strong> (!skipZeroArgs || args.length &gt; 0)
+<a class="jxr_linenumber" name="227" href="#227">227</a>     {
+<a class="jxr_linenumber" name="228" href="#228">228</a>       CommandLine cmd = processCommandLineArgs(args);
+<a class="jxr_linenumber" name="229" href="#229">229</a>       zkConnectString = cmd.getOptionValue(zkServer);
+<a class="jxr_linenumber" name="230" href="#230">230</a>       clusterName = cmd.getOptionValue(cluster);
+<a class="jxr_linenumber" name="231" href="#231">231</a> 
+<a class="jxr_linenumber" name="232" href="#232">232</a>       String host = cmd.getOptionValue(hostAddress);
+<a class="jxr_linenumber" name="233" href="#233">233</a>       String portString = cmd.getOptionValue(hostPort);
+<a class="jxr_linenumber" name="234" href="#234">234</a>       <strong class="jxr_keyword">int</strong> port = Integer.parseInt(portString);
+<a class="jxr_linenumber" name="235" href="#235">235</a>       instanceName = host + <span class="jxr_string">"_"</span> + port;
+<a class="jxr_linenumber" name="236" href="#236">236</a> 
+<a class="jxr_linenumber" name="237" href="#237">237</a>       file = cmd.getOptionValue(configFile);
+<a class="jxr_linenumber" name="238" href="#238">238</a>       <strong class="jxr_keyword">if</strong> (file != <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="239" href="#239">239</a>       {
+<a class="jxr_linenumber" name="240" href="#240">240</a>         File f = <strong class="jxr_keyword">new</strong> File(file);
+<a class="jxr_linenumber" name="241" href="#241">241</a>         <strong class="jxr_keyword">if</strong> (!f.exists())
+<a class="jxr_linenumber" name="242" href="#242">242</a>         {
+<a class="jxr_linenumber" name="243" href="#243">243</a>           System.err.println(<span class="jxr_string">"static config file doesn't exist"</span>);
+<a class="jxr_linenumber" name="244" href="#244">244</a>           System.exit(1);
+<a class="jxr_linenumber" name="245" href="#245">245</a>         }
+<a class="jxr_linenumber" name="246" href="#246">246</a>       }
+<a class="jxr_linenumber" name="247" href="#247">247</a> 
+<a class="jxr_linenumber" name="248" href="#248">248</a>       stateModelValue = cmd.getOptionValue(stateModel);
+<a class="jxr_linenumber" name="249" href="#249">249</a>       <strong class="jxr_keyword">if</strong> (cmd.hasOption(transDelay))
+<a class="jxr_linenumber" name="250" href="#250">250</a>       {
+<a class="jxr_linenumber" name="251" href="#251">251</a>         <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="252" href="#252">252</a>         {
+<a class="jxr_linenumber" name="253" href="#253">253</a>           delay = Integer.parseInt(cmd.getOptionValue(transDelay));
+<a class="jxr_linenumber" name="254" href="#254">254</a>           <strong class="jxr_keyword">if</strong> (delay &lt; 0)
+<a class="jxr_linenumber" name="255" href="#255">255</a>           {
+<a class="jxr_linenumber" name="256" href="#256">256</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> Exception(<span class="jxr_string">"delay must be positive"</span>);
+<a class="jxr_linenumber" name="257" href="#257">257</a>           }
+<a class="jxr_linenumber" name="258" href="#258">258</a>         } <strong class="jxr_keyword">catch</strong> (Exception e)
+<a class="jxr_linenumber" name="259" href="#259">259</a>         {
+<a class="jxr_linenumber" name="260" href="#260">260</a>           e.printStackTrace();
+<a class="jxr_linenumber" name="261" href="#261">261</a>           delay = 0;
+<a class="jxr_linenumber" name="262" href="#262">262</a>         }
+<a class="jxr_linenumber" name="263" href="#263">263</a>       }
+<a class="jxr_linenumber" name="264" href="#264">264</a>     }
+<a class="jxr_linenumber" name="265" href="#265">265</a>     <em class="jxr_comment">// Espresso_driver.py will consume this</em>
+<a class="jxr_linenumber" name="266" href="#266">266</a>     System.out.println(<span class="jxr_string">"Starting Process with ZK:"</span> + zkConnectString);
+<a class="jxr_linenumber" name="267" href="#267">267</a> 
+<a class="jxr_linenumber" name="268" href="#268">268</a>     <a href="../../../../org/apache/helix/examples/ExampleProcess.html">ExampleProcess</a> process = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/examples/ExampleProcess.html">ExampleProcess</a>(zkConnectString, clusterName,
+<a class="jxr_linenumber" name="269" href="#269">269</a>         instanceName, file, stateModelValue, delay);
+<a class="jxr_linenumber" name="270" href="#270">270</a> 
+<a class="jxr_linenumber" name="271" href="#271">271</a>     process.start();
+<a class="jxr_linenumber" name="272" href="#272">272</a>     Thread.currentThread().join();
+<a class="jxr_linenumber" name="273" href="#273">273</a>   }
+<a class="jxr_linenumber" name="274" href="#274">274</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/examples/MasterSlaveStateModelFactory.html
URL: http://svn.apache.org/viewvc/incubator/helix/site-content/xref/org/apache/helix/examples/MasterSlaveStateModelFactory.html?rev=1406467&r1=1406466&r2=1406467&view=diff
==============================================================================
--- incubator/helix/site-content/xref/org/apache/helix/examples/MasterSlaveStateModelFactory.html (original)
+++ incubator/helix/site-content/xref/org/apache/helix/examples/MasterSlaveStateModelFactory.html Wed Nov  7 05:11:27 2012
@@ -35,82 +35,126 @@
 <a class="jxr_linenumber" name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> org.apache.helix.participant.statemachine.StateModelFactory;
 <a class="jxr_linenumber" name="26" href="#26">26</a>  
 <a class="jxr_linenumber" name="27" href="#27">27</a>  @SuppressWarnings(<span class="jxr_string">"rawtypes"</span>)
-<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModelFactory</a> <strong class="jxr_keyword">extends</strong> StateModelFactory&lt;StateModel&gt; {
-<a class="jxr_linenumber" name="29" href="#29">29</a>  	<strong class="jxr_keyword">int</strong> _delay;
-<a class="jxr_linenumber" name="30" href="#30">30</a>  
-<a class="jxr_linenumber" name="31" href="#31">31</a>  	<strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModelFactory</a>(<strong class="jxr_keyword">int</strong> delay) {
-<a class="jxr_linenumber" name="32" href="#32">32</a>  		_delay = delay;
-<a class="jxr_linenumber" name="33" href="#33">33</a>  	}
-<a class="jxr_linenumber" name="34" href="#34">34</a>  
-<a class="jxr_linenumber" name="35" href="#35">35</a>  	@Override
-<a class="jxr_linenumber" name="36" href="#36">36</a>  	<strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/helix/participant/statemachine/StateModel.html">StateModel</a> createNewStateModel(String stateUnitKey) {
-<a class="jxr_linenumber" name="37" href="#37">37</a>  		MasterSlaveStateModel stateModel = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModel</a>();
-<a class="jxr_linenumber" name="38" href="#38">38</a>  		stateModel.setDelay(_delay);
-<a class="jxr_linenumber" name="39" href="#39">39</a>  		stateModel.setStateUnitKey(stateUnitKey);
-<a class="jxr_linenumber" name="40" href="#40">40</a>  		<strong class="jxr_keyword">return</strong> stateModel;
-<a class="jxr_linenumber" name="41" href="#41">41</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">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModel</a> <strong class="jxr_keyword">extends</strong> <a href="../../../../org/apache/helix/participant/statemachine/StateModel.html">StateModel</a> {
-<a class="jxr_linenumber" name="44" href="#44">44</a>  		<strong class="jxr_keyword">int</strong> _transDelay = 0;
-<a class="jxr_linenumber" name="45" href="#45">45</a>  		String stateUnitKey;
-<a class="jxr_linenumber" name="46" href="#46">46</a>  		
-<a class="jxr_linenumber" name="47" href="#47">47</a>  		<strong class="jxr_keyword">public</strong> String getStateUnitKey() {
-<a class="jxr_linenumber" name="48" href="#48">48</a>  			<strong class="jxr_keyword">return</strong> stateUnitKey;
-<a class="jxr_linenumber" name="49" href="#49">49</a>  		}
-<a class="jxr_linenumber" name="50" href="#50">50</a>  
-<a class="jxr_linenumber" name="51" href="#51">51</a>  		<strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setStateUnitKey(String stateUnitKey) {
-<a class="jxr_linenumber" name="52" href="#52">52</a>  			<strong class="jxr_keyword">this</strong>.stateUnitKey = stateUnitKey;
-<a class="jxr_linenumber" name="53" href="#53">53</a>  		}
-<a class="jxr_linenumber" name="54" href="#54">54</a>  
-<a class="jxr_linenumber" name="55" href="#55">55</a>  		<strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setDelay(<strong class="jxr_keyword">int</strong> delay) {
-<a class="jxr_linenumber" name="56" href="#56">56</a>  			_transDelay = delay &gt; 0 ? delay : 0;
-<a class="jxr_linenumber" name="57" href="#57">57</a>  		}
-<a class="jxr_linenumber" name="58" href="#58">58</a>  
-<a class="jxr_linenumber" name="59" href="#59">59</a>  		<strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onBecomeSlaveFromOffline(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message,
-<a class="jxr_linenumber" name="60" href="#60">60</a>  				NotificationContext context) {
-<a class="jxr_linenumber" name="61" href="#61">61</a>  
-<a class="jxr_linenumber" name="62" href="#62">62</a>  			System.out.println(<span class="jxr_string">"MasterSlaveStateModel.onBecomeSlaveFromOffline() for "</span>+ stateUnitKey);
-<a class="jxr_linenumber" name="63" href="#63">63</a>  			sleep();
-<a class="jxr_linenumber" name="64" href="#64">64</a>  		}
+<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModelFactory</a> <strong class="jxr_keyword">extends</strong> StateModelFactory&lt;StateModel&gt;
+<a class="jxr_linenumber" name="29" href="#29">29</a>  {
+<a class="jxr_linenumber" name="30" href="#30">30</a>    <strong class="jxr_keyword">int</strong> _delay;
+<a class="jxr_linenumber" name="31" href="#31">31</a>  
+<a class="jxr_linenumber" name="32" href="#32">32</a>    String _instanceName = <span class="jxr_string">""</span>;
+<a class="jxr_linenumber" name="33" href="#33">33</a>  
+<a class="jxr_linenumber" name="34" href="#34">34</a>    <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModelFactory</a>(<strong class="jxr_keyword">int</strong> delay)
+<a class="jxr_linenumber" name="35" href="#35">35</a>    {
+<a class="jxr_linenumber" name="36" href="#36">36</a>      _delay = delay;
+<a class="jxr_linenumber" name="37" href="#37">37</a>    }
+<a class="jxr_linenumber" name="38" href="#38">38</a>  
+<a class="jxr_linenumber" name="39" href="#39">39</a>    <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModelFactory</a>(String instanceName)
+<a class="jxr_linenumber" name="40" href="#40">40</a>    {
+<a class="jxr_linenumber" name="41" href="#41">41</a>      _instanceName = instanceName;
+<a class="jxr_linenumber" name="42" href="#42">42</a>      _delay = 10;
+<a class="jxr_linenumber" name="43" href="#43">43</a>    }
+<a class="jxr_linenumber" name="44" href="#44">44</a>  
+<a class="jxr_linenumber" name="45" href="#45">45</a>    <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModelFactory</a>()
+<a class="jxr_linenumber" name="46" href="#46">46</a>    {
+<a class="jxr_linenumber" name="47" href="#47">47</a>      <strong class="jxr_keyword">this</strong>(10);
+<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>    @Override
+<a class="jxr_linenumber" name="51" href="#51">51</a>    <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/helix/participant/statemachine/StateModel.html">StateModel</a> createNewStateModel(String partitionName)
+<a class="jxr_linenumber" name="52" href="#52">52</a>    {
+<a class="jxr_linenumber" name="53" href="#53">53</a>      <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModel</a> stateModel = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModel</a>();
+<a class="jxr_linenumber" name="54" href="#54">54</a>      stateModel.setInstanceName(_instanceName);
+<a class="jxr_linenumber" name="55" href="#55">55</a>      stateModel.setDelay(_delay);
+<a class="jxr_linenumber" name="56" href="#56">56</a>      stateModel.setPartitionName(partitionName);
+<a class="jxr_linenumber" name="57" href="#57">57</a>      <strong class="jxr_keyword">return</strong> stateModel;
+<a class="jxr_linenumber" name="58" href="#58">58</a>    }
+<a class="jxr_linenumber" name="59" href="#59">59</a>  
+<a class="jxr_linenumber" name="60" href="#60">60</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/helix/examples/MasterSlaveStateModelFactory.html">MasterSlaveStateModel</a> <strong class="jxr_keyword">extends</strong> <a href="../../../../org/apache/helix/participant/statemachine/StateModel.html">StateModel</a>
+<a class="jxr_linenumber" name="61" href="#61">61</a>    {
+<a class="jxr_linenumber" name="62" href="#62">62</a>      <strong class="jxr_keyword">int</strong> _transDelay = 0;
+<a class="jxr_linenumber" name="63" href="#63">63</a>      String partitionName;
+<a class="jxr_linenumber" name="64" href="#64">64</a>      String _instanceName = <span class="jxr_string">""</span>;
 <a class="jxr_linenumber" name="65" href="#65">65</a>  
-<a class="jxr_linenumber" name="66" href="#66">66</a>  		<strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> sleep() {
-<a class="jxr_linenumber" name="67" href="#67">67</a>  			<strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="68" href="#68">68</a>  				Thread.sleep(_transDelay);
-<a class="jxr_linenumber" name="69" href="#69">69</a>  			} <strong class="jxr_keyword">catch</strong> (Exception e) {
-<a class="jxr_linenumber" name="70" href="#70">70</a>  				e.printStackTrace();
-<a class="jxr_linenumber" name="71" href="#71">71</a>  			}
-<a class="jxr_linenumber" name="72" href="#72">72</a>  		}
-<a class="jxr_linenumber" name="73" href="#73">73</a>  
-<a class="jxr_linenumber" name="74" href="#74">74</a>  		<strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onBecomeSlaveFromMaster(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message,
-<a class="jxr_linenumber" name="75" href="#75">75</a>  				NotificationContext context) {
-<a class="jxr_linenumber" name="76" href="#76">76</a>  			System.out.println(<span class="jxr_string">"MasterSlaveStateModel.onBecomeSlaveFromMaster() for "</span>+ stateUnitKey);
-<a class="jxr_linenumber" name="77" href="#77">77</a>  			sleep();
-<a class="jxr_linenumber" name="78" href="#78">78</a>  
-<a class="jxr_linenumber" name="79" href="#79">79</a>  		}
+<a class="jxr_linenumber" name="66" href="#66">66</a>      <strong class="jxr_keyword">public</strong> String getPartitionName()
+<a class="jxr_linenumber" name="67" href="#67">67</a>      {
+<a class="jxr_linenumber" name="68" href="#68">68</a>        <strong class="jxr_keyword">return</strong> partitionName;
+<a class="jxr_linenumber" name="69" href="#69">69</a>      }
+<a class="jxr_linenumber" name="70" href="#70">70</a>  
+<a class="jxr_linenumber" name="71" href="#71">71</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setPartitionName(String partitionName)
+<a class="jxr_linenumber" name="72" href="#72">72</a>      {
+<a class="jxr_linenumber" name="73" href="#73">73</a>        <strong class="jxr_keyword">this</strong>.partitionName = partitionName;
+<a class="jxr_linenumber" name="74" href="#74">74</a>      }
+<a class="jxr_linenumber" name="75" href="#75">75</a>  
+<a class="jxr_linenumber" name="76" href="#76">76</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setDelay(<strong class="jxr_keyword">int</strong> delay)
+<a class="jxr_linenumber" name="77" href="#77">77</a>      {
+<a class="jxr_linenumber" name="78" href="#78">78</a>        _transDelay = delay &gt; 0 ? delay : 0;
+<a class="jxr_linenumber" name="79" href="#79">79</a>      }
 <a class="jxr_linenumber" name="80" href="#80">80</a>  
-<a class="jxr_linenumber" name="81" href="#81">81</a>  		<strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onBecomeMasterFromSlave(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message,
-<a class="jxr_linenumber" name="82" href="#82">82</a>  				NotificationContext context) {
-<a class="jxr_linenumber" name="83" href="#83">83</a>  			System.out.println(<span class="jxr_string">"MasterSlaveStateModel.onBecomeMasterFromSlave() for "</span>+ stateUnitKey);
-<a class="jxr_linenumber" name="84" href="#84">84</a>  			sleep();
+<a class="jxr_linenumber" name="81" href="#81">81</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setInstanceName(String instanceName)
+<a class="jxr_linenumber" name="82" href="#82">82</a>      {
+<a class="jxr_linenumber" name="83" href="#83">83</a>        _instanceName = instanceName;
+<a class="jxr_linenumber" name="84" href="#84">84</a>      }
 <a class="jxr_linenumber" name="85" href="#85">85</a>  
-<a class="jxr_linenumber" name="86" href="#86">86</a>  		}
-<a class="jxr_linenumber" name="87" href="#87">87</a>  
-<a class="jxr_linenumber" name="88" href="#88">88</a>  		<strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onBecomeOfflineFromSlave(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message,
-<a class="jxr_linenumber" name="89" href="#89">89</a>  				NotificationContext context) {
-<a class="jxr_linenumber" name="90" href="#90">90</a>  			System.out.println(<span class="jxr_string">"MasterSlaveStateModel.onBecomeOfflineFromSlave() for "</span>+ stateUnitKey);
-<a class="jxr_linenumber" name="91" href="#91">91</a>  			sleep();
-<a class="jxr_linenumber" name="92" href="#92">92</a>  
-<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>  		<strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onBecomeDroppedFromOffline(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message,
-<a class="jxr_linenumber" name="96" href="#96">96</a>          <a href="../../../../org/apache/helix/NotificationContext.html">NotificationContext</a> context) {
-<a class="jxr_linenumber" name="97" href="#97">97</a>        System.out.println(<span class="jxr_string">"ObBecomeDroppedFromOffline() for "</span>+ stateUnitKey);
-<a class="jxr_linenumber" name="98" href="#98">98</a>        sleep();
-<a class="jxr_linenumber" name="99" href="#99">99</a>  
-<a class="jxr_linenumber" name="100" href="#100">100</a>     }
-<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="86" href="#86">86</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onBecomeSlaveFromOffline(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message,
+<a class="jxr_linenumber" name="87" href="#87">87</a>          <a href="../../../../org/apache/helix/NotificationContext.html">NotificationContext</a> context)
+<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>        System.out.println(_instanceName + <span class="jxr_string">" transitioning from "</span>
+<a class="jxr_linenumber" name="91" href="#91">91</a>            + message.getFromState() + <span class="jxr_string">" to "</span> + message.getToState() + <span class="jxr_string">" for "</span>
+<a class="jxr_linenumber" name="92" href="#92">92</a>            + partitionName);
+<a class="jxr_linenumber" name="93" href="#93">93</a>        sleep();
+<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>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> sleep()
+<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>         Thread.sleep(_transDelay);
+<a class="jxr_linenumber" name="101" href="#101">101</a>       } <strong class="jxr_keyword">catch</strong> (Exception e)
+<a class="jxr_linenumber" name="102" href="#102">102</a>       {
+<a class="jxr_linenumber" name="103" href="#103">103</a>         e.printStackTrace();
+<a class="jxr_linenumber" name="104" href="#104">104</a>       }
+<a class="jxr_linenumber" name="105" href="#105">105</a>     }
+<a class="jxr_linenumber" name="106" href="#106">106</a> 
+<a class="jxr_linenumber" name="107" href="#107">107</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onBecomeSlaveFromMaster(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message,
+<a class="jxr_linenumber" name="108" href="#108">108</a>         <a href="../../../../org/apache/helix/NotificationContext.html">NotificationContext</a> context)
+<a class="jxr_linenumber" name="109" href="#109">109</a>     {
+<a class="jxr_linenumber" name="110" href="#110">110</a>       System.out.println(_instanceName + <span class="jxr_string">" transitioning from "</span>
+<a class="jxr_linenumber" name="111" href="#111">111</a>           + message.getFromState() + <span class="jxr_string">" to "</span> + message.getToState() + <span class="jxr_string">" for "</span>
+<a class="jxr_linenumber" name="112" href="#112">112</a>           + partitionName);
+<a class="jxr_linenumber" name="113" href="#113">113</a>       sleep();
+<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>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onBecomeMasterFromSlave(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message,
+<a class="jxr_linenumber" name="118" href="#118">118</a>         <a href="../../../../org/apache/helix/NotificationContext.html">NotificationContext</a> context)
+<a class="jxr_linenumber" name="119" href="#119">119</a>     {
+<a class="jxr_linenumber" name="120" href="#120">120</a>       System.out.println(_instanceName + <span class="jxr_string">" transitioning from "</span>
+<a class="jxr_linenumber" name="121" href="#121">121</a>           + message.getFromState() + <span class="jxr_string">" to "</span> + message.getToState() + <span class="jxr_string">" for "</span>
+<a class="jxr_linenumber" name="122" href="#122">122</a>           + partitionName);
+<a class="jxr_linenumber" name="123" href="#123">123</a>       sleep();
+<a class="jxr_linenumber" name="124" href="#124">124</a> 
+<a class="jxr_linenumber" name="125" href="#125">125</a>     }
+<a class="jxr_linenumber" name="126" href="#126">126</a> 
+<a class="jxr_linenumber" name="127" href="#127">127</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onBecomeOfflineFromSlave(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message,
+<a class="jxr_linenumber" name="128" href="#128">128</a>         <a href="../../../../org/apache/helix/NotificationContext.html">NotificationContext</a> context)
+<a class="jxr_linenumber" name="129" href="#129">129</a>     {
+<a class="jxr_linenumber" name="130" href="#130">130</a>       System.out.println(_instanceName + <span class="jxr_string">" transitioning from "</span>
+<a class="jxr_linenumber" name="131" href="#131">131</a>           + message.getFromState() + <span class="jxr_string">" to "</span> + message.getToState() + <span class="jxr_string">" for "</span>
+<a class="jxr_linenumber" name="132" href="#132">132</a>           + partitionName);
+<a class="jxr_linenumber" name="133" href="#133">133</a>       sleep();
+<a class="jxr_linenumber" name="134" href="#134">134</a> 
+<a class="jxr_linenumber" name="135" href="#135">135</a>     }
+<a class="jxr_linenumber" name="136" href="#136">136</a> 
+<a class="jxr_linenumber" name="137" href="#137">137</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> onBecomeDroppedFromOffline(<a href="../../../../org/apache/helix/model/Message.html">Message</a> message,
+<a class="jxr_linenumber" name="138" href="#138">138</a>         <a href="../../../../org/apache/helix/NotificationContext.html">NotificationContext</a> context)
+<a class="jxr_linenumber" name="139" href="#139">139</a>     {
+<a class="jxr_linenumber" name="140" href="#140">140</a>       System.out.println(_instanceName + <span class="jxr_string">" Dropping partition "</span>
+<a class="jxr_linenumber" name="141" href="#141">141</a>           + partitionName);
+<a class="jxr_linenumber" name="142" href="#142">142</a>       sleep();
+<a class="jxr_linenumber" name="143" href="#143">143</a> 
+<a class="jxr_linenumber" name="144" href="#144">144</a>     }
+<a class="jxr_linenumber" name="145" href="#145">145</a>   }
+<a class="jxr_linenumber" name="146" href="#146">146</a> 
+<a class="jxr_linenumber" name="147" href="#147">147</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