helix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1412308 [38/42] - in /incubator/helix/site-content: ./ apidocs/assets/ apidocs/reference/ apidocs/reference/org/apache/helix/ apidocs/reference/org/apache/helix/alerts/ apidocs/reference/org/apache/helix/controller/ apidocs/reference/org/a...
Date Wed, 21 Nov 2012 21:30:26 GMT
Modified: incubator/helix/site-content/xref/org/apache/helix/manager/zk/ZkBaseDataAccessor.html
URL: http://svn.apache.org/viewvc/incubator/helix/site-content/xref/org/apache/helix/manager/zk/ZkBaseDataAccessor.html?rev=1412308&r1=1412307&r2=1412308&view=diff
==============================================================================
--- incubator/helix/site-content/xref/org/apache/helix/manager/zk/ZkBaseDataAccessor.html (original)
+++ incubator/helix/site-content/xref/org/apache/helix/manager/zk/ZkBaseDataAccessor.html Wed Nov 21 21:29:07 2012
@@ -415,861 +415,879 @@
 <a class="jxr_linenumber" name="405" href="#405">405</a>     <strong class="jxr_keyword">finally</strong>
 <a class="jxr_linenumber" name="406" href="#406">406</a>     {
 <a class="jxr_linenumber" name="407" href="#407">407</a>       <strong class="jxr_keyword">long</strong> endT = System.nanoTime();
-<a class="jxr_linenumber" name="408" href="#408">408</a>       LOG.info(<span class="jxr_string">"getData_async, size: "</span> + paths.size() + <span class="jxr_string">", paths: "</span> + paths.get(0)
-<a class="jxr_linenumber" name="409" href="#409">409</a>           + <span class="jxr_string">",... time: "</span> + (endT - startT) + <span class="jxr_string">" ns"</span>);
-<a class="jxr_linenumber" name="410" href="#410">410</a>     }
-<a class="jxr_linenumber" name="411" href="#411">411</a>   }
-<a class="jxr_linenumber" name="412" href="#412">412</a> 
-<a class="jxr_linenumber" name="413" href="#413">413</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="414" href="#414">414</a> <em class="jxr_javadoccomment">   * asyn getChildren</em>
-<a class="jxr_linenumber" name="415" href="#415">415</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="416" href="#416">416</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="417" href="#417">417</a>   @Override
-<a class="jxr_linenumber" name="418" href="#418">418</a>   <strong class="jxr_keyword">public</strong> List&lt;T&gt; getChildren(String parentPath, List&lt;Stat&gt; stats, <strong class="jxr_keyword">int</strong> options)
-<a class="jxr_linenumber" name="419" href="#419">419</a>   {
-<a class="jxr_linenumber" name="420" href="#420">420</a>     <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="421" href="#421">421</a>     {
-<a class="jxr_linenumber" name="422" href="#422">422</a>       <em class="jxr_comment">// prepare child paths</em>
-<a class="jxr_linenumber" name="423" href="#423">423</a>       List&lt;String&gt; childNames = getChildNames(parentPath, options);
-<a class="jxr_linenumber" name="424" href="#424">424</a>       <strong class="jxr_keyword">if</strong> (childNames == <strong class="jxr_keyword">null</strong> || childNames.size() == 0)
-<a class="jxr_linenumber" name="425" href="#425">425</a>       {
-<a class="jxr_linenumber" name="426" href="#426">426</a>         <strong class="jxr_keyword">return</strong> Collections.emptyList();
-<a class="jxr_linenumber" name="427" href="#427">427</a>       }
-<a class="jxr_linenumber" name="428" href="#428">428</a> 
-<a class="jxr_linenumber" name="429" href="#429">429</a>       List&lt;String&gt; paths = <strong class="jxr_keyword">new</strong> ArrayList&lt;String&gt;();
-<a class="jxr_linenumber" name="430" href="#430">430</a>       <strong class="jxr_keyword">for</strong> (String childName : childNames)
-<a class="jxr_linenumber" name="431" href="#431">431</a>       {
-<a class="jxr_linenumber" name="432" href="#432">432</a>         String path = parentPath + <span class="jxr_string">"/"</span> + childName;
-<a class="jxr_linenumber" name="433" href="#433">433</a>         paths.add(path);
-<a class="jxr_linenumber" name="434" href="#434">434</a>       }
-<a class="jxr_linenumber" name="435" href="#435">435</a> 
-<a class="jxr_linenumber" name="436" href="#436">436</a>       <em class="jxr_comment">// remove null record</em>
-<a class="jxr_linenumber" name="437" href="#437">437</a>       List&lt;Stat&gt; curStats = <strong class="jxr_keyword">new</strong> ArrayList&lt;Stat&gt;(paths.size());
-<a class="jxr_linenumber" name="438" href="#438">438</a>       List&lt;T&gt; records = get(paths, curStats, options);
-<a class="jxr_linenumber" name="439" href="#439">439</a>       Iterator&lt;T&gt; recordIter = records.iterator();
-<a class="jxr_linenumber" name="440" href="#440">440</a>       Iterator&lt;Stat&gt; statIter = curStats.iterator();
-<a class="jxr_linenumber" name="441" href="#441">441</a>       <strong class="jxr_keyword">while</strong> (statIter.hasNext())
-<a class="jxr_linenumber" name="442" href="#442">442</a>       {
-<a class="jxr_linenumber" name="443" href="#443">443</a>         recordIter.next();
-<a class="jxr_linenumber" name="444" href="#444">444</a>         <strong class="jxr_keyword">if</strong> (statIter.next() == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="445" href="#445">445</a>         {
-<a class="jxr_linenumber" name="446" href="#446">446</a>           statIter.remove();
-<a class="jxr_linenumber" name="447" href="#447">447</a>           recordIter.remove();
-<a class="jxr_linenumber" name="448" href="#448">448</a>         }
-<a class="jxr_linenumber" name="449" href="#449">449</a>       }
-<a class="jxr_linenumber" name="450" href="#450">450</a> 
-<a class="jxr_linenumber" name="451" href="#451">451</a>       <strong class="jxr_keyword">if</strong> (stats != <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="452" href="#452">452</a>       {
-<a class="jxr_linenumber" name="453" href="#453">453</a>         stats.clear();
-<a class="jxr_linenumber" name="454" href="#454">454</a>         stats.addAll(curStats);
-<a class="jxr_linenumber" name="455" href="#455">455</a>       }
-<a class="jxr_linenumber" name="456" href="#456">456</a> 
-<a class="jxr_linenumber" name="457" href="#457">457</a>       <strong class="jxr_keyword">return</strong> records;
-<a class="jxr_linenumber" name="458" href="#458">458</a>     }
-<a class="jxr_linenumber" name="459" href="#459">459</a>     <strong class="jxr_keyword">catch</strong> (ZkNoNodeException e)
-<a class="jxr_linenumber" name="460" href="#460">460</a>     {
-<a class="jxr_linenumber" name="461" href="#461">461</a>       <strong class="jxr_keyword">return</strong> Collections.emptyList();
-<a class="jxr_linenumber" name="462" href="#462">462</a>     }
-<a class="jxr_linenumber" name="463" href="#463">463</a>   }
-<a class="jxr_linenumber" name="464" href="#464">464</a> 
-<a class="jxr_linenumber" name="465" href="#465">465</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="466" href="#466">466</a> <em class="jxr_javadoccomment">   * sync getChildNames</em>
-<a class="jxr_linenumber" name="467" href="#467">467</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="468" href="#468">468</a> <em class="jxr_javadoccomment">   * @return null if parentPath doesn't exist</em>
-<a class="jxr_linenumber" name="469" href="#469">469</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="470" href="#470">470</a>   @Override
-<a class="jxr_linenumber" name="471" href="#471">471</a>   <strong class="jxr_keyword">public</strong> List&lt;String&gt; getChildNames(String parentPath, <strong class="jxr_keyword">int</strong> options)
-<a class="jxr_linenumber" name="472" href="#472">472</a>   {
-<a class="jxr_linenumber" name="473" href="#473">473</a>     <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="474" href="#474">474</a>     {
-<a class="jxr_linenumber" name="475" href="#475">475</a>       List&lt;String&gt; childNames = _zkClient.getChildren(parentPath);
-<a class="jxr_linenumber" name="476" href="#476">476</a>       Collections.sort(childNames);
-<a class="jxr_linenumber" name="477" href="#477">477</a>       <strong class="jxr_keyword">return</strong> childNames;
-<a class="jxr_linenumber" name="478" href="#478">478</a>     }
-<a class="jxr_linenumber" name="479" href="#479">479</a>     <strong class="jxr_keyword">catch</strong> (ZkNoNodeException e)
-<a class="jxr_linenumber" name="480" href="#480">480</a>     {
-<a class="jxr_linenumber" name="481" href="#481">481</a>       <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="482" href="#482">482</a>     }
-<a class="jxr_linenumber" name="483" href="#483">483</a>   }
-<a class="jxr_linenumber" name="484" href="#484">484</a> 
-<a class="jxr_linenumber" name="485" href="#485">485</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="486" href="#486">486</a> <em class="jxr_javadoccomment">   * sync exists</em>
-<a class="jxr_linenumber" name="487" href="#487">487</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="488" href="#488">488</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="489" href="#489">489</a>   @Override
-<a class="jxr_linenumber" name="490" href="#490">490</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> exists(String path, <strong class="jxr_keyword">int</strong> options)
-<a class="jxr_linenumber" name="491" href="#491">491</a>   {
-<a class="jxr_linenumber" name="492" href="#492">492</a>     <strong class="jxr_keyword">return</strong> _zkClient.exists(path);
-<a class="jxr_linenumber" name="493" href="#493">493</a>   }
-<a class="jxr_linenumber" name="494" href="#494">494</a> 
-<a class="jxr_linenumber" name="495" href="#495">495</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="496" href="#496">496</a> <em class="jxr_javadoccomment">   * sync getStat</em>
-<a class="jxr_linenumber" name="497" href="#497">497</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="498" href="#498">498</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="499" href="#499">499</a>   @Override
-<a class="jxr_linenumber" name="500" href="#500">500</a>   <strong class="jxr_keyword">public</strong> Stat getStat(String path, <strong class="jxr_keyword">int</strong> options)
-<a class="jxr_linenumber" name="501" href="#501">501</a>   {
-<a class="jxr_linenumber" name="502" href="#502">502</a>     <strong class="jxr_keyword">return</strong> _zkClient.getStat(path);
-<a class="jxr_linenumber" name="503" href="#503">503</a>   }
-<a class="jxr_linenumber" name="504" href="#504">504</a> 
-<a class="jxr_linenumber" name="505" href="#505">505</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="506" href="#506">506</a> <em class="jxr_javadoccomment">   * sync remove</em>
-<a class="jxr_linenumber" name="507" href="#507">507</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="508" href="#508">508</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="509" href="#509">509</a>   @Override
-<a class="jxr_linenumber" name="510" href="#510">510</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> remove(String path, <strong class="jxr_keyword">int</strong> options)
-<a class="jxr_linenumber" name="511" href="#511">511</a>   {
-<a class="jxr_linenumber" name="512" href="#512">512</a>     <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="513" href="#513">513</a>     {
-<a class="jxr_linenumber" name="514" href="#514">514</a>       <em class="jxr_comment">// optimize on common path</em>
-<a class="jxr_linenumber" name="515" href="#515">515</a>       _zkClient.delete(path);
-<a class="jxr_linenumber" name="516" href="#516">516</a>     }
-<a class="jxr_linenumber" name="517" href="#517">517</a>     <strong class="jxr_keyword">catch</strong> (ZkException e)
-<a class="jxr_linenumber" name="518" href="#518">518</a>     {
-<a class="jxr_linenumber" name="519" href="#519">519</a>       _zkClient.deleteRecursive(path);
-<a class="jxr_linenumber" name="520" href="#520">520</a>     }
-<a class="jxr_linenumber" name="521" href="#521">521</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="522" href="#522">522</a>   }
-<a class="jxr_linenumber" name="523" href="#523">523</a> 
-<a class="jxr_linenumber" name="524" href="#524">524</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="525" href="#525">525</a> <em class="jxr_javadoccomment">   * async create. give up on error other than NONODE</em>
-<a class="jxr_linenumber" name="526" href="#526">526</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="527" href="#527">527</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="528" href="#528">528</a>   <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[] create(List&lt;String&gt; paths,
-<a class="jxr_linenumber" name="529" href="#529">529</a>                                  List&lt;T&gt; records,
-<a class="jxr_linenumber" name="530" href="#530">530</a>                                  <strong class="jxr_keyword">boolean</strong>[] needCreate,
-<a class="jxr_linenumber" name="531" href="#531">531</a>                                  List&lt;List&lt;String&gt;&gt; pathsCreated,
-<a class="jxr_linenumber" name="532" href="#532">532</a>                                  <strong class="jxr_keyword">int</strong> options)
-<a class="jxr_linenumber" name="533" href="#533">533</a>   {
-<a class="jxr_linenumber" name="534" href="#534">534</a>     <strong class="jxr_keyword">if</strong> ((records != <strong class="jxr_keyword">null</strong> &amp;&amp; records.size() != paths.size())
-<a class="jxr_linenumber" name="535" href="#535">535</a>         || needCreate.length != paths.size()
-<a class="jxr_linenumber" name="536" href="#536">536</a>         || (pathsCreated != <strong class="jxr_keyword">null</strong> &amp;&amp; pathsCreated.size() != paths.size()))
-<a class="jxr_linenumber" name="537" href="#537">537</a>     {
-<a class="jxr_linenumber" name="538" href="#538">538</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(<span class="jxr_string">"paths, records, needCreate, and pathsCreated should be of same size"</span>);
-<a class="jxr_linenumber" name="539" href="#539">539</a>     }
-<a class="jxr_linenumber" name="540" href="#540">540</a> 
-<a class="jxr_linenumber" name="541" href="#541">541</a>     <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[] cbList = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[paths.size()];
-<a class="jxr_linenumber" name="542" href="#542">542</a> 
-<a class="jxr_linenumber" name="543" href="#543">543</a>     CreateMode mode = AccessOption.getMode(options);
-<a class="jxr_linenumber" name="544" href="#544">544</a>     <strong class="jxr_keyword">if</strong> (mode == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="545" href="#545">545</a>     {
-<a class="jxr_linenumber" name="546" href="#546">546</a>       LOG.error(<span class="jxr_string">"Invalid async set mode. options: "</span> + options);
-<a class="jxr_linenumber" name="547" href="#547">547</a>       <strong class="jxr_keyword">return</strong> cbList;
-<a class="jxr_linenumber" name="548" href="#548">548</a>     }
-<a class="jxr_linenumber" name="549" href="#549">549</a> 
-<a class="jxr_linenumber" name="550" href="#550">550</a>     <strong class="jxr_keyword">boolean</strong> retry;
-<a class="jxr_linenumber" name="551" href="#551">551</a>     <strong class="jxr_keyword">do</strong>
-<a class="jxr_linenumber" name="552" href="#552">552</a>     {
-<a class="jxr_linenumber" name="553" href="#553">553</a>       retry = false;
-<a class="jxr_linenumber" name="554" href="#554">554</a> 
-<a class="jxr_linenumber" name="555" href="#555">555</a>       <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; paths.size(); i++)
-<a class="jxr_linenumber" name="556" href="#556">556</a>       {
-<a class="jxr_linenumber" name="557" href="#557">557</a>         <strong class="jxr_keyword">if</strong> (!needCreate[i])
-<a class="jxr_linenumber" name="558" href="#558">558</a>           <strong class="jxr_keyword">continue</strong>;
-<a class="jxr_linenumber" name="559" href="#559">559</a> 
-<a class="jxr_linenumber" name="560" href="#560">560</a>         String path = paths.get(i);
-<a class="jxr_linenumber" name="561" href="#561">561</a>         T record = records == <strong class="jxr_keyword">null</strong> ? <strong class="jxr_keyword">null</strong> : records.get(i);
-<a class="jxr_linenumber" name="562" href="#562">562</a>         cbList[i] = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>();
-<a class="jxr_linenumber" name="563" href="#563">563</a>         _zkClient.asyncCreate(path, record, mode, cbList[i]);
-<a class="jxr_linenumber" name="564" href="#564">564</a>       }
-<a class="jxr_linenumber" name="565" href="#565">565</a> 
-<a class="jxr_linenumber" name="566" href="#566">566</a>       List&lt;String&gt; parentPaths =
-<a class="jxr_linenumber" name="567" href="#567">567</a>           <strong class="jxr_keyword">new</strong> ArrayList&lt;String&gt;(Collections.&lt;String&gt; nCopies(paths.size(), <strong class="jxr_keyword">null</strong>));
-<a class="jxr_linenumber" name="568" href="#568">568</a>       <strong class="jxr_keyword">boolean</strong> failOnNoNode = false;
-<a class="jxr_linenumber" name="569" href="#569">569</a> 
-<a class="jxr_linenumber" name="570" href="#570">570</a>       <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; paths.size(); i++)
-<a class="jxr_linenumber" name="571" href="#571">571</a>       {
-<a class="jxr_linenumber" name="572" href="#572">572</a>         <strong class="jxr_keyword">if</strong> (!needCreate[i])
-<a class="jxr_linenumber" name="573" href="#573">573</a>           <strong class="jxr_keyword">continue</strong>;
-<a class="jxr_linenumber" name="574" href="#574">574</a> 
-<a class="jxr_linenumber" name="575" href="#575">575</a>         <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a> cb = cbList[i];
-<a class="jxr_linenumber" name="576" href="#576">576</a>         cb.waitForSuccess();
-<a class="jxr_linenumber" name="577" href="#577">577</a>         String path = paths.get(i);
-<a class="jxr_linenumber" name="578" href="#578">578</a> 
-<a class="jxr_linenumber" name="579" href="#579">579</a>         <strong class="jxr_keyword">if</strong> (Code.get(cb.getRc()) == Code.NONODE)
-<a class="jxr_linenumber" name="580" href="#580">580</a>         {
-<a class="jxr_linenumber" name="581" href="#581">581</a>           String parentPath = <strong class="jxr_keyword">new</strong> File(path).getParent();
-<a class="jxr_linenumber" name="582" href="#582">582</a>           parentPaths.set(i, parentPath);
-<a class="jxr_linenumber" name="583" href="#583">583</a>           failOnNoNode = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="584" href="#584">584</a>         }
-<a class="jxr_linenumber" name="585" href="#585">585</a>         <strong class="jxr_keyword">else</strong>
-<a class="jxr_linenumber" name="586" href="#586">586</a>         {
-<a class="jxr_linenumber" name="587" href="#587">587</a>           <em class="jxr_comment">// if create succeed or fail on error other than NONODE,</em>
-<a class="jxr_linenumber" name="588" href="#588">588</a>           <em class="jxr_comment">// give up</em>
-<a class="jxr_linenumber" name="589" href="#589">589</a>           needCreate[i] = false;
-<a class="jxr_linenumber" name="590" href="#590">590</a> 
-<a class="jxr_linenumber" name="591" href="#591">591</a>           <em class="jxr_comment">// if succeeds, record what paths we've created</em>
-<a class="jxr_linenumber" name="592" href="#592">592</a>           <strong class="jxr_keyword">if</strong> (Code.get(cb.getRc()) == Code.OK &amp;&amp; pathsCreated != <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="593" href="#593">593</a>           {
-<a class="jxr_linenumber" name="594" href="#594">594</a>             <strong class="jxr_keyword">if</strong> (pathsCreated.get(i) == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="595" href="#595">595</a>             {
-<a class="jxr_linenumber" name="596" href="#596">596</a>               pathsCreated.set(i, <strong class="jxr_keyword">new</strong> ArrayList&lt;String&gt;());
-<a class="jxr_linenumber" name="597" href="#597">597</a>             }
-<a class="jxr_linenumber" name="598" href="#598">598</a>             pathsCreated.get(i).add(path);
-<a class="jxr_linenumber" name="599" href="#599">599</a>           }
-<a class="jxr_linenumber" name="600" href="#600">600</a>         }
-<a class="jxr_linenumber" name="601" href="#601">601</a>       }
-<a class="jxr_linenumber" name="602" href="#602">602</a> 
-<a class="jxr_linenumber" name="603" href="#603">603</a>       <strong class="jxr_keyword">if</strong> (failOnNoNode)
-<a class="jxr_linenumber" name="604" href="#604">604</a>       {
-<a class="jxr_linenumber" name="605" href="#605">605</a>         <strong class="jxr_keyword">boolean</strong>[] needCreateParent = Arrays.copyOf(needCreate, needCreate.length);
-<a class="jxr_linenumber" name="606" href="#606">606</a> 
-<a class="jxr_linenumber" name="607" href="#607">607</a>         <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[] parentCbList =
-<a class="jxr_linenumber" name="608" href="#608">608</a>             create(parentPaths, <strong class="jxr_keyword">null</strong>, needCreateParent, pathsCreated, AccessOption.PERSISTENT);
-<a class="jxr_linenumber" name="609" href="#609">609</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; parentCbList.length; i++)
-<a class="jxr_linenumber" name="610" href="#610">610</a>         {
-<a class="jxr_linenumber" name="611" href="#611">611</a>           <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a> parentCb = parentCbList[i];
-<a class="jxr_linenumber" name="612" href="#612">612</a>           <strong class="jxr_keyword">if</strong> (parentCb == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="613" href="#613">613</a>             <strong class="jxr_keyword">continue</strong>;
-<a class="jxr_linenumber" name="614" href="#614">614</a> 
-<a class="jxr_linenumber" name="615" href="#615">615</a>           Code rc = Code.get(parentCb.getRc());
-<a class="jxr_linenumber" name="616" href="#616">616</a> 
-<a class="jxr_linenumber" name="617" href="#617">617</a>           <em class="jxr_comment">// if parent is created, retry create child</em>
-<a class="jxr_linenumber" name="618" href="#618">618</a>           <strong class="jxr_keyword">if</strong> (rc == Code.OK || rc == Code.NODEEXISTS)
-<a class="jxr_linenumber" name="619" href="#619">619</a>           {
-<a class="jxr_linenumber" name="620" href="#620">620</a>             retry = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="621" href="#621">621</a>             <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="622" href="#622">622</a>           }
-<a class="jxr_linenumber" name="623" href="#623">623</a>         }
-<a class="jxr_linenumber" name="624" href="#624">624</a>       }
-<a class="jxr_linenumber" name="625" href="#625">625</a>     }
-<a class="jxr_linenumber" name="626" href="#626">626</a>     <strong class="jxr_keyword">while</strong> (retry);
-<a class="jxr_linenumber" name="627" href="#627">627</a> 
-<a class="jxr_linenumber" name="628" href="#628">628</a>     <strong class="jxr_keyword">return</strong> cbList;
-<a class="jxr_linenumber" name="629" href="#629">629</a>   }
+<a class="jxr_linenumber" name="408" href="#408">408</a>       <strong class="jxr_keyword">if</strong> (LOG.isDebugEnabled())
+<a class="jxr_linenumber" name="409" href="#409">409</a>       {
+<a class="jxr_linenumber" name="410" href="#410">410</a>         LOG.debug(<span class="jxr_string">"getData_async, size: "</span> + paths.size() + <span class="jxr_string">", paths: "</span> + paths.get(0)
+<a class="jxr_linenumber" name="411" href="#411">411</a>           + <span class="jxr_string">",... time: "</span> + (endT - startT) + <span class="jxr_string">" ns"</span>);
+<a class="jxr_linenumber" name="412" href="#412">412</a>       }
+<a class="jxr_linenumber" name="413" href="#413">413</a>     }
+<a class="jxr_linenumber" name="414" href="#414">414</a>   }
+<a class="jxr_linenumber" name="415" href="#415">415</a> 
+<a class="jxr_linenumber" name="416" href="#416">416</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="417" href="#417">417</a> <em class="jxr_javadoccomment">   * asyn getChildren</em>
+<a class="jxr_linenumber" name="418" href="#418">418</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="419" href="#419">419</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="420" href="#420">420</a>   @Override
+<a class="jxr_linenumber" name="421" href="#421">421</a>   <strong class="jxr_keyword">public</strong> List&lt;T&gt; getChildren(String parentPath, List&lt;Stat&gt; stats, <strong class="jxr_keyword">int</strong> options)
+<a class="jxr_linenumber" name="422" href="#422">422</a>   {
+<a class="jxr_linenumber" name="423" href="#423">423</a>     <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="424" href="#424">424</a>     {
+<a class="jxr_linenumber" name="425" href="#425">425</a>       <em class="jxr_comment">// prepare child paths</em>
+<a class="jxr_linenumber" name="426" href="#426">426</a>       List&lt;String&gt; childNames = getChildNames(parentPath, options);
+<a class="jxr_linenumber" name="427" href="#427">427</a>       <strong class="jxr_keyword">if</strong> (childNames == <strong class="jxr_keyword">null</strong> || childNames.size() == 0)
+<a class="jxr_linenumber" name="428" href="#428">428</a>       {
+<a class="jxr_linenumber" name="429" href="#429">429</a>         <strong class="jxr_keyword">return</strong> Collections.emptyList();
+<a class="jxr_linenumber" name="430" href="#430">430</a>       }
+<a class="jxr_linenumber" name="431" href="#431">431</a> 
+<a class="jxr_linenumber" name="432" href="#432">432</a>       List&lt;String&gt; paths = <strong class="jxr_keyword">new</strong> ArrayList&lt;String&gt;();
+<a class="jxr_linenumber" name="433" href="#433">433</a>       <strong class="jxr_keyword">for</strong> (String childName : childNames)
+<a class="jxr_linenumber" name="434" href="#434">434</a>       {
+<a class="jxr_linenumber" name="435" href="#435">435</a>         String path = parentPath + <span class="jxr_string">"/"</span> + childName;
+<a class="jxr_linenumber" name="436" href="#436">436</a>         paths.add(path);
+<a class="jxr_linenumber" name="437" href="#437">437</a>       }
+<a class="jxr_linenumber" name="438" href="#438">438</a> 
+<a class="jxr_linenumber" name="439" href="#439">439</a>       <em class="jxr_comment">// remove null record</em>
+<a class="jxr_linenumber" name="440" href="#440">440</a>       List&lt;Stat&gt; curStats = <strong class="jxr_keyword">new</strong> ArrayList&lt;Stat&gt;(paths.size());
+<a class="jxr_linenumber" name="441" href="#441">441</a>       List&lt;T&gt; records = get(paths, curStats, options);
+<a class="jxr_linenumber" name="442" href="#442">442</a>       Iterator&lt;T&gt; recordIter = records.iterator();
+<a class="jxr_linenumber" name="443" href="#443">443</a>       Iterator&lt;Stat&gt; statIter = curStats.iterator();
+<a class="jxr_linenumber" name="444" href="#444">444</a>       <strong class="jxr_keyword">while</strong> (statIter.hasNext())
+<a class="jxr_linenumber" name="445" href="#445">445</a>       {
+<a class="jxr_linenumber" name="446" href="#446">446</a>         recordIter.next();
+<a class="jxr_linenumber" name="447" href="#447">447</a>         <strong class="jxr_keyword">if</strong> (statIter.next() == <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="448" href="#448">448</a>         {
+<a class="jxr_linenumber" name="449" href="#449">449</a>           statIter.remove();
+<a class="jxr_linenumber" name="450" href="#450">450</a>           recordIter.remove();
+<a class="jxr_linenumber" name="451" href="#451">451</a>         }
+<a class="jxr_linenumber" name="452" href="#452">452</a>       }
+<a class="jxr_linenumber" name="453" href="#453">453</a> 
+<a class="jxr_linenumber" name="454" href="#454">454</a>       <strong class="jxr_keyword">if</strong> (stats != <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="455" href="#455">455</a>       {
+<a class="jxr_linenumber" name="456" href="#456">456</a>         stats.clear();
+<a class="jxr_linenumber" name="457" href="#457">457</a>         stats.addAll(curStats);
+<a class="jxr_linenumber" name="458" href="#458">458</a>       }
+<a class="jxr_linenumber" name="459" href="#459">459</a> 
+<a class="jxr_linenumber" name="460" href="#460">460</a>       <strong class="jxr_keyword">return</strong> records;
+<a class="jxr_linenumber" name="461" href="#461">461</a>     }
+<a class="jxr_linenumber" name="462" href="#462">462</a>     <strong class="jxr_keyword">catch</strong> (ZkNoNodeException e)
+<a class="jxr_linenumber" name="463" href="#463">463</a>     {
+<a class="jxr_linenumber" name="464" href="#464">464</a>       <strong class="jxr_keyword">return</strong> Collections.emptyList();
+<a class="jxr_linenumber" name="465" href="#465">465</a>     }
+<a class="jxr_linenumber" name="466" href="#466">466</a>   }
+<a class="jxr_linenumber" name="467" href="#467">467</a> 
+<a class="jxr_linenumber" name="468" href="#468">468</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="469" href="#469">469</a> <em class="jxr_javadoccomment">   * sync getChildNames</em>
+<a class="jxr_linenumber" name="470" href="#470">470</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="471" href="#471">471</a> <em class="jxr_javadoccomment">   * @return null if parentPath doesn't exist</em>
+<a class="jxr_linenumber" name="472" href="#472">472</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="473" href="#473">473</a>   @Override
+<a class="jxr_linenumber" name="474" href="#474">474</a>   <strong class="jxr_keyword">public</strong> List&lt;String&gt; getChildNames(String parentPath, <strong class="jxr_keyword">int</strong> options)
+<a class="jxr_linenumber" name="475" href="#475">475</a>   {
+<a class="jxr_linenumber" name="476" href="#476">476</a>     <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="477" href="#477">477</a>     {
+<a class="jxr_linenumber" name="478" href="#478">478</a>       List&lt;String&gt; childNames = _zkClient.getChildren(parentPath);
+<a class="jxr_linenumber" name="479" href="#479">479</a>       Collections.sort(childNames);
+<a class="jxr_linenumber" name="480" href="#480">480</a>       <strong class="jxr_keyword">return</strong> childNames;
+<a class="jxr_linenumber" name="481" href="#481">481</a>     }
+<a class="jxr_linenumber" name="482" href="#482">482</a>     <strong class="jxr_keyword">catch</strong> (ZkNoNodeException e)
+<a class="jxr_linenumber" name="483" href="#483">483</a>     {
+<a class="jxr_linenumber" name="484" href="#484">484</a>       <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="485" href="#485">485</a>     }
+<a class="jxr_linenumber" name="486" href="#486">486</a>   }
+<a class="jxr_linenumber" name="487" href="#487">487</a> 
+<a class="jxr_linenumber" name="488" href="#488">488</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="489" href="#489">489</a> <em class="jxr_javadoccomment">   * sync exists</em>
+<a class="jxr_linenumber" name="490" href="#490">490</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="491" href="#491">491</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="492" href="#492">492</a>   @Override
+<a class="jxr_linenumber" name="493" href="#493">493</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> exists(String path, <strong class="jxr_keyword">int</strong> options)
+<a class="jxr_linenumber" name="494" href="#494">494</a>   {
+<a class="jxr_linenumber" name="495" href="#495">495</a>     <strong class="jxr_keyword">return</strong> _zkClient.exists(path);
+<a class="jxr_linenumber" name="496" href="#496">496</a>   }
+<a class="jxr_linenumber" name="497" href="#497">497</a> 
+<a class="jxr_linenumber" name="498" href="#498">498</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="499" href="#499">499</a> <em class="jxr_javadoccomment">   * sync getStat</em>
+<a class="jxr_linenumber" name="500" href="#500">500</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="501" href="#501">501</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="502" href="#502">502</a>   @Override
+<a class="jxr_linenumber" name="503" href="#503">503</a>   <strong class="jxr_keyword">public</strong> Stat getStat(String path, <strong class="jxr_keyword">int</strong> options)
+<a class="jxr_linenumber" name="504" href="#504">504</a>   {
+<a class="jxr_linenumber" name="505" href="#505">505</a>     <strong class="jxr_keyword">return</strong> _zkClient.getStat(path);
+<a class="jxr_linenumber" name="506" href="#506">506</a>   }
+<a class="jxr_linenumber" name="507" href="#507">507</a> 
+<a class="jxr_linenumber" name="508" href="#508">508</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="509" href="#509">509</a> <em class="jxr_javadoccomment">   * sync remove</em>
+<a class="jxr_linenumber" name="510" href="#510">510</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="511" href="#511">511</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="512" href="#512">512</a>   @Override
+<a class="jxr_linenumber" name="513" href="#513">513</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> remove(String path, <strong class="jxr_keyword">int</strong> options)
+<a class="jxr_linenumber" name="514" href="#514">514</a>   {
+<a class="jxr_linenumber" name="515" href="#515">515</a>     <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="516" href="#516">516</a>     {
+<a class="jxr_linenumber" name="517" href="#517">517</a>       <em class="jxr_comment">// optimize on common path</em>
+<a class="jxr_linenumber" name="518" href="#518">518</a>       _zkClient.delete(path);
+<a class="jxr_linenumber" name="519" href="#519">519</a>     }
+<a class="jxr_linenumber" name="520" href="#520">520</a>     <strong class="jxr_keyword">catch</strong> (ZkException e)
+<a class="jxr_linenumber" name="521" href="#521">521</a>     {
+<a class="jxr_linenumber" name="522" href="#522">522</a>       _zkClient.deleteRecursive(path);
+<a class="jxr_linenumber" name="523" href="#523">523</a>     }
+<a class="jxr_linenumber" name="524" href="#524">524</a>     <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="525" href="#525">525</a>   }
+<a class="jxr_linenumber" name="526" href="#526">526</a> 
+<a class="jxr_linenumber" name="527" href="#527">527</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="528" href="#528">528</a> <em class="jxr_javadoccomment">   * async create. give up on error other than NONODE</em>
+<a class="jxr_linenumber" name="529" href="#529">529</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="530" href="#530">530</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="531" href="#531">531</a>   <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[] create(List&lt;String&gt; paths,
+<a class="jxr_linenumber" name="532" href="#532">532</a>                                  List&lt;T&gt; records,
+<a class="jxr_linenumber" name="533" href="#533">533</a>                                  <strong class="jxr_keyword">boolean</strong>[] needCreate,
+<a class="jxr_linenumber" name="534" href="#534">534</a>                                  List&lt;List&lt;String&gt;&gt; pathsCreated,
+<a class="jxr_linenumber" name="535" href="#535">535</a>                                  <strong class="jxr_keyword">int</strong> options)
+<a class="jxr_linenumber" name="536" href="#536">536</a>   {
+<a class="jxr_linenumber" name="537" href="#537">537</a>     <strong class="jxr_keyword">if</strong> ((records != <strong class="jxr_keyword">null</strong> &amp;&amp; records.size() != paths.size())
+<a class="jxr_linenumber" name="538" href="#538">538</a>         || needCreate.length != paths.size()
+<a class="jxr_linenumber" name="539" href="#539">539</a>         || (pathsCreated != <strong class="jxr_keyword">null</strong> &amp;&amp; pathsCreated.size() != paths.size()))
+<a class="jxr_linenumber" name="540" href="#540">540</a>     {
+<a class="jxr_linenumber" name="541" href="#541">541</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(<span class="jxr_string">"paths, records, needCreate, and pathsCreated should be of same size"</span>);
+<a class="jxr_linenumber" name="542" href="#542">542</a>     }
+<a class="jxr_linenumber" name="543" href="#543">543</a> 
+<a class="jxr_linenumber" name="544" href="#544">544</a>     <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[] cbList = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[paths.size()];
+<a class="jxr_linenumber" name="545" href="#545">545</a> 
+<a class="jxr_linenumber" name="546" href="#546">546</a>     CreateMode mode = AccessOption.getMode(options);
+<a class="jxr_linenumber" name="547" href="#547">547</a>     <strong class="jxr_keyword">if</strong> (mode == <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="548" href="#548">548</a>     {
+<a class="jxr_linenumber" name="549" href="#549">549</a>       LOG.error(<span class="jxr_string">"Invalid async set mode. options: "</span> + options);
+<a class="jxr_linenumber" name="550" href="#550">550</a>       <strong class="jxr_keyword">return</strong> cbList;
+<a class="jxr_linenumber" name="551" href="#551">551</a>     }
+<a class="jxr_linenumber" name="552" href="#552">552</a> 
+<a class="jxr_linenumber" name="553" href="#553">553</a>     <strong class="jxr_keyword">boolean</strong> retry;
+<a class="jxr_linenumber" name="554" href="#554">554</a>     <strong class="jxr_keyword">do</strong>
+<a class="jxr_linenumber" name="555" href="#555">555</a>     {
+<a class="jxr_linenumber" name="556" href="#556">556</a>       retry = false;
+<a class="jxr_linenumber" name="557" href="#557">557</a> 
+<a class="jxr_linenumber" name="558" href="#558">558</a>       <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; paths.size(); i++)
+<a class="jxr_linenumber" name="559" href="#559">559</a>       {
+<a class="jxr_linenumber" name="560" href="#560">560</a>         <strong class="jxr_keyword">if</strong> (!needCreate[i])
+<a class="jxr_linenumber" name="561" href="#561">561</a>           <strong class="jxr_keyword">continue</strong>;
+<a class="jxr_linenumber" name="562" href="#562">562</a> 
+<a class="jxr_linenumber" name="563" href="#563">563</a>         String path = paths.get(i);
+<a class="jxr_linenumber" name="564" href="#564">564</a>         T record = records == <strong class="jxr_keyword">null</strong> ? <strong class="jxr_keyword">null</strong> : records.get(i);
+<a class="jxr_linenumber" name="565" href="#565">565</a>         cbList[i] = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>();
+<a class="jxr_linenumber" name="566" href="#566">566</a>         _zkClient.asyncCreate(path, record, mode, cbList[i]);
+<a class="jxr_linenumber" name="567" href="#567">567</a>       }
+<a class="jxr_linenumber" name="568" href="#568">568</a> 
+<a class="jxr_linenumber" name="569" href="#569">569</a>       List&lt;String&gt; parentPaths =
+<a class="jxr_linenumber" name="570" href="#570">570</a>           <strong class="jxr_keyword">new</strong> ArrayList&lt;String&gt;(Collections.&lt;String&gt; nCopies(paths.size(), <strong class="jxr_keyword">null</strong>));
+<a class="jxr_linenumber" name="571" href="#571">571</a>       <strong class="jxr_keyword">boolean</strong> failOnNoNode = false;
+<a class="jxr_linenumber" name="572" href="#572">572</a> 
+<a class="jxr_linenumber" name="573" href="#573">573</a>       <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; paths.size(); i++)
+<a class="jxr_linenumber" name="574" href="#574">574</a>       {
+<a class="jxr_linenumber" name="575" href="#575">575</a>         <strong class="jxr_keyword">if</strong> (!needCreate[i])
+<a class="jxr_linenumber" name="576" href="#576">576</a>           <strong class="jxr_keyword">continue</strong>;
+<a class="jxr_linenumber" name="577" href="#577">577</a> 
+<a class="jxr_linenumber" name="578" href="#578">578</a>         <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a> cb = cbList[i];
+<a class="jxr_linenumber" name="579" href="#579">579</a>         cb.waitForSuccess();
+<a class="jxr_linenumber" name="580" href="#580">580</a>         String path = paths.get(i);
+<a class="jxr_linenumber" name="581" href="#581">581</a> 
+<a class="jxr_linenumber" name="582" href="#582">582</a>         <strong class="jxr_keyword">if</strong> (Code.get(cb.getRc()) == Code.NONODE)
+<a class="jxr_linenumber" name="583" href="#583">583</a>         {
+<a class="jxr_linenumber" name="584" href="#584">584</a>           String parentPath = <strong class="jxr_keyword">new</strong> File(path).getParent();
+<a class="jxr_linenumber" name="585" href="#585">585</a>           parentPaths.set(i, parentPath);
+<a class="jxr_linenumber" name="586" href="#586">586</a>           failOnNoNode = <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="587" href="#587">587</a>         }
+<a class="jxr_linenumber" name="588" href="#588">588</a>         <strong class="jxr_keyword">else</strong>
+<a class="jxr_linenumber" name="589" href="#589">589</a>         {
+<a class="jxr_linenumber" name="590" href="#590">590</a>           <em class="jxr_comment">// if create succeed or fail on error other than NONODE,</em>
+<a class="jxr_linenumber" name="591" href="#591">591</a>           <em class="jxr_comment">// give up</em>
+<a class="jxr_linenumber" name="592" href="#592">592</a>           needCreate[i] = false;
+<a class="jxr_linenumber" name="593" href="#593">593</a> 
+<a class="jxr_linenumber" name="594" href="#594">594</a>           <em class="jxr_comment">// if succeeds, record what paths we've created</em>
+<a class="jxr_linenumber" name="595" href="#595">595</a>           <strong class="jxr_keyword">if</strong> (Code.get(cb.getRc()) == Code.OK &amp;&amp; pathsCreated != <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="596" href="#596">596</a>           {
+<a class="jxr_linenumber" name="597" href="#597">597</a>             <strong class="jxr_keyword">if</strong> (pathsCreated.get(i) == <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="598" href="#598">598</a>             {
+<a class="jxr_linenumber" name="599" href="#599">599</a>               pathsCreated.set(i, <strong class="jxr_keyword">new</strong> ArrayList&lt;String&gt;());
+<a class="jxr_linenumber" name="600" href="#600">600</a>             }
+<a class="jxr_linenumber" name="601" href="#601">601</a>             pathsCreated.get(i).add(path);
+<a class="jxr_linenumber" name="602" href="#602">602</a>           }
+<a class="jxr_linenumber" name="603" href="#603">603</a>         }
+<a class="jxr_linenumber" name="604" href="#604">604</a>       }
+<a class="jxr_linenumber" name="605" href="#605">605</a> 
+<a class="jxr_linenumber" name="606" href="#606">606</a>       <strong class="jxr_keyword">if</strong> (failOnNoNode)
+<a class="jxr_linenumber" name="607" href="#607">607</a>       {
+<a class="jxr_linenumber" name="608" href="#608">608</a>         <strong class="jxr_keyword">boolean</strong>[] needCreateParent = Arrays.copyOf(needCreate, needCreate.length);
+<a class="jxr_linenumber" name="609" href="#609">609</a> 
+<a class="jxr_linenumber" name="610" href="#610">610</a>         <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[] parentCbList =
+<a class="jxr_linenumber" name="611" href="#611">611</a>             create(parentPaths, <strong class="jxr_keyword">null</strong>, needCreateParent, pathsCreated, AccessOption.PERSISTENT);
+<a class="jxr_linenumber" name="612" href="#612">612</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; parentCbList.length; i++)
+<a class="jxr_linenumber" name="613" href="#613">613</a>         {
+<a class="jxr_linenumber" name="614" href="#614">614</a>           <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a> parentCb = parentCbList[i];
+<a class="jxr_linenumber" name="615" href="#615">615</a>           <strong class="jxr_keyword">if</strong> (parentCb == <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="616" href="#616">616</a>             <strong class="jxr_keyword">continue</strong>;
+<a class="jxr_linenumber" name="617" href="#617">617</a> 
+<a class="jxr_linenumber" name="618" href="#618">618</a>           Code rc = Code.get(parentCb.getRc());
+<a class="jxr_linenumber" name="619" href="#619">619</a> 
+<a class="jxr_linenumber" name="620" href="#620">620</a>           <em class="jxr_comment">// if parent is created, retry create child</em>
+<a class="jxr_linenumber" name="621" href="#621">621</a>           <strong class="jxr_keyword">if</strong> (rc == Code.OK || rc == Code.NODEEXISTS)
+<a class="jxr_linenumber" name="622" href="#622">622</a>           {
+<a class="jxr_linenumber" name="623" href="#623">623</a>             retry = <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="624" href="#624">624</a>             <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="625" href="#625">625</a>           }
+<a class="jxr_linenumber" name="626" href="#626">626</a>         }
+<a class="jxr_linenumber" name="627" href="#627">627</a>       }
+<a class="jxr_linenumber" name="628" href="#628">628</a>     }
+<a class="jxr_linenumber" name="629" href="#629">629</a>     <strong class="jxr_keyword">while</strong> (retry);
 <a class="jxr_linenumber" name="630" href="#630">630</a> 
-<a class="jxr_linenumber" name="631" href="#631">631</a> 
-<a class="jxr_linenumber" name="632" href="#632">632</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="633" href="#633">633</a> <em class="jxr_javadoccomment">   * async create</em>
-<a class="jxr_linenumber" name="634" href="#634">634</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="635" href="#635">635</a> <em class="jxr_javadoccomment">   * TODO: rename to create</em>
-<a class="jxr_linenumber" name="636" href="#636">636</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="637" href="#637">637</a>   @Override
-<a class="jxr_linenumber" name="638" href="#638">638</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong>[] createChildren(List&lt;String&gt; paths, List&lt;T&gt; records, <strong class="jxr_keyword">int</strong> options)
-<a class="jxr_linenumber" name="639" href="#639">639</a>   {
-<a class="jxr_linenumber" name="640" href="#640">640</a>     <strong class="jxr_keyword">boolean</strong>[] success = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">boolean</strong>[paths.size()];
-<a class="jxr_linenumber" name="641" href="#641">641</a> 
-<a class="jxr_linenumber" name="642" href="#642">642</a>     CreateMode mode = AccessOption.getMode(options);
-<a class="jxr_linenumber" name="643" href="#643">643</a>     <strong class="jxr_keyword">if</strong> (mode == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="644" href="#644">644</a>     {
-<a class="jxr_linenumber" name="645" href="#645">645</a>       LOG.error(<span class="jxr_string">"Invalid async create mode. options: "</span> + options);
-<a class="jxr_linenumber" name="646" href="#646">646</a>       <strong class="jxr_keyword">return</strong> success;
-<a class="jxr_linenumber" name="647" href="#647">647</a>     }
-<a class="jxr_linenumber" name="648" href="#648">648</a> 
-<a class="jxr_linenumber" name="649" href="#649">649</a>     <strong class="jxr_keyword">boolean</strong>[] needCreate = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">boolean</strong>[paths.size()];
-<a class="jxr_linenumber" name="650" href="#650">650</a>     Arrays.fill(needCreate, <strong class="jxr_keyword">true</strong>);
-<a class="jxr_linenumber" name="651" href="#651">651</a>     List&lt;List&lt;String&gt;&gt; pathsCreated =
-<a class="jxr_linenumber" name="652" href="#652">652</a>         <strong class="jxr_keyword">new</strong> ArrayList&lt;List&lt;String&gt;&gt;(Collections.&lt;List&lt;String&gt;&gt; nCopies(paths.size(), <strong class="jxr_keyword">null</strong>));
-<a class="jxr_linenumber" name="653" href="#653">653</a> 
-<a class="jxr_linenumber" name="654" href="#654">654</a>     <strong class="jxr_keyword">long</strong> startT = System.nanoTime();
-<a class="jxr_linenumber" name="655" href="#655">655</a>     <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="656" href="#656">656</a>     {
-<a class="jxr_linenumber" name="657" href="#657">657</a> 
-<a class="jxr_linenumber" name="658" href="#658">658</a>       <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[] cbList =
-<a class="jxr_linenumber" name="659" href="#659">659</a>           create(paths, records, needCreate, pathsCreated, options);
+<a class="jxr_linenumber" name="631" href="#631">631</a>     <strong class="jxr_keyword">return</strong> cbList;
+<a class="jxr_linenumber" name="632" href="#632">632</a>   }
+<a class="jxr_linenumber" name="633" href="#633">633</a> 
+<a class="jxr_linenumber" name="634" href="#634">634</a> 
+<a class="jxr_linenumber" name="635" href="#635">635</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="636" href="#636">636</a> <em class="jxr_javadoccomment">   * async create</em>
+<a class="jxr_linenumber" name="637" href="#637">637</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="638" href="#638">638</a> <em class="jxr_javadoccomment">   * TODO: rename to create</em>
+<a class="jxr_linenumber" name="639" href="#639">639</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="640" href="#640">640</a>   @Override
+<a class="jxr_linenumber" name="641" href="#641">641</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong>[] createChildren(List&lt;String&gt; paths, List&lt;T&gt; records, <strong class="jxr_keyword">int</strong> options)
+<a class="jxr_linenumber" name="642" href="#642">642</a>   {
+<a class="jxr_linenumber" name="643" href="#643">643</a>     <strong class="jxr_keyword">boolean</strong>[] success = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">boolean</strong>[paths.size()];
+<a class="jxr_linenumber" name="644" href="#644">644</a> 
+<a class="jxr_linenumber" name="645" href="#645">645</a>     CreateMode mode = AccessOption.getMode(options);
+<a class="jxr_linenumber" name="646" href="#646">646</a>     <strong class="jxr_keyword">if</strong> (mode == <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="647" href="#647">647</a>     {
+<a class="jxr_linenumber" name="648" href="#648">648</a>       LOG.error(<span class="jxr_string">"Invalid async create mode. options: "</span> + options);
+<a class="jxr_linenumber" name="649" href="#649">649</a>       <strong class="jxr_keyword">return</strong> success;
+<a class="jxr_linenumber" name="650" href="#650">650</a>     }
+<a class="jxr_linenumber" name="651" href="#651">651</a> 
+<a class="jxr_linenumber" name="652" href="#652">652</a>     <strong class="jxr_keyword">boolean</strong>[] needCreate = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">boolean</strong>[paths.size()];
+<a class="jxr_linenumber" name="653" href="#653">653</a>     Arrays.fill(needCreate, <strong class="jxr_keyword">true</strong>);
+<a class="jxr_linenumber" name="654" href="#654">654</a>     List&lt;List&lt;String&gt;&gt; pathsCreated =
+<a class="jxr_linenumber" name="655" href="#655">655</a>         <strong class="jxr_keyword">new</strong> ArrayList&lt;List&lt;String&gt;&gt;(Collections.&lt;List&lt;String&gt;&gt; nCopies(paths.size(), <strong class="jxr_keyword">null</strong>));
+<a class="jxr_linenumber" name="656" href="#656">656</a> 
+<a class="jxr_linenumber" name="657" href="#657">657</a>     <strong class="jxr_keyword">long</strong> startT = System.nanoTime();
+<a class="jxr_linenumber" name="658" href="#658">658</a>     <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="659" href="#659">659</a>     {
 <a class="jxr_linenumber" name="660" href="#660">660</a> 
-<a class="jxr_linenumber" name="661" href="#661">661</a>       <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; cbList.length; i++)
-<a class="jxr_linenumber" name="662" href="#662">662</a>       {
-<a class="jxr_linenumber" name="663" href="#663">663</a>         <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a> cb = cbList[i];
-<a class="jxr_linenumber" name="664" href="#664">664</a>         success[i] = (Code.get(cb.getRc()) == Code.OK);
-<a class="jxr_linenumber" name="665" href="#665">665</a>       }
-<a class="jxr_linenumber" name="666" href="#666">666</a> 
-<a class="jxr_linenumber" name="667" href="#667">667</a>       <strong class="jxr_keyword">return</strong> success;
-<a class="jxr_linenumber" name="668" href="#668">668</a> 
-<a class="jxr_linenumber" name="669" href="#669">669</a>     }
-<a class="jxr_linenumber" name="670" href="#670">670</a>     <strong class="jxr_keyword">finally</strong>
-<a class="jxr_linenumber" name="671" href="#671">671</a>     {
-<a class="jxr_linenumber" name="672" href="#672">672</a>       <strong class="jxr_keyword">long</strong> endT = System.nanoTime();
-<a class="jxr_linenumber" name="673" href="#673">673</a>       LOG.info(<span class="jxr_string">"create_async, size: "</span> + paths.size() + <span class="jxr_string">", paths: "</span> + paths.get(0)
-<a class="jxr_linenumber" name="674" href="#674">674</a>           + <span class="jxr_string">",... time: "</span> + (endT - startT) + <span class="jxr_string">" ns"</span>);
-<a class="jxr_linenumber" name="675" href="#675">675</a>     }
-<a class="jxr_linenumber" name="676" href="#676">676</a>   }
-<a class="jxr_linenumber" name="677" href="#677">677</a> 
-<a class="jxr_linenumber" name="678" href="#678">678</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="679" href="#679">679</a> <em class="jxr_javadoccomment">   * async set</em>
-<a class="jxr_linenumber" name="680" href="#680">680</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="681" href="#681">681</a> <em class="jxr_javadoccomment">   * TODO: rename to set</em>
-<a class="jxr_linenumber" name="682" href="#682">682</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="683" href="#683">683</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="684" href="#684">684</a>   @Override
-<a class="jxr_linenumber" name="685" href="#685">685</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong>[] setChildren(List&lt;String&gt; paths, List&lt;T&gt; records, <strong class="jxr_keyword">int</strong> options)
-<a class="jxr_linenumber" name="686" href="#686">686</a>   {
-<a class="jxr_linenumber" name="687" href="#687">687</a>     <strong class="jxr_keyword">return</strong> set(paths, records, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, options);
-<a class="jxr_linenumber" name="688" href="#688">688</a>   }
-<a class="jxr_linenumber" name="689" href="#689">689</a> 
-<a class="jxr_linenumber" name="690" href="#690">690</a>   <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="691" href="#691">691</a> <em class="jxr_javadoccomment">   * async set, give up on error other than NoNode</em>
-<a class="jxr_linenumber" name="692" href="#692">692</a> <em class="jxr_javadoccomment">   * </em>
-<a class="jxr_linenumber" name="693" href="#693">693</a> <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="694" href="#694">694</a>   <strong class="jxr_keyword">boolean</strong>[] set(List&lt;String&gt; paths,
-<a class="jxr_linenumber" name="695" href="#695">695</a>                 List&lt;T&gt; records,
-<a class="jxr_linenumber" name="696" href="#696">696</a>                 List&lt;List&lt;String&gt;&gt; pathsCreated,
-<a class="jxr_linenumber" name="697" href="#697">697</a>                 List&lt;Stat&gt; stats,
-<a class="jxr_linenumber" name="698" href="#698">698</a>                 <strong class="jxr_keyword">int</strong> options)
-<a class="jxr_linenumber" name="699" href="#699">699</a>   {
-<a class="jxr_linenumber" name="700" href="#700">700</a>     <strong class="jxr_keyword">if</strong> (paths == <strong class="jxr_keyword">null</strong> || paths.size() == 0)
-<a class="jxr_linenumber" name="701" href="#701">701</a>     {
-<a class="jxr_linenumber" name="702" href="#702">702</a>       <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">boolean</strong>[0];
-<a class="jxr_linenumber" name="703" href="#703">703</a>     }
-<a class="jxr_linenumber" name="704" href="#704">704</a> 
-<a class="jxr_linenumber" name="705" href="#705">705</a>     <strong class="jxr_keyword">if</strong> ((records != <strong class="jxr_keyword">null</strong> &amp;&amp; records.size() != paths.size())
-<a class="jxr_linenumber" name="706" href="#706">706</a>         || (pathsCreated != <strong class="jxr_keyword">null</strong> &amp;&amp; pathsCreated.size() != paths.size()))
+<a class="jxr_linenumber" name="661" href="#661">661</a>       <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[] cbList =
+<a class="jxr_linenumber" name="662" href="#662">662</a>           create(paths, records, needCreate, pathsCreated, options);
+<a class="jxr_linenumber" name="663" href="#663">663</a> 
+<a class="jxr_linenumber" name="664" href="#664">664</a>       <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; cbList.length; i++)
+<a class="jxr_linenumber" name="665" href="#665">665</a>       {
+<a class="jxr_linenumber" name="666" href="#666">666</a>         <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a> cb = cbList[i];
+<a class="jxr_linenumber" name="667" href="#667">667</a>         success[i] = (Code.get(cb.getRc()) == Code.OK);
+<a class="jxr_linenumber" name="668" href="#668">668</a>       }
+<a class="jxr_linenumber" name="669" href="#669">669</a> 
+<a class="jxr_linenumber" name="670" href="#670">670</a>       <strong class="jxr_keyword">return</strong> success;
+<a class="jxr_linenumber" name="671" href="#671">671</a> 
+<a class="jxr_linenumber" name="672" href="#672">672</a>     }
+<a class="jxr_linenumber" name="673" href="#673">673</a>     <strong class="jxr_keyword">finally</strong>
+<a class="jxr_linenumber" name="674" href="#674">674</a>     {
+<a class="jxr_linenumber" name="675" href="#675">675</a>       <strong class="jxr_keyword">long</strong> endT = System.nanoTime();
+<a class="jxr_linenumber" name="676" href="#676">676</a>       <strong class="jxr_keyword">if</strong> (LOG.isDebugEnabled())
+<a class="jxr_linenumber" name="677" href="#677">677</a>       {
+<a class="jxr_linenumber" name="678" href="#678">678</a>         LOG.debug(<span class="jxr_string">"create_async, size: "</span> + paths.size() + <span class="jxr_string">", paths: "</span> + paths.get(0)
+<a class="jxr_linenumber" name="679" href="#679">679</a>           + <span class="jxr_string">",... time: "</span> + (endT - startT) + <span class="jxr_string">" ns"</span>);
+<a class="jxr_linenumber" name="680" href="#680">680</a>       }
+<a class="jxr_linenumber" name="681" href="#681">681</a>     }
+<a class="jxr_linenumber" name="682" href="#682">682</a>   }
+<a class="jxr_linenumber" name="683" href="#683">683</a> 
+<a class="jxr_linenumber" name="684" href="#684">684</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="685" href="#685">685</a> <em class="jxr_javadoccomment">   * async set</em>
+<a class="jxr_linenumber" name="686" href="#686">686</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="687" href="#687">687</a> <em class="jxr_javadoccomment">   * TODO: rename to set</em>
+<a class="jxr_linenumber" name="688" href="#688">688</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="689" href="#689">689</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="690" href="#690">690</a>   @Override
+<a class="jxr_linenumber" name="691" href="#691">691</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong>[] setChildren(List&lt;String&gt; paths, List&lt;T&gt; records, <strong class="jxr_keyword">int</strong> options)
+<a class="jxr_linenumber" name="692" href="#692">692</a>   {
+<a class="jxr_linenumber" name="693" href="#693">693</a>     <strong class="jxr_keyword">return</strong> set(paths, records, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, options);
+<a class="jxr_linenumber" name="694" href="#694">694</a>   }
+<a class="jxr_linenumber" name="695" href="#695">695</a> 
+<a class="jxr_linenumber" name="696" href="#696">696</a>   <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="697" href="#697">697</a> <em class="jxr_javadoccomment">   * async set, give up on error other than NoNode</em>
+<a class="jxr_linenumber" name="698" href="#698">698</a> <em class="jxr_javadoccomment">   * </em>
+<a class="jxr_linenumber" name="699" href="#699">699</a> <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="700" href="#700">700</a>   <strong class="jxr_keyword">boolean</strong>[] set(List&lt;String&gt; paths,
+<a class="jxr_linenumber" name="701" href="#701">701</a>                 List&lt;T&gt; records,
+<a class="jxr_linenumber" name="702" href="#702">702</a>                 List&lt;List&lt;String&gt;&gt; pathsCreated,
+<a class="jxr_linenumber" name="703" href="#703">703</a>                 List&lt;Stat&gt; stats,
+<a class="jxr_linenumber" name="704" href="#704">704</a>                 <strong class="jxr_keyword">int</strong> options)
+<a class="jxr_linenumber" name="705" href="#705">705</a>   {
+<a class="jxr_linenumber" name="706" href="#706">706</a>     <strong class="jxr_keyword">if</strong> (paths == <strong class="jxr_keyword">null</strong> || paths.size() == 0)
 <a class="jxr_linenumber" name="707" href="#707">707</a>     {
-<a class="jxr_linenumber" name="708" href="#708">708</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(<span class="jxr_string">"paths, records, and pathsCreated should be of same size"</span>);
+<a class="jxr_linenumber" name="708" href="#708">708</a>       <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">boolean</strong>[0];
 <a class="jxr_linenumber" name="709" href="#709">709</a>     }
 <a class="jxr_linenumber" name="710" href="#710">710</a> 
-<a class="jxr_linenumber" name="711" href="#711">711</a>     <strong class="jxr_keyword">boolean</strong>[] success = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">boolean</strong>[paths.size()];
-<a class="jxr_linenumber" name="712" href="#712">712</a> 
-<a class="jxr_linenumber" name="713" href="#713">713</a>     CreateMode mode = AccessOption.getMode(options);
-<a class="jxr_linenumber" name="714" href="#714">714</a>     <strong class="jxr_keyword">if</strong> (mode == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="715" href="#715">715</a>     {
-<a class="jxr_linenumber" name="716" href="#716">716</a>       LOG.error(<span class="jxr_string">"Invalid async set mode. options: "</span> + options);
-<a class="jxr_linenumber" name="717" href="#717">717</a>       <strong class="jxr_keyword">return</strong> success;
-<a class="jxr_linenumber" name="718" href="#718">718</a>     }
-<a class="jxr_linenumber" name="719" href="#719">719</a> 
-<a class="jxr_linenumber" name="720" href="#720">720</a>     List&lt;Stat&gt; setStats =
-<a class="jxr_linenumber" name="721" href="#721">721</a>         <strong class="jxr_keyword">new</strong> ArrayList&lt;Stat&gt;(Collections.&lt;Stat&gt; nCopies(paths.size(), <strong class="jxr_keyword">null</strong>));
-<a class="jxr_linenumber" name="722" href="#722">722</a>     <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">SetDataCallbackHandler</a>[] cbList = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">SetDataCallbackHandler</a>[paths.size()];
-<a class="jxr_linenumber" name="723" href="#723">723</a>     <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[] createCbList = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="724" href="#724">724</a>     <strong class="jxr_keyword">boolean</strong>[] needSet = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">boolean</strong>[paths.size()];
-<a class="jxr_linenumber" name="725" href="#725">725</a>     Arrays.fill(needSet, <strong class="jxr_keyword">true</strong>);
-<a class="jxr_linenumber" name="726" href="#726">726</a> 
-<a class="jxr_linenumber" name="727" href="#727">727</a>     <strong class="jxr_keyword">long</strong> startT = System.nanoTime();
-<a class="jxr_linenumber" name="728" href="#728">728</a> 
-<a class="jxr_linenumber" name="729" href="#729">729</a>     <strong class="jxr_keyword">try</strong>
-<a class="jxr_linenumber" name="730" href="#730">730</a>     {
-<a class="jxr_linenumber" name="731" href="#731">731</a>       <strong class="jxr_keyword">boolean</strong> retry;
-<a class="jxr_linenumber" name="732" href="#732">732</a>       <strong class="jxr_keyword">do</strong>
-<a class="jxr_linenumber" name="733" href="#733">733</a>       {
-<a class="jxr_linenumber" name="734" href="#734">734</a>         retry = false;
-<a class="jxr_linenumber" name="735" href="#735">735</a> 
-<a class="jxr_linenumber" name="736" href="#736">736</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; paths.size(); i++)
-<a class="jxr_linenumber" name="737" href="#737">737</a>         {
-<a class="jxr_linenumber" name="738" href="#738">738</a>           <strong class="jxr_keyword">if</strong> (!needSet[i])
-<a class="jxr_linenumber" name="739" href="#739">739</a>             <strong class="jxr_keyword">continue</strong>;
-<a class="jxr_linenumber" name="740" href="#740">740</a> 
-<a class="jxr_linenumber" name="741" href="#741">741</a>           String path = paths.get(i);
-<a class="jxr_linenumber" name="742" href="#742">742</a>           T record = records.get(i);
-<a class="jxr_linenumber" name="743" href="#743">743</a>           cbList[i] = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">SetDataCallbackHandler</a>();
-<a class="jxr_linenumber" name="744" href="#744">744</a>           _zkClient.asyncSetData(path, record, -1, cbList[i]);
-<a class="jxr_linenumber" name="745" href="#745">745</a> 
-<a class="jxr_linenumber" name="746" href="#746">746</a>         }
-<a class="jxr_linenumber" name="747" href="#747">747</a> 
-<a class="jxr_linenumber" name="748" href="#748">748</a>         <strong class="jxr_keyword">boolean</strong> failOnNoNode = false;
-<a class="jxr_linenumber" name="749" href="#749">749</a> 
-<a class="jxr_linenumber" name="750" href="#750">750</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; cbList.length; i++)
-<a class="jxr_linenumber" name="751" href="#751">751</a>         {
-<a class="jxr_linenumber" name="752" href="#752">752</a>           <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">SetDataCallbackHandler</a> cb = cbList[i];
-<a class="jxr_linenumber" name="753" href="#753">753</a>           cb.waitForSuccess();
-<a class="jxr_linenumber" name="754" href="#754">754</a>           Code rc = Code.get(cb.getRc());
-<a class="jxr_linenumber" name="755" href="#755">755</a>           <strong class="jxr_keyword">switch</strong> (rc)
-<a class="jxr_linenumber" name="756" href="#756">756</a>           {
-<a class="jxr_linenumber" name="757" href="#757">757</a>           <strong class="jxr_keyword">case</strong> OK:
-<a class="jxr_linenumber" name="758" href="#758">758</a>             setStats.set(i, cb.getStat());
-<a class="jxr_linenumber" name="759" href="#759">759</a>             needSet[i] = false;
-<a class="jxr_linenumber" name="760" href="#760">760</a>             <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="761" href="#761">761</a>           <strong class="jxr_keyword">case</strong> NONODE:
-<a class="jxr_linenumber" name="762" href="#762">762</a>             <em class="jxr_comment">// if fail on NoNode, try create the node</em>
-<a class="jxr_linenumber" name="763" href="#763">763</a>             failOnNoNode = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="764" href="#764">764</a>             <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="765" href="#765">765</a>           <strong class="jxr_keyword">default</strong>:
-<a class="jxr_linenumber" name="766" href="#766">766</a>             <em class="jxr_comment">// if fail on error other than NoNode, give up</em>
-<a class="jxr_linenumber" name="767" href="#767">767</a>             needSet[i] = false;
-<a class="jxr_linenumber" name="768" href="#768">768</a>             <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="769" href="#769">769</a>           }
-<a class="jxr_linenumber" name="770" href="#770">770</a>         }
-<a class="jxr_linenumber" name="771" href="#771">771</a> 
-<a class="jxr_linenumber" name="772" href="#772">772</a>         <em class="jxr_comment">// if failOnNoNode, try create</em>
-<a class="jxr_linenumber" name="773" href="#773">773</a>         <strong class="jxr_keyword">if</strong> (failOnNoNode)
-<a class="jxr_linenumber" name="774" href="#774">774</a>         {
-<a class="jxr_linenumber" name="775" href="#775">775</a>           <strong class="jxr_keyword">boolean</strong>[] needCreate = Arrays.copyOf(needSet, needSet.length);
-<a class="jxr_linenumber" name="776" href="#776">776</a>           createCbList = create(paths, records, needCreate, pathsCreated, options);
-<a class="jxr_linenumber" name="777" href="#777">777</a>           <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; createCbList.length; i++)
-<a class="jxr_linenumber" name="778" href="#778">778</a>           {
-<a class="jxr_linenumber" name="779" href="#779">779</a>             <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a> createCb = createCbList[i];
-<a class="jxr_linenumber" name="780" href="#780">780</a>             <strong class="jxr_keyword">if</strong> (createCb == <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="781" href="#781">781</a>             {
-<a class="jxr_linenumber" name="782" href="#782">782</a>               <strong class="jxr_keyword">continue</strong>;
-<a class="jxr_linenumber" name="783" href="#783">783</a>             }
-<a class="jxr_linenumber" name="784" href="#784">784</a> 
-<a class="jxr_linenumber" name="785" href="#785">785</a>             Code rc = Code.get(createCb.getRc());
-<a class="jxr_linenumber" name="786" href="#786">786</a>             <strong class="jxr_keyword">switch</strong> (rc)
+<a class="jxr_linenumber" name="711" href="#711">711</a>     <strong class="jxr_keyword">if</strong> ((records != <strong class="jxr_keyword">null</strong> &amp;&amp; records.size() != paths.size())
+<a class="jxr_linenumber" name="712" href="#712">712</a>         || (pathsCreated != <strong class="jxr_keyword">null</strong> &amp;&amp; pathsCreated.size() != paths.size()))
+<a class="jxr_linenumber" name="713" href="#713">713</a>     {
+<a class="jxr_linenumber" name="714" href="#714">714</a>       <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IllegalArgumentException(<span class="jxr_string">"paths, records, and pathsCreated should be of same size"</span>);
+<a class="jxr_linenumber" name="715" href="#715">715</a>     }
+<a class="jxr_linenumber" name="716" href="#716">716</a> 
+<a class="jxr_linenumber" name="717" href="#717">717</a>     <strong class="jxr_keyword">boolean</strong>[] success = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">boolean</strong>[paths.size()];
+<a class="jxr_linenumber" name="718" href="#718">718</a> 
+<a class="jxr_linenumber" name="719" href="#719">719</a>     CreateMode mode = AccessOption.getMode(options);
+<a class="jxr_linenumber" name="720" href="#720">720</a>     <strong class="jxr_keyword">if</strong> (mode == <strong class="jxr_keyword">null</strong>)
+<a class="jxr_linenumber" name="721" href="#721">721</a>     {
+<a class="jxr_linenumber" name="722" href="#722">722</a>       LOG.error(<span class="jxr_string">"Invalid async set mode. options: "</span> + options);
+<a class="jxr_linenumber" name="723" href="#723">723</a>       <strong class="jxr_keyword">return</strong> success;
+<a class="jxr_linenumber" name="724" href="#724">724</a>     }
+<a class="jxr_linenumber" name="725" href="#725">725</a> 
+<a class="jxr_linenumber" name="726" href="#726">726</a>     List&lt;Stat&gt; setStats =
+<a class="jxr_linenumber" name="727" href="#727">727</a>         <strong class="jxr_keyword">new</strong> ArrayList&lt;Stat&gt;(Collections.&lt;Stat&gt; nCopies(paths.size(), <strong class="jxr_keyword">null</strong>));
+<a class="jxr_linenumber" name="728" href="#728">728</a>     <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">SetDataCallbackHandler</a>[] cbList = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">SetDataCallbackHandler</a>[paths.size()];
+<a class="jxr_linenumber" name="729" href="#729">729</a>     <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a>[] createCbList = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="730" href="#730">730</a>     <strong class="jxr_keyword">boolean</strong>[] needSet = <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">boolean</strong>[paths.size()];
+<a class="jxr_linenumber" name="731" href="#731">731</a>     Arrays.fill(needSet, <strong class="jxr_keyword">true</strong>);
+<a class="jxr_linenumber" name="732" href="#732">732</a> 
+<a class="jxr_linenumber" name="733" href="#733">733</a>     <strong class="jxr_keyword">long</strong> startT = System.nanoTime();
+<a class="jxr_linenumber" name="734" href="#734">734</a> 
+<a class="jxr_linenumber" name="735" href="#735">735</a>     <strong class="jxr_keyword">try</strong>
+<a class="jxr_linenumber" name="736" href="#736">736</a>     {
+<a class="jxr_linenumber" name="737" href="#737">737</a>       <strong class="jxr_keyword">boolean</strong> retry;
+<a class="jxr_linenumber" name="738" href="#738">738</a>       <strong class="jxr_keyword">do</strong>
+<a class="jxr_linenumber" name="739" href="#739">739</a>       {
+<a class="jxr_linenumber" name="740" href="#740">740</a>         retry = false;
+<a class="jxr_linenumber" name="741" href="#741">741</a> 
+<a class="jxr_linenumber" name="742" href="#742">742</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; paths.size(); i++)
+<a class="jxr_linenumber" name="743" href="#743">743</a>         {
+<a class="jxr_linenumber" name="744" href="#744">744</a>           <strong class="jxr_keyword">if</strong> (!needSet[i])
+<a class="jxr_linenumber" name="745" href="#745">745</a>             <strong class="jxr_keyword">continue</strong>;
+<a class="jxr_linenumber" name="746" href="#746">746</a> 
+<a class="jxr_linenumber" name="747" href="#747">747</a>           String path = paths.get(i);
+<a class="jxr_linenumber" name="748" href="#748">748</a>           T record = records.get(i);
+<a class="jxr_linenumber" name="749" href="#749">749</a>           cbList[i] = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">SetDataCallbackHandler</a>();
+<a class="jxr_linenumber" name="750" href="#750">750</a>           _zkClient.asyncSetData(path, record, -1, cbList[i]);
+<a class="jxr_linenumber" name="751" href="#751">751</a> 
+<a class="jxr_linenumber" name="752" href="#752">752</a>         }
+<a class="jxr_linenumber" name="753" href="#753">753</a> 
+<a class="jxr_linenumber" name="754" href="#754">754</a>         <strong class="jxr_keyword">boolean</strong> failOnNoNode = false;
+<a class="jxr_linenumber" name="755" href="#755">755</a> 
+<a class="jxr_linenumber" name="756" href="#756">756</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; cbList.length; i++)
+<a class="jxr_linenumber" name="757" href="#757">757</a>         {
+<a class="jxr_linenumber" name="758" href="#758">758</a>           <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">SetDataCallbackHandler</a> cb = cbList[i];
+<a class="jxr_linenumber" name="759" href="#759">759</a>           cb.waitForSuccess();
+<a class="jxr_linenumber" name="760" href="#760">760</a>           Code rc = Code.get(cb.getRc());
+<a class="jxr_linenumber" name="761" href="#761">761</a>           <strong class="jxr_keyword">switch</strong> (rc)
+<a class="jxr_linenumber" name="762" href="#762">762</a>           {
+<a class="jxr_linenumber" name="763" href="#763">763</a>           <strong class="jxr_keyword">case</strong> OK:
+<a class="jxr_linenumber" name="764" href="#764">764</a>             setStats.set(i, cb.getStat());
+<a class="jxr_linenumber" name="765" href="#765">765</a>             needSet[i] = false;
+<a class="jxr_linenumber" name="766" href="#766">766</a>             <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="767" href="#767">767</a>           <strong class="jxr_keyword">case</strong> NONODE:
+<a class="jxr_linenumber" name="768" href="#768">768</a>             <em class="jxr_comment">// if fail on NoNode, try create the node</em>
+<a class="jxr_linenumber" name="769" href="#769">769</a>             failOnNoNode = <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="770" href="#770">770</a>             <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="771" href="#771">771</a>           <strong class="jxr_keyword">default</strong>:
+<a class="jxr_linenumber" name="772" href="#772">772</a>             <em class="jxr_comment">// if fail on error other than NoNode, give up</em>
+<a class="jxr_linenumber" name="773" href="#773">773</a>             needSet[i] = false;
+<a class="jxr_linenumber" name="774" href="#774">774</a>             <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="775" href="#775">775</a>           }
+<a class="jxr_linenumber" name="776" href="#776">776</a>         }
+<a class="jxr_linenumber" name="777" href="#777">777</a> 
+<a class="jxr_linenumber" name="778" href="#778">778</a>         <em class="jxr_comment">// if failOnNoNode, try create</em>
+<a class="jxr_linenumber" name="779" href="#779">779</a>         <strong class="jxr_keyword">if</strong> (failOnNoNode)
+<a class="jxr_linenumber" name="780" href="#780">780</a>         {
+<a class="jxr_linenumber" name="781" href="#781">781</a>           <strong class="jxr_keyword">boolean</strong>[] needCreate = Arrays.copyOf(needSet, needSet.length);
+<a class="jxr_linenumber" name="782" href="#782">782</a>           createCbList = create(paths, records, needCreate, pathsCreated, options);
+<a class="jxr_linenumber" name="783" href="#783">783</a>           <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; createCbList.length; i++)
+<a class="jxr_linenumber" name="784" href="#784">784</a>           {
+<a class="jxr_linenumber" name="785" href="#785">785</a>             <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a> createCb = createCbList[i];
+<a class="jxr_linenumber" name="786" href="#786">786</a>             <strong class="jxr_keyword">if</strong> (createCb == <strong class="jxr_keyword">null</strong>)
 <a class="jxr_linenumber" name="787" href="#787">787</a>             {
-<a class="jxr_linenumber" name="788" href="#788">788</a>             <strong class="jxr_keyword">case</strong> OK:
-<a class="jxr_linenumber" name="789" href="#789">789</a>               setStats.set(i, ZNode.ZERO_STAT);
-<a class="jxr_linenumber" name="790" href="#790">790</a>               needSet[i] = false;
-<a class="jxr_linenumber" name="791" href="#791">791</a>               <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="792" href="#792">792</a>             <strong class="jxr_keyword">case</strong> NODEEXISTS:
-<a class="jxr_linenumber" name="793" href="#793">793</a>               retry = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="794" href="#794">794</a>               <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="795" href="#795">795</a>             <strong class="jxr_keyword">default</strong>:
-<a class="jxr_linenumber" name="796" href="#796">796</a>               <em class="jxr_comment">// if creation fails on error other than NodeExists</em>
-<a class="jxr_linenumber" name="797" href="#797">797</a>               <em class="jxr_comment">// no need to retry set</em>
-<a class="jxr_linenumber" name="798" href="#798">798</a>               needSet[i] = false;
-<a class="jxr_linenumber" name="799" href="#799">799</a>               <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="800" href="#800">800</a>             }
-<a class="jxr_linenumber" name="801" href="#801">801</a>           }
-<a class="jxr_linenumber" name="802" href="#802">802</a>         }
-<a class="jxr_linenumber" name="803" href="#803">803</a>       }
-<a class="jxr_linenumber" name="804" href="#804">804</a>       <strong class="jxr_keyword">while</strong> (retry);
-<a class="jxr_linenumber" name="805" href="#805">805</a> 
-<a class="jxr_linenumber" name="806" href="#806">806</a>       <em class="jxr_comment">// construct return results</em>
-<a class="jxr_linenumber" name="807" href="#807">807</a>       <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; cbList.length; i++)
-<a class="jxr_linenumber" name="808" href="#808">808</a>       {
-<a class="jxr_linenumber" name="809" href="#809">809</a>         <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">SetDataCallbackHandler</a> cb = cbList[i];
-<a class="jxr_linenumber" name="810" href="#810">810</a> 
-<a class="jxr_linenumber" name="811" href="#811">811</a>         Code rc = Code.get(cb.getRc());
-<a class="jxr_linenumber" name="812" href="#812">812</a>         <strong class="jxr_keyword">if</strong> (rc == Code.OK)
-<a class="jxr_linenumber" name="813" href="#813">813</a>         {
-<a class="jxr_linenumber" name="814" href="#814">814</a>           success[i] = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="815" href="#815">815</a>         }
-<a class="jxr_linenumber" name="816" href="#816">816</a>         <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (rc == Code.NONODE)
-<a class="jxr_linenumber" name="817" href="#817">817</a>         {
-<a class="jxr_linenumber" name="818" href="#818">818</a>           <a href="../../../../../org/apache/helix/manager/zk/ZkAsyncCallbacks.html">CreateCallbackHandler</a> createCb = createCbList[i];
-<a class="jxr_linenumber" name="819" href="#819">819</a>           <strong class="jxr_keyword">if</strong> (Code.get(createCb.getRc()) == Code.OK)
-<a class="jxr_linenumber" name="820" href="#820">820</a>           {
-<a class="jxr_linenumber" name="821" href="#821">821</a>             success[i] = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="822" href="#822">822</a>           }
-<a class="jxr_linenumber" name="823" href="#823">823</a>         }
-<a class="jxr_linenumber" name="824" href="#824">824</a>       }
-<a class="jxr_linenumber" name="825" href="#825">825</a> 
-<a class="jxr_linenumber" name="826" href="#826">826</a>       <strong class="jxr_keyword">if</strong> (stats != <strong class="jxr_keyword">null</strong>)
-<a class="jxr_linenumber" name="827" href="#827">827</a>       {
-<a class="jxr_linenumber" name="828" href="#828">828</a>         stats.clear();
-<a class="jxr_linenumber" name="829" href="#829">829</a>         stats.addAll(setStats);
+<a class="jxr_linenumber" name="788" href="#788">788</a>               <strong class="jxr_keyword">continue</strong>;
+<a class="jxr_linenumber" name="789" href="#789">789</a>             }
+<a class="jxr_linenumber" name="790" href="#790">790</a> 
+<a class="jxr_linenumber" name="791" href="#791">791</a>             Code rc = Code.get(createCb.getRc());
+<a class="jxr_linenumber" name="792" href="#792">792</a>             <strong class="jxr_keyword">switch</strong> (rc)
+<a class="jxr_linenumber" name="793" href="#793">793</a>             {
+<a class="jxr_linenumber" name="794" href="#794">794</a>             <strong class="jxr_keyword">case</strong> OK:
+<a class="jxr_linenumber" name="795" href="#795">795</a>               setStats.set(i, ZNode.ZERO_STAT);
+<a class="jxr_linenumber" name="796" href="#796">796</a>               needSet[i] = false;
+<a class="jxr_linenumber" name="797" href="#797">797</a>               <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="798" href="#798">798</a>             <strong class="jxr_keyword">case</strong> NODEEXISTS:
+<a class="jxr_linenumber" name="799" href="#799">799</a>               retry = <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="800" href="#800">800</a>               <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="801" href="#801">801</a>             <strong class="jxr_keyword">default</strong>:
+<a class="jxr_linenumber" name="802" href="#802">802</a>               <em class="jxr_comment">// if creation fails on error other than NodeExists</em>
+<a class="jxr_linenumber" name="803" href="#803">803</a>               <em class="jxr_comment">// no need to retry set</em>
+<a class="jxr_linenumber" name="804" href="#804">804</a>               needSet[i] = false;
+<a class="jxr_linenumber" name="805" href="#805">805</a>               <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="806" href="#806">806</a>             }
+<a class="jxr_linenumber" name="807" href="#807">807</a>           }
+<a class="jxr_linenumber" name="808" href="#808">808</a>         }
+<a class="jxr_linenumber" name="809" href="#809">809</a>       }

[... 884 lines stripped ...]


Mime
View raw message