giraph-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ekoo...@apache.org
Subject svn commit: r1373684 [35/35] - in /giraph/site: ./ apidocs/ apidocs/org/apache/giraph/ apidocs/org/apache/giraph/benchmark/ apidocs/org/apache/giraph/benchmark/class-use/ apidocs/org/apache/giraph/bsp/ apidocs/org/apache/giraph/bsp/class-use/ apidocs/o...
Date Thu, 16 Aug 2012 01:32:58 GMT
Modified: giraph/site/xref/org/apache/giraph/graph/partition/HashWorkerPartitioner.html
URL: http://svn.apache.org/viewvc/giraph/site/xref/org/apache/giraph/graph/partition/HashWorkerPartitioner.html?rev=1373684&r1=1373683&r2=1373684&view=diff
==============================================================================
--- giraph/site/xref/org/apache/giraph/graph/partition/HashWorkerPartitioner.html (original)
+++ giraph/site/xref/org/apache/giraph/graph/partition/HashWorkerPartitioner.html Thu Aug
16 01:32:41 2012
@@ -63,67 +63,73 @@
 <a name="53" href="#53">53</a>  
 <a name="54" href="#54">54</a>    @Override
 <a name="55" href="#55">55</a>    <strong class="jxr_keyword">public</strong>
<a href="../../../../../org/apache/giraph/graph/partition/PartitionOwner.html">PartitionOwner</a>
getPartitionOwner(I vertexId) {
-<a name="56" href="#56">56</a>      <strong class="jxr_keyword">return</strong>
partitionOwnerList.get(Math.abs(vertexId.hashCode()) %
-<a name="57" href="#57">57</a>        partitionOwnerList.size());
-<a name="58" href="#58">58</a>    }
-<a name="59" href="#59">59</a>  
-<a name="60" href="#60">60</a>    @Override
-<a name="61" href="#61">61</a>    <strong class="jxr_keyword">public</strong>
Collection&lt;PartitionStats&gt; finalizePartitionStats(
-<a name="62" href="#62">62</a>        Collection&lt;PartitionStats&gt;
workerPartitionStats,
-<a name="63" href="#63">63</a>        Map&lt;Integer, Partition&lt;I,
V, E, M&gt;&gt; partitionMap) {
-<a name="64" href="#64">64</a>      <em class="jxr_comment">// No modification
necessary</em>
-<a name="65" href="#65">65</a>      <strong class="jxr_keyword">return</strong>
workerPartitionStats;
-<a name="66" href="#66">66</a>    }
-<a name="67" href="#67">67</a>  
-<a name="68" href="#68">68</a>    @Override
-<a name="69" href="#69">69</a>    <strong class="jxr_keyword">public</strong>
<a href="../../../../../org/apache/giraph/graph/partition/PartitionExchange.html">PartitionExchange</a>
updatePartitionOwners(
-<a name="70" href="#70">70</a>        <a href="../../../../../org/apache/giraph/graph/WorkerInfo.html">WorkerInfo</a>
myWorkerInfo,
-<a name="71" href="#71">71</a>        Collection&lt;? <strong class="jxr_keyword">extends</strong>
PartitionOwner&gt; masterSetPartitionOwners,
-<a name="72" href="#72">72</a>        Map&lt;Integer, Partition&lt;I,
V, E, M&gt;&gt; partitionMap) {
-<a name="73" href="#73">73</a>      partitionOwnerList.clear();
-<a name="74" href="#74">74</a>      partitionOwnerList.addAll(masterSetPartitionOwners);
-<a name="75" href="#75">75</a>  
-<a name="76" href="#76">76</a>      Set&lt;WorkerInfo&gt; dependentWorkerSet
= <strong class="jxr_keyword">new</strong> HashSet&lt;WorkerInfo&gt;();
-<a name="77" href="#77">77</a>      Map&lt;WorkerInfo, List&lt;Integer&gt;&gt;
workerPartitionOwnerMap =
-<a name="78" href="#78">78</a>          <strong class="jxr_keyword">new</strong>
HashMap&lt;WorkerInfo, List&lt;Integer&gt;&gt;();
-<a name="79" href="#79">79</a>      <strong class="jxr_keyword">for</strong>
(PartitionOwner partitionOwner : masterSetPartitionOwners) {
-<a name="80" href="#80">80</a>        <strong class="jxr_keyword">if</strong>
(partitionOwner.getPreviousWorkerInfo() == <strong class="jxr_keyword">null</strong>)
{
-<a name="81" href="#81">81</a>          <strong class="jxr_keyword">continue</strong>;
-<a name="82" href="#82">82</a>        } <strong class="jxr_keyword">else</strong>
<strong class="jxr_keyword">if</strong> (partitionOwner.getWorkerInfo().equals(
-<a name="83" href="#83">83</a>            myWorkerInfo) &amp;&amp;
-<a name="84" href="#84">84</a>            partitionOwner.getPreviousWorkerInfo().equals(
-<a name="85" href="#85">85</a>                myWorkerInfo)) {
-<a name="86" href="#86">86</a>          <strong class="jxr_keyword">throw</strong>
<strong class="jxr_keyword">new</strong> IllegalStateException(
-<a name="87" href="#87">87</a>              <span class="jxr_string">"updatePartitionOwners:
Impossible to have the same "</span> +
-<a name="88" href="#88">88</a>                  <span class="jxr_string">"previous
and current worker info "</span> + partitionOwner +
-<a name="89" href="#89">89</a>                  <span class="jxr_string">"
as me "</span> + myWorkerInfo);
-<a name="90" href="#90">90</a>        } <strong class="jxr_keyword">else</strong>
<strong class="jxr_keyword">if</strong> (partitionOwner.getWorkerInfo().equals(myWorkerInfo))
{
-<a name="91" href="#91">91</a>          dependentWorkerSet.add(partitionOwner.getPreviousWorkerInfo());
-<a name="92" href="#92">92</a>        } <strong class="jxr_keyword">else</strong>
<strong class="jxr_keyword">if</strong> (partitionOwner.getPreviousWorkerInfo().equals(
-<a name="93" href="#93">93</a>            myWorkerInfo)) {
-<a name="94" href="#94">94</a>          <strong class="jxr_keyword">if</strong>
(workerPartitionOwnerMap.containsKey(
-<a name="95" href="#95">95</a>              partitionOwner.getWorkerInfo()))
{
-<a name="96" href="#96">96</a>            workerPartitionOwnerMap.get(
-<a name="97" href="#97">97</a>                partitionOwner.getWorkerInfo()).add(
-<a name="98" href="#98">98</a>                    partitionOwner.getPartitionId());
-<a name="99" href="#99">99</a>          } <strong class="jxr_keyword">else</strong>
{
-<a name="100" href="#100">100</a>           List&lt;Integer&gt; tmpPartitionOwnerList
= <strong class="jxr_keyword">new</strong> ArrayList&lt;Integer&gt;();
-<a name="101" href="#101">101</a>           tmpPartitionOwnerList.add(partitionOwner.getPartitionId());
-<a name="102" href="#102">102</a>           workerPartitionOwnerMap.put(partitionOwner.getWorkerInfo(),
-<a name="103" href="#103">103</a>                                       tmpPartitionOwnerList);
-<a name="104" href="#104">104</a>         }
-<a name="105" href="#105">105</a>       }
-<a name="106" href="#106">106</a>     }
-<a name="107" href="#107">107</a> 
-<a name="108" href="#108">108</a>     <strong class="jxr_keyword">return</strong>
<strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/giraph/graph/partition/PartitionExchange.html">PartitionExchange</a>(dependentWorkerSet,
-<a name="109" href="#109">109</a>         workerPartitionOwnerMap);
-<a name="110" href="#110">110</a>   }
+<a name="56" href="#56">56</a>      <strong class="jxr_keyword">synchronized</strong>
(partitionOwnerList) {
+<a name="57" href="#57">57</a>        <strong class="jxr_keyword">return</strong>
partitionOwnerList.get(Math.abs(vertexId.hashCode()) %
+<a name="58" href="#58">58</a>            partitionOwnerList.size());
+<a name="59" href="#59">59</a>      }
+<a name="60" href="#60">60</a>    }
+<a name="61" href="#61">61</a>  
+<a name="62" href="#62">62</a>    @Override
+<a name="63" href="#63">63</a>    <strong class="jxr_keyword">public</strong>
Collection&lt;PartitionStats&gt; finalizePartitionStats(
+<a name="64" href="#64">64</a>        Collection&lt;PartitionStats&gt;
workerPartitionStats,
+<a name="65" href="#65">65</a>        Map&lt;Integer, Partition&lt;I,
V, E, M&gt;&gt; partitionMap) {
+<a name="66" href="#66">66</a>      <em class="jxr_comment">// No modification
necessary</em>
+<a name="67" href="#67">67</a>      <strong class="jxr_keyword">return</strong>
workerPartitionStats;
+<a name="68" href="#68">68</a>    }
+<a name="69" href="#69">69</a>  
+<a name="70" href="#70">70</a>    @Override
+<a name="71" href="#71">71</a>    <strong class="jxr_keyword">public</strong>
<a href="../../../../../org/apache/giraph/graph/partition/PartitionExchange.html">PartitionExchange</a>
updatePartitionOwners(
+<a name="72" href="#72">72</a>        <a href="../../../../../org/apache/giraph/graph/WorkerInfo.html">WorkerInfo</a>
myWorkerInfo,
+<a name="73" href="#73">73</a>        Collection&lt;? <strong class="jxr_keyword">extends</strong>
PartitionOwner&gt; masterSetPartitionOwners,
+<a name="74" href="#74">74</a>        Map&lt;Integer, Partition&lt;I,
V, E, M&gt;&gt; partitionMap) {
+<a name="75" href="#75">75</a>      <strong class="jxr_keyword">synchronized</strong>
(partitionOwnerList) {
+<a name="76" href="#76">76</a>        partitionOwnerList.clear();
+<a name="77" href="#77">77</a>        partitionOwnerList.addAll(masterSetPartitionOwners);
+<a name="78" href="#78">78</a>      }
+<a name="79" href="#79">79</a>  
+<a name="80" href="#80">80</a>      Set&lt;WorkerInfo&gt; dependentWorkerSet
= <strong class="jxr_keyword">new</strong> HashSet&lt;WorkerInfo&gt;();
+<a name="81" href="#81">81</a>      Map&lt;WorkerInfo, List&lt;Integer&gt;&gt;
workerPartitionOwnerMap =
+<a name="82" href="#82">82</a>          <strong class="jxr_keyword">new</strong>
HashMap&lt;WorkerInfo, List&lt;Integer&gt;&gt;();
+<a name="83" href="#83">83</a>      <strong class="jxr_keyword">for</strong>
(PartitionOwner partitionOwner : masterSetPartitionOwners) {
+<a name="84" href="#84">84</a>        <strong class="jxr_keyword">if</strong>
(partitionOwner.getPreviousWorkerInfo() == <strong class="jxr_keyword">null</strong>)
{
+<a name="85" href="#85">85</a>          <strong class="jxr_keyword">continue</strong>;
+<a name="86" href="#86">86</a>        } <strong class="jxr_keyword">else</strong>
<strong class="jxr_keyword">if</strong> (partitionOwner.getWorkerInfo().equals(
+<a name="87" href="#87">87</a>            myWorkerInfo) &amp;&amp;
+<a name="88" href="#88">88</a>            partitionOwner.getPreviousWorkerInfo().equals(
+<a name="89" href="#89">89</a>                myWorkerInfo)) {
+<a name="90" href="#90">90</a>          <strong class="jxr_keyword">throw</strong>
<strong class="jxr_keyword">new</strong> IllegalStateException(
+<a name="91" href="#91">91</a>              <span class="jxr_string">"updatePartitionOwners:
Impossible to have the same "</span> +
+<a name="92" href="#92">92</a>                  <span class="jxr_string">"previous
and current worker info "</span> + partitionOwner +
+<a name="93" href="#93">93</a>                  <span class="jxr_string">"
as me "</span> + myWorkerInfo);
+<a name="94" href="#94">94</a>        } <strong class="jxr_keyword">else</strong>
<strong class="jxr_keyword">if</strong> (partitionOwner.getWorkerInfo().equals(myWorkerInfo))
{
+<a name="95" href="#95">95</a>          dependentWorkerSet.add(partitionOwner.getPreviousWorkerInfo());
+<a name="96" href="#96">96</a>        } <strong class="jxr_keyword">else</strong>
<strong class="jxr_keyword">if</strong> (partitionOwner.getPreviousWorkerInfo().equals(
+<a name="97" href="#97">97</a>            myWorkerInfo)) {
+<a name="98" href="#98">98</a>          <strong class="jxr_keyword">if</strong>
(workerPartitionOwnerMap.containsKey(
+<a name="99" href="#99">99</a>              partitionOwner.getWorkerInfo()))
{
+<a name="100" href="#100">100</a>           workerPartitionOwnerMap.get(
+<a name="101" href="#101">101</a>               partitionOwner.getWorkerInfo()).add(
+<a name="102" href="#102">102</a>                   partitionOwner.getPartitionId());
+<a name="103" href="#103">103</a>         } <strong class="jxr_keyword">else</strong>
{
+<a name="104" href="#104">104</a>           List&lt;Integer&gt; tmpPartitionOwnerList
= <strong class="jxr_keyword">new</strong> ArrayList&lt;Integer&gt;();
+<a name="105" href="#105">105</a>           tmpPartitionOwnerList.add(partitionOwner.getPartitionId());
+<a name="106" href="#106">106</a>           workerPartitionOwnerMap.put(partitionOwner.getWorkerInfo(),
+<a name="107" href="#107">107</a>                                       tmpPartitionOwnerList);
+<a name="108" href="#108">108</a>         }
+<a name="109" href="#109">109</a>       }
+<a name="110" href="#110">110</a>     }
 <a name="111" href="#111">111</a> 
-<a name="112" href="#112">112</a>   @Override
-<a name="113" href="#113">113</a>   <strong class="jxr_keyword">public</strong>
Collection&lt;? <strong class="jxr_keyword">extends</strong> PartitionOwner&gt;
getPartitionOwners() {
-<a name="114" href="#114">114</a>     <strong class="jxr_keyword">return</strong>
partitionOwnerList;
-<a name="115" href="#115">115</a>   }
-<a name="116" href="#116">116</a> }
+<a name="112" href="#112">112</a>     <strong class="jxr_keyword">return</strong>
<strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/giraph/graph/partition/PartitionExchange.html">PartitionExchange</a>(dependentWorkerSet,
+<a name="113" href="#113">113</a>         workerPartitionOwnerMap);
+<a name="114" href="#114">114</a>   }
+<a name="115" href="#115">115</a> 
+<a name="116" href="#116">116</a>   @Override
+<a name="117" href="#117">117</a>   <strong class="jxr_keyword">public</strong>
Collection&lt;? <strong class="jxr_keyword">extends</strong> PartitionOwner&gt;
getPartitionOwners() {
+<a name="118" href="#118">118</a>     <strong class="jxr_keyword">synchronized</strong>
(partitionOwnerList) {
+<a name="119" href="#119">119</a>       <strong class="jxr_keyword">return</strong>
partitionOwnerList;
+<a name="120" href="#120">120</a>     }
+<a name="121" href="#121">121</a>   }
+<a name="122" href="#122">122</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