helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1442295 [34/38] - in /incubator/helix/site-content: ./ apidocs/assets/ apidocs/reference/ apidocs/reference/org/apache/helix/ apidocs/reference/org/apache/helix/manager/zk/ helix-admin-webapp/ helix-core/ involved/ mockservice/ recipes/ re...
Date Mon, 04 Feb 2013 18:40:12 GMT
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=1442295&r1=1442294&r2=1442295&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
Mon Feb  4 18:40:07 2013
@@ -161,122 +161,123 @@
 <a class="jxr_linenumber" name="151" href="#151">151</a>       manager.addConfigChangeListener(controller);
 <a class="jxr_linenumber" name="152" href="#152">152</a>       manager.addLiveInstanceChangeListener(controller);
 <a class="jxr_linenumber" name="153" href="#153">153</a>       manager.addIdealStateChangeListener(controller);
-<a class="jxr_linenumber" name="154" href="#154">154</a>       manager.addExternalViewChangeListener(controller);
-<a class="jxr_linenumber" name="155" href="#155">155</a>       manager.addControllerListener(controller);
-<a class="jxr_linenumber" name="156" href="#156">156</a>     } <strong class="jxr_keyword">catch</strong>
(ZkInterruptedException e)
-<a class="jxr_linenumber" name="157" href="#157">157</a>     {
-<a class="jxr_linenumber" name="158" href="#158">158</a>       logger
-<a class="jxr_linenumber" name="159" href="#159">159</a>           .warn(<span
class="jxr_string">"zk connection is interrupted during HelixManagerMain.addListenersToController().
"</span>
-<a class="jxr_linenumber" name="160" href="#160">160</a>               + e);
-<a class="jxr_linenumber" name="161" href="#161">161</a>     } <strong class="jxr_keyword">catch</strong>
(Exception e)
-<a class="jxr_linenumber" name="162" href="#162">162</a>     {
-<a class="jxr_linenumber" name="163" href="#163">163</a>       logger.error(<span
class="jxr_string">"Error when creating HelixManagerContollerMonitor"</span>, e);
-<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>   <strong class="jxr_keyword">public</strong>
<strong class="jxr_keyword">static</strong> <a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a>
startHelixController(<strong class="jxr_keyword">final</strong> String zkConnectString,
-<a class="jxr_linenumber" name="168" href="#168">168</a>       <strong class="jxr_keyword">final</strong>
String clusterName, <strong class="jxr_keyword">final</strong> String controllerName,
<strong class="jxr_keyword">final</strong> String controllerMode)
-<a class="jxr_linenumber" name="169" href="#169">169</a>   {
-<a class="jxr_linenumber" name="170" href="#170">170</a>     <a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a>
manager = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="171" href="#171">171</a>     <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="172" href="#172">172</a>     {
-<a class="jxr_linenumber" name="173" href="#173">173</a>       <strong class="jxr_keyword">if</strong>
(controllerMode.equalsIgnoreCase(STANDALONE))
-<a class="jxr_linenumber" name="174" href="#174">174</a>       {
-<a class="jxr_linenumber" name="175" href="#175">175</a>         manager = HelixManagerFactory.getZKHelixManager(clusterName,
controllerName,
-<a class="jxr_linenumber" name="176" href="#176">176</a>             InstanceType.CONTROLLER,
zkConnectString);
-<a class="jxr_linenumber" name="177" href="#177">177</a>         manager.connect();
-<a class="jxr_linenumber" name="178" href="#178">178</a>       } <strong class="jxr_keyword">else</strong>
<strong class="jxr_keyword">if</strong> (controllerMode.equalsIgnoreCase(DISTRIBUTED))
-<a class="jxr_linenumber" name="179" href="#179">179</a>       {
-<a class="jxr_linenumber" name="180" href="#180">180</a>         manager = HelixManagerFactory.getZKHelixManager(clusterName,
controllerName,
-<a class="jxr_linenumber" name="181" href="#181">181</a>             InstanceType.CONTROLLER_PARTICIPANT,
zkConnectString);
-<a class="jxr_linenumber" name="182" href="#182">182</a> 
-<a class="jxr_linenumber" name="183" href="#183">183</a>         <a href="../../../../org/apache/helix/participant/DistClusterControllerStateModelFactory.html">DistClusterControllerStateModelFactory</a>
stateModelFactory = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/participant/DistClusterControllerStateModelFactory.html">DistClusterControllerStateModelFactory</a>(
-<a class="jxr_linenumber" name="184" href="#184">184</a>             zkConnectString);
-<a class="jxr_linenumber" name="185" href="#185">185</a> 
-<a class="jxr_linenumber" name="186" href="#186">186</a>         <em class="jxr_comment">//
StateMachineEngine genericStateMachineHandler = new</em>
-<a class="jxr_linenumber" name="187" href="#187">187</a>         <em class="jxr_comment">//
StateMachineEngine();</em>
-<a class="jxr_linenumber" name="188" href="#188">188</a>         <a href="../../../../org/apache/helix/participant/StateMachineEngine.html">StateMachineEngine</a>
stateMach = manager.getStateMachineEngine();
-<a class="jxr_linenumber" name="189" href="#189">189</a>         stateMach.registerStateModelFactory(<span
class="jxr_string">"LeaderStandby"</span>, stateModelFactory);
-<a class="jxr_linenumber" name="190" href="#190">190</a>         <em class="jxr_comment">//
manager.getMessagingService().registerMessageHandlerFactory(MessageType.STATE_TRANSITION.toString(),</em>
-<a class="jxr_linenumber" name="191" href="#191">191</a>         <em class="jxr_comment">//
genericStateMachineHandler);</em>
-<a class="jxr_linenumber" name="192" href="#192">192</a>         manager.connect();
-<a class="jxr_linenumber" name="193" href="#193">193</a>       } <strong class="jxr_keyword">else</strong>
-<a class="jxr_linenumber" name="194" href="#194">194</a>       {
-<a class="jxr_linenumber" name="195" href="#195">195</a>         logger.error(<span
class="jxr_string">"cluster controller mode:"</span> + controllerMode + <span
class="jxr_string">" NOT supported"</span>);
-<a class="jxr_linenumber" name="196" href="#196">196</a>         <em class="jxr_comment">//
throw new</em>
-<a class="jxr_linenumber" name="197" href="#197">197</a>         <em class="jxr_comment">//
IllegalArgumentException("Unsupported cluster controller mode:" +</em>
-<a class="jxr_linenumber" name="198" href="#198">198</a>         <em class="jxr_comment">//
controllerMode);</em>
-<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>       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> }
+<a class="jxr_linenumber" name="154" href="#154">154</a>       <em class="jxr_comment">//
no need for controller to listen on external-view</em>
+<a class="jxr_linenumber" name="155" href="#155">155</a>       <em class="jxr_comment">//
manager.addExternalViewChangeListener(controller);</em>
+<a class="jxr_linenumber" name="156" href="#156">156</a>       manager.addControllerListener(controller);
+<a class="jxr_linenumber" name="157" href="#157">157</a>     } <strong class="jxr_keyword">catch</strong>
(ZkInterruptedException e)
+<a class="jxr_linenumber" name="158" href="#158">158</a>     {
+<a class="jxr_linenumber" name="159" href="#159">159</a>       logger
+<a class="jxr_linenumber" name="160" href="#160">160</a>           .warn(<span
class="jxr_string">"zk connection is interrupted during HelixManagerMain.addListenersToController().
"</span>
+<a class="jxr_linenumber" name="161" href="#161">161</a>               + e);
+<a class="jxr_linenumber" name="162" href="#162">162</a>     } <strong class="jxr_keyword">catch</strong>
(Exception e)
+<a class="jxr_linenumber" name="163" href="#163">163</a>     {
+<a class="jxr_linenumber" name="164" href="#164">164</a>       logger.error(<span
class="jxr_string">"Error when creating HelixManagerContollerMonitor"</span>, e);
+<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="168" href="#168">168</a>   <strong class="jxr_keyword">public</strong>
<strong class="jxr_keyword">static</strong> <a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a>
startHelixController(<strong class="jxr_keyword">final</strong> String zkConnectString,
+<a class="jxr_linenumber" name="169" href="#169">169</a>       <strong class="jxr_keyword">final</strong>
String clusterName, <strong class="jxr_keyword">final</strong> String controllerName,
<strong class="jxr_keyword">final</strong> String controllerMode)
+<a class="jxr_linenumber" name="170" href="#170">170</a>   {
+<a class="jxr_linenumber" name="171" href="#171">171</a>     <a href="../../../../org/apache/helix/HelixManager.html">HelixManager</a>
manager = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="172" href="#172">172</a>     <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="173" href="#173">173</a>     {
+<a class="jxr_linenumber" name="174" href="#174">174</a>       <strong class="jxr_keyword">if</strong>
(controllerMode.equalsIgnoreCase(STANDALONE))
+<a class="jxr_linenumber" name="175" href="#175">175</a>       {
+<a class="jxr_linenumber" name="176" href="#176">176</a>         manager = HelixManagerFactory.getZKHelixManager(clusterName,
controllerName,
+<a class="jxr_linenumber" name="177" href="#177">177</a>             InstanceType.CONTROLLER,
zkConnectString);
+<a class="jxr_linenumber" name="178" href="#178">178</a>         manager.connect();
+<a class="jxr_linenumber" name="179" href="#179">179</a>       } <strong class="jxr_keyword">else</strong>
<strong class="jxr_keyword">if</strong> (controllerMode.equalsIgnoreCase(DISTRIBUTED))
+<a class="jxr_linenumber" name="180" href="#180">180</a>       {
+<a class="jxr_linenumber" name="181" href="#181">181</a>         manager = HelixManagerFactory.getZKHelixManager(clusterName,
controllerName,
+<a class="jxr_linenumber" name="182" href="#182">182</a>             InstanceType.CONTROLLER_PARTICIPANT,
zkConnectString);
+<a class="jxr_linenumber" name="183" href="#183">183</a> 
+<a class="jxr_linenumber" name="184" href="#184">184</a>         <a href="../../../../org/apache/helix/participant/DistClusterControllerStateModelFactory.html">DistClusterControllerStateModelFactory</a>
stateModelFactory = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/helix/participant/DistClusterControllerStateModelFactory.html">DistClusterControllerStateModelFactory</a>(
+<a class="jxr_linenumber" name="185" href="#185">185</a>             zkConnectString);
+<a class="jxr_linenumber" name="186" href="#186">186</a> 
+<a class="jxr_linenumber" name="187" href="#187">187</a>         <em class="jxr_comment">//
StateMachineEngine genericStateMachineHandler = new</em>
+<a class="jxr_linenumber" name="188" href="#188">188</a>         <em class="jxr_comment">//
StateMachineEngine();</em>
+<a class="jxr_linenumber" name="189" href="#189">189</a>         <a href="../../../../org/apache/helix/participant/StateMachineEngine.html">StateMachineEngine</a>
stateMach = manager.getStateMachineEngine();
+<a class="jxr_linenumber" name="190" href="#190">190</a>         stateMach.registerStateModelFactory(<span
class="jxr_string">"LeaderStandby"</span>, stateModelFactory);
+<a class="jxr_linenumber" name="191" href="#191">191</a>         <em class="jxr_comment">//
manager.getMessagingService().registerMessageHandlerFactory(MessageType.STATE_TRANSITION.toString(),</em>
+<a class="jxr_linenumber" name="192" href="#192">192</a>         <em class="jxr_comment">//
genericStateMachineHandler);</em>
+<a class="jxr_linenumber" name="193" href="#193">193</a>         manager.connect();
+<a class="jxr_linenumber" name="194" href="#194">194</a>       } <strong class="jxr_keyword">else</strong>
+<a class="jxr_linenumber" name="195" href="#195">195</a>       {
+<a class="jxr_linenumber" name="196" href="#196">196</a>         logger.error(<span
class="jxr_string">"cluster controller mode:"</span> + controllerMode + <span
class="jxr_string">" NOT supported"</span>);
+<a class="jxr_linenumber" name="197" href="#197">197</a>         <em class="jxr_comment">//
throw new</em>
+<a class="jxr_linenumber" name="198" href="#198">198</a>         <em class="jxr_comment">//
IllegalArgumentException("Unsupported cluster controller mode:" +</em>
+<a class="jxr_linenumber" name="199" href="#199">199</a>         <em class="jxr_comment">//
controllerMode);</em>
+<a class="jxr_linenumber" name="200" href="#200">200</a>       }
+<a class="jxr_linenumber" name="201" href="#201">201</a>     } <strong class="jxr_keyword">catch</strong>
(Exception e)
+<a class="jxr_linenumber" name="202" href="#202">202</a>     {
+<a class="jxr_linenumber" name="203" href="#203">203</a>       logger.error(<span
class="jxr_string">"Exception while starting controller"</span>,e);
+<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> }
 </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