1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
---|
2 | <!--NewPage--> |
---|
3 | <HTML> |
---|
4 | <HEAD> |
---|
5 | <!-- Generated by javadoc (build 1.6.0_07) on Tue Sep 01 20:56:54 UTC 2009 --> |
---|
6 | <TITLE> |
---|
7 | NetworkTopology (Hadoop 0.20.1 API) |
---|
8 | </TITLE> |
---|
9 | |
---|
10 | <META NAME="date" CONTENT="2009-09-01"> |
---|
11 | |
---|
12 | <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> |
---|
13 | |
---|
14 | <SCRIPT type="text/javascript"> |
---|
15 | function windowTitle() |
---|
16 | { |
---|
17 | if (location.href.indexOf('is-external=true') == -1) { |
---|
18 | parent.document.title="NetworkTopology (Hadoop 0.20.1 API)"; |
---|
19 | } |
---|
20 | } |
---|
21 | </SCRIPT> |
---|
22 | <NOSCRIPT> |
---|
23 | </NOSCRIPT> |
---|
24 | |
---|
25 | </HEAD> |
---|
26 | |
---|
27 | <BODY BGCOLOR="white" onload="windowTitle();"> |
---|
28 | <HR> |
---|
29 | |
---|
30 | |
---|
31 | <!-- ========= START OF TOP NAVBAR ======= --> |
---|
32 | <A NAME="navbar_top"><!-- --></A> |
---|
33 | <A HREF="#skip-navbar_top" title="Skip navigation links"></A> |
---|
34 | <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
---|
35 | <TR> |
---|
36 | <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
---|
37 | <A NAME="navbar_top_firstrow"><!-- --></A> |
---|
38 | <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
---|
39 | <TR ALIGN="center" VALIGN="top"> |
---|
40 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
---|
41 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
---|
42 | <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
---|
43 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/NetworkTopology.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
---|
44 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
---|
45 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
---|
46 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
---|
47 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
---|
48 | </TR> |
---|
49 | </TABLE> |
---|
50 | </TD> |
---|
51 | <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
---|
52 | </EM> |
---|
53 | </TD> |
---|
54 | </TR> |
---|
55 | |
---|
56 | <TR> |
---|
57 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
---|
58 | <A HREF="../../../../org/apache/hadoop/net/NetUtils.html" title="class in org.apache.hadoop.net"><B>PREV CLASS</B></A> |
---|
59 | <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net"><B>NEXT CLASS</B></A></FONT></TD> |
---|
60 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
---|
61 | <A HREF="../../../../index.html?org/apache/hadoop/net/NetworkTopology.html" target="_top"><B>FRAMES</B></A> |
---|
62 | <A HREF="NetworkTopology.html" target="_top"><B>NO FRAMES</B></A> |
---|
63 | <SCRIPT type="text/javascript"> |
---|
64 | <!-- |
---|
65 | if(window==top) { |
---|
66 | document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
---|
67 | } |
---|
68 | //--> |
---|
69 | </SCRIPT> |
---|
70 | <NOSCRIPT> |
---|
71 | <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> |
---|
72 | </NOSCRIPT> |
---|
73 | |
---|
74 | |
---|
75 | </FONT></TD> |
---|
76 | </TR> |
---|
77 | <TR> |
---|
78 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
---|
79 | SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> |
---|
80 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
---|
81 | DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> |
---|
82 | </TR> |
---|
83 | </TABLE> |
---|
84 | <A NAME="skip-navbar_top"></A> |
---|
85 | <!-- ========= END OF TOP NAVBAR ========= --> |
---|
86 | |
---|
87 | <HR> |
---|
88 | <!-- ======== START OF CLASS DATA ======== --> |
---|
89 | <H2> |
---|
90 | <FONT SIZE="-1"> |
---|
91 | org.apache.hadoop.net</FONT> |
---|
92 | <BR> |
---|
93 | Class NetworkTopology</H2> |
---|
94 | <PRE> |
---|
95 | <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> |
---|
96 | <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.hadoop.net.NetworkTopology</B> |
---|
97 | </PRE> |
---|
98 | <HR> |
---|
99 | <DL> |
---|
100 | <DT><PRE>public class <B>NetworkTopology</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL> |
---|
101 | </PRE> |
---|
102 | |
---|
103 | <P> |
---|
104 | The class represents a cluster of computer with a tree hierarchical |
---|
105 | network topology. |
---|
106 | For example, a cluster may be consists of many data centers filled |
---|
107 | with racks of computers. |
---|
108 | In a network topology, leaves represent data nodes (computers) and inner |
---|
109 | nodes represent switches/routers that manage traffic in/out of data centers |
---|
110 | or racks. |
---|
111 | <P> |
---|
112 | |
---|
113 | <P> |
---|
114 | <HR> |
---|
115 | |
---|
116 | <P> |
---|
117 | <!-- =========== FIELD SUMMARY =========== --> |
---|
118 | |
---|
119 | <A NAME="field_summary"><!-- --></A> |
---|
120 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
121 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
122 | <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
---|
123 | <B>Field Summary</B></FONT></TH> |
---|
124 | </TR> |
---|
125 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
126 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
127 | <CODE>static int</CODE></FONT></TD> |
---|
128 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#DEFAULT_HOST_LEVEL">DEFAULT_HOST_LEVEL</A></B></CODE> |
---|
129 | |
---|
130 | <BR> |
---|
131 | </TD> |
---|
132 | </TR> |
---|
133 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
134 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
135 | <CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> |
---|
136 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#DEFAULT_RACK">DEFAULT_RACK</A></B></CODE> |
---|
137 | |
---|
138 | <BR> |
---|
139 | </TD> |
---|
140 | </TR> |
---|
141 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
142 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
143 | <CODE>static org.apache.commons.logging.Log</CODE></FONT></TD> |
---|
144 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#LOG">LOG</A></B></CODE> |
---|
145 | |
---|
146 | <BR> |
---|
147 | </TD> |
---|
148 | </TR> |
---|
149 | </TABLE> |
---|
150 | |
---|
151 | <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
---|
152 | |
---|
153 | <A NAME="constructor_summary"><!-- --></A> |
---|
154 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
155 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
156 | <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
---|
157 | <B>Constructor Summary</B></FONT></TH> |
---|
158 | </TR> |
---|
159 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
160 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#NetworkTopology()">NetworkTopology</A></B>()</CODE> |
---|
161 | |
---|
162 | <BR> |
---|
163 | </TD> |
---|
164 | </TR> |
---|
165 | </TABLE> |
---|
166 | |
---|
167 | <!-- ========== METHOD SUMMARY =========== --> |
---|
168 | |
---|
169 | <A NAME="method_summary"><!-- --></A> |
---|
170 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
171 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
172 | <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
---|
173 | <B>Method Summary</B></FONT></TH> |
---|
174 | </TR> |
---|
175 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
176 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
177 | <CODE> void</CODE></FONT></TD> |
---|
178 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#add(org.apache.hadoop.net.Node)">add</A></B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node)</CODE> |
---|
179 | |
---|
180 | <BR> |
---|
181 | Add a leaf node |
---|
182 | Update node counter & rack counter if neccessary</TD> |
---|
183 | </TR> |
---|
184 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
185 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
186 | <CODE> <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A></CODE></FONT></TD> |
---|
187 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#chooseRandom(java.lang.String)">chooseRandom</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> scope)</CODE> |
---|
188 | |
---|
189 | <BR> |
---|
190 | randomly choose one node from <i>scope</i> |
---|
191 | if scope starts with ~, choose one from the all nodes except for the |
---|
192 | ones in <i>scope</i>; otherwise, choose one from <i>scope</i></TD> |
---|
193 | </TR> |
---|
194 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
195 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
196 | <CODE> boolean</CODE></FONT></TD> |
---|
197 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#contains(org.apache.hadoop.net.Node)">contains</A></B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node)</CODE> |
---|
198 | |
---|
199 | <BR> |
---|
200 | Check if the tree contains node <i>node</i></TD> |
---|
201 | </TR> |
---|
202 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
203 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
204 | <CODE> int</CODE></FONT></TD> |
---|
205 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#countNumOfAvailableNodes(java.lang.String, java.util.List)">countNumOfAvailableNodes</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> scope, |
---|
206 | <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A><<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A>> excludedNodes)</CODE> |
---|
207 | |
---|
208 | <BR> |
---|
209 | return the number of leaves in <i>scope</i> but not in <i>excludedNodes</i> |
---|
210 | if scope starts with ~, return the number of nodes that are not |
---|
211 | in <i>scope</i> and <i>excludedNodes</i>;</TD> |
---|
212 | </TR> |
---|
213 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
214 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
215 | <CODE> int</CODE></FONT></TD> |
---|
216 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#getDistance(org.apache.hadoop.net.Node, org.apache.hadoop.net.Node)">getDistance</A></B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node1, |
---|
217 | <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node2)</CODE> |
---|
218 | |
---|
219 | <BR> |
---|
220 | Return the distance between two nodes |
---|
221 | It is assumed that the distance from one node to its parent is 1 |
---|
222 | The distance between two nodes is calculated by summing up their distances |
---|
223 | to their closest common ancestor.</TD> |
---|
224 | </TR> |
---|
225 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
226 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
227 | <CODE> <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A></CODE></FONT></TD> |
---|
228 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#getNode(java.lang.String)">getNode</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> loc)</CODE> |
---|
229 | |
---|
230 | <BR> |
---|
231 | Given a string representation of a node, return its reference</TD> |
---|
232 | </TR> |
---|
233 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
234 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
235 | <CODE> int</CODE></FONT></TD> |
---|
236 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#getNumOfLeaves()">getNumOfLeaves</A></B>()</CODE> |
---|
237 | |
---|
238 | <BR> |
---|
239 | Return the total number of nodes</TD> |
---|
240 | </TR> |
---|
241 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
242 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
243 | <CODE> int</CODE></FONT></TD> |
---|
244 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#getNumOfRacks()">getNumOfRacks</A></B>()</CODE> |
---|
245 | |
---|
246 | <BR> |
---|
247 | Return the total number of racks</TD> |
---|
248 | </TR> |
---|
249 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
250 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
251 | <CODE> boolean</CODE></FONT></TD> |
---|
252 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#isOnSameRack(org.apache.hadoop.net.Node, org.apache.hadoop.net.Node)">isOnSameRack</A></B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node1, |
---|
253 | <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node2)</CODE> |
---|
254 | |
---|
255 | <BR> |
---|
256 | Check if two nodes are on the same rack</TD> |
---|
257 | </TR> |
---|
258 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
259 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
260 | <CODE> void</CODE></FONT></TD> |
---|
261 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#pseudoSortByDistance(org.apache.hadoop.net.Node, org.apache.hadoop.net.Node[])">pseudoSortByDistance</A></B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> reader, |
---|
262 | <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A>[] nodes)</CODE> |
---|
263 | |
---|
264 | <BR> |
---|
265 | Sort nodes array by their distances to <i>reader</i> |
---|
266 | It linearly scans the array, if a local node is found, swap it with |
---|
267 | the first element of the array.</TD> |
---|
268 | </TR> |
---|
269 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
270 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
271 | <CODE> void</CODE></FONT></TD> |
---|
272 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#remove(org.apache.hadoop.net.Node)">remove</A></B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node)</CODE> |
---|
273 | |
---|
274 | <BR> |
---|
275 | Remove a node |
---|
276 | Update node counter & rack counter if neccessary</TD> |
---|
277 | </TR> |
---|
278 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
279 | <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
---|
280 | <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> |
---|
281 | <TD><CODE><B><A HREF="../../../../org/apache/hadoop/net/NetworkTopology.html#toString()">toString</A></B>()</CODE> |
---|
282 | |
---|
283 | <BR> |
---|
284 | convert a network tree to a string</TD> |
---|
285 | </TR> |
---|
286 | </TABLE> |
---|
287 | <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> |
---|
288 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
289 | <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> |
---|
290 | <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> |
---|
291 | </TR> |
---|
292 | <TR BGCOLOR="white" CLASS="TableRowColor"> |
---|
293 | <TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> |
---|
294 | </TR> |
---|
295 | </TABLE> |
---|
296 | |
---|
297 | <P> |
---|
298 | |
---|
299 | <!-- ============ FIELD DETAIL =========== --> |
---|
300 | |
---|
301 | <A NAME="field_detail"><!-- --></A> |
---|
302 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
303 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
304 | <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
---|
305 | <B>Field Detail</B></FONT></TH> |
---|
306 | </TR> |
---|
307 | </TABLE> |
---|
308 | |
---|
309 | <A NAME="DEFAULT_RACK"><!-- --></A><H3> |
---|
310 | DEFAULT_RACK</H3> |
---|
311 | <PRE> |
---|
312 | public static final <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>DEFAULT_RACK</B></PRE> |
---|
313 | <DL> |
---|
314 | <DL> |
---|
315 | <DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#org.apache.hadoop.net.NetworkTopology.DEFAULT_RACK">Constant Field Values</A></DL> |
---|
316 | </DL> |
---|
317 | <HR> |
---|
318 | |
---|
319 | <A NAME="DEFAULT_HOST_LEVEL"><!-- --></A><H3> |
---|
320 | DEFAULT_HOST_LEVEL</H3> |
---|
321 | <PRE> |
---|
322 | public static final int <B>DEFAULT_HOST_LEVEL</B></PRE> |
---|
323 | <DL> |
---|
324 | <DL> |
---|
325 | <DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#org.apache.hadoop.net.NetworkTopology.DEFAULT_HOST_LEVEL">Constant Field Values</A></DL> |
---|
326 | </DL> |
---|
327 | <HR> |
---|
328 | |
---|
329 | <A NAME="LOG"><!-- --></A><H3> |
---|
330 | LOG</H3> |
---|
331 | <PRE> |
---|
332 | public static final org.apache.commons.logging.Log <B>LOG</B></PRE> |
---|
333 | <DL> |
---|
334 | <DL> |
---|
335 | </DL> |
---|
336 | </DL> |
---|
337 | |
---|
338 | <!-- ========= CONSTRUCTOR DETAIL ======== --> |
---|
339 | |
---|
340 | <A NAME="constructor_detail"><!-- --></A> |
---|
341 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
342 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
343 | <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
---|
344 | <B>Constructor Detail</B></FONT></TH> |
---|
345 | </TR> |
---|
346 | </TABLE> |
---|
347 | |
---|
348 | <A NAME="NetworkTopology()"><!-- --></A><H3> |
---|
349 | NetworkTopology</H3> |
---|
350 | <PRE> |
---|
351 | public <B>NetworkTopology</B>()</PRE> |
---|
352 | <DL> |
---|
353 | </DL> |
---|
354 | |
---|
355 | <!-- ============ METHOD DETAIL ========== --> |
---|
356 | |
---|
357 | <A NAME="method_detail"><!-- --></A> |
---|
358 | <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
---|
359 | <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
---|
360 | <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
---|
361 | <B>Method Detail</B></FONT></TH> |
---|
362 | </TR> |
---|
363 | </TABLE> |
---|
364 | |
---|
365 | <A NAME="add(org.apache.hadoop.net.Node)"><!-- --></A><H3> |
---|
366 | add</H3> |
---|
367 | <PRE> |
---|
368 | public void <B>add</B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node)</PRE> |
---|
369 | <DL> |
---|
370 | <DD>Add a leaf node |
---|
371 | Update node counter & rack counter if neccessary |
---|
372 | <P> |
---|
373 | <DD><DL> |
---|
374 | <DT><B>Parameters:</B><DD><CODE>node</CODE> - node to be added |
---|
375 | <DT><B>Throws:</B> |
---|
376 | <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if add a node to a leave |
---|
377 | or node to be added is not a leaf</DL> |
---|
378 | </DD> |
---|
379 | </DL> |
---|
380 | <HR> |
---|
381 | |
---|
382 | <A NAME="remove(org.apache.hadoop.net.Node)"><!-- --></A><H3> |
---|
383 | remove</H3> |
---|
384 | <PRE> |
---|
385 | public void <B>remove</B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node)</PRE> |
---|
386 | <DL> |
---|
387 | <DD>Remove a node |
---|
388 | Update node counter & rack counter if neccessary |
---|
389 | <P> |
---|
390 | <DD><DL> |
---|
391 | <DT><B>Parameters:</B><DD><CODE>node</CODE> - node to be removed</DL> |
---|
392 | </DD> |
---|
393 | </DL> |
---|
394 | <HR> |
---|
395 | |
---|
396 | <A NAME="contains(org.apache.hadoop.net.Node)"><!-- --></A><H3> |
---|
397 | contains</H3> |
---|
398 | <PRE> |
---|
399 | public boolean <B>contains</B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node)</PRE> |
---|
400 | <DL> |
---|
401 | <DD>Check if the tree contains node <i>node</i> |
---|
402 | <P> |
---|
403 | <DD><DL> |
---|
404 | <DT><B>Parameters:</B><DD><CODE>node</CODE> - a node |
---|
405 | <DT><B>Returns:</B><DD>true if <i>node</i> is already in the tree; false otherwise</DL> |
---|
406 | </DD> |
---|
407 | </DL> |
---|
408 | <HR> |
---|
409 | |
---|
410 | <A NAME="getNode(java.lang.String)"><!-- --></A><H3> |
---|
411 | getNode</H3> |
---|
412 | <PRE> |
---|
413 | public <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> <B>getNode</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> loc)</PRE> |
---|
414 | <DL> |
---|
415 | <DD>Given a string representation of a node, return its reference |
---|
416 | <P> |
---|
417 | <DD><DL> |
---|
418 | <DT><B>Parameters:</B><DD><CODE>loc</CODE> - a path-like string representation of a node |
---|
419 | <DT><B>Returns:</B><DD>a reference to the node; null if the node is not in the tree</DL> |
---|
420 | </DD> |
---|
421 | </DL> |
---|
422 | <HR> |
---|
423 | |
---|
424 | <A NAME="getNumOfRacks()"><!-- --></A><H3> |
---|
425 | getNumOfRacks</H3> |
---|
426 | <PRE> |
---|
427 | public int <B>getNumOfRacks</B>()</PRE> |
---|
428 | <DL> |
---|
429 | <DD>Return the total number of racks |
---|
430 | <P> |
---|
431 | <DD><DL> |
---|
432 | </DL> |
---|
433 | </DD> |
---|
434 | </DL> |
---|
435 | <HR> |
---|
436 | |
---|
437 | <A NAME="getNumOfLeaves()"><!-- --></A><H3> |
---|
438 | getNumOfLeaves</H3> |
---|
439 | <PRE> |
---|
440 | public int <B>getNumOfLeaves</B>()</PRE> |
---|
441 | <DL> |
---|
442 | <DD>Return the total number of nodes |
---|
443 | <P> |
---|
444 | <DD><DL> |
---|
445 | </DL> |
---|
446 | </DD> |
---|
447 | </DL> |
---|
448 | <HR> |
---|
449 | |
---|
450 | <A NAME="getDistance(org.apache.hadoop.net.Node, org.apache.hadoop.net.Node)"><!-- --></A><H3> |
---|
451 | getDistance</H3> |
---|
452 | <PRE> |
---|
453 | public int <B>getDistance</B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node1, |
---|
454 | <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node2)</PRE> |
---|
455 | <DL> |
---|
456 | <DD>Return the distance between two nodes |
---|
457 | It is assumed that the distance from one node to its parent is 1 |
---|
458 | The distance between two nodes is calculated by summing up their distances |
---|
459 | to their closest common ancestor. |
---|
460 | <P> |
---|
461 | <DD><DL> |
---|
462 | <DT><B>Parameters:</B><DD><CODE>node1</CODE> - one node<DD><CODE>node2</CODE> - another node |
---|
463 | <DT><B>Returns:</B><DD>the distance between node1 and node2 |
---|
464 | node1 or node2 do not belong to the cluster</DL> |
---|
465 | </DD> |
---|
466 | </DL> |
---|
467 | <HR> |
---|
468 | |
---|
469 | <A NAME="isOnSameRack(org.apache.hadoop.net.Node, org.apache.hadoop.net.Node)"><!-- --></A><H3> |
---|
470 | isOnSameRack</H3> |
---|
471 | <PRE> |
---|
472 | public boolean <B>isOnSameRack</B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node1, |
---|
473 | <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> node2)</PRE> |
---|
474 | <DL> |
---|
475 | <DD>Check if two nodes are on the same rack |
---|
476 | <P> |
---|
477 | <DD><DL> |
---|
478 | <DT><B>Parameters:</B><DD><CODE>node1</CODE> - one node<DD><CODE>node2</CODE> - another node |
---|
479 | <DT><B>Returns:</B><DD>true if node1 and node2 are pm the same rack; false otherwise |
---|
480 | <DT><B>Throws:</B> |
---|
481 | <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - when either node1 or node2 is null, or |
---|
482 | node1 or node2 do not belong to the cluster</DL> |
---|
483 | </DD> |
---|
484 | </DL> |
---|
485 | <HR> |
---|
486 | |
---|
487 | <A NAME="chooseRandom(java.lang.String)"><!-- --></A><H3> |
---|
488 | chooseRandom</H3> |
---|
489 | <PRE> |
---|
490 | public <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> <B>chooseRandom</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> scope)</PRE> |
---|
491 | <DL> |
---|
492 | <DD>randomly choose one node from <i>scope</i> |
---|
493 | if scope starts with ~, choose one from the all nodes except for the |
---|
494 | ones in <i>scope</i>; otherwise, choose one from <i>scope</i> |
---|
495 | <P> |
---|
496 | <DD><DL> |
---|
497 | <DT><B>Parameters:</B><DD><CODE>scope</CODE> - range of nodes from which a node will be choosen |
---|
498 | <DT><B>Returns:</B><DD>the choosen node</DL> |
---|
499 | </DD> |
---|
500 | </DL> |
---|
501 | <HR> |
---|
502 | |
---|
503 | <A NAME="countNumOfAvailableNodes(java.lang.String, java.util.List)"><!-- --></A><H3> |
---|
504 | countNumOfAvailableNodes</H3> |
---|
505 | <PRE> |
---|
506 | public int <B>countNumOfAvailableNodes</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> scope, |
---|
507 | <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A><<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A>> excludedNodes)</PRE> |
---|
508 | <DL> |
---|
509 | <DD>return the number of leaves in <i>scope</i> but not in <i>excludedNodes</i> |
---|
510 | if scope starts with ~, return the number of nodes that are not |
---|
511 | in <i>scope</i> and <i>excludedNodes</i>; |
---|
512 | <P> |
---|
513 | <DD><DL> |
---|
514 | <DT><B>Parameters:</B><DD><CODE>scope</CODE> - a path string that may start with ~<DD><CODE>excludedNodes</CODE> - a list of nodes |
---|
515 | <DT><B>Returns:</B><DD>number of available nodes</DL> |
---|
516 | </DD> |
---|
517 | </DL> |
---|
518 | <HR> |
---|
519 | |
---|
520 | <A NAME="toString()"><!-- --></A><H3> |
---|
521 | toString</H3> |
---|
522 | <PRE> |
---|
523 | public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>toString</B>()</PRE> |
---|
524 | <DL> |
---|
525 | <DD>convert a network tree to a string |
---|
526 | <P> |
---|
527 | <DD><DL> |
---|
528 | <DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A></CODE> in class <CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></DL> |
---|
529 | </DD> |
---|
530 | <DD><DL> |
---|
531 | </DL> |
---|
532 | </DD> |
---|
533 | </DL> |
---|
534 | <HR> |
---|
535 | |
---|
536 | <A NAME="pseudoSortByDistance(org.apache.hadoop.net.Node, org.apache.hadoop.net.Node[])"><!-- --></A><H3> |
---|
537 | pseudoSortByDistance</H3> |
---|
538 | <PRE> |
---|
539 | public void <B>pseudoSortByDistance</B>(<A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A> reader, |
---|
540 | <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net">Node</A>[] nodes)</PRE> |
---|
541 | <DL> |
---|
542 | <DD>Sort nodes array by their distances to <i>reader</i> |
---|
543 | It linearly scans the array, if a local node is found, swap it with |
---|
544 | the first element of the array. |
---|
545 | If a local rack node is found, swap it with the first element following |
---|
546 | the local node. |
---|
547 | If neither local node or local rack node is found, put a random replica |
---|
548 | location at postion 0. |
---|
549 | It leaves the rest nodes untouched. |
---|
550 | <P> |
---|
551 | <DD><DL> |
---|
552 | </DL> |
---|
553 | </DD> |
---|
554 | </DL> |
---|
555 | <!-- ========= END OF CLASS DATA ========= --> |
---|
556 | <HR> |
---|
557 | |
---|
558 | |
---|
559 | <!-- ======= START OF BOTTOM NAVBAR ====== --> |
---|
560 | <A NAME="navbar_bottom"><!-- --></A> |
---|
561 | <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> |
---|
562 | <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
---|
563 | <TR> |
---|
564 | <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
---|
565 | <A NAME="navbar_bottom_firstrow"><!-- --></A> |
---|
566 | <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
---|
567 | <TR ALIGN="center" VALIGN="top"> |
---|
568 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
---|
569 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
---|
570 | <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
---|
571 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/NetworkTopology.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
---|
572 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
---|
573 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
---|
574 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
---|
575 | <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
---|
576 | </TR> |
---|
577 | </TABLE> |
---|
578 | </TD> |
---|
579 | <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
---|
580 | </EM> |
---|
581 | </TD> |
---|
582 | </TR> |
---|
583 | |
---|
584 | <TR> |
---|
585 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
---|
586 | <A HREF="../../../../org/apache/hadoop/net/NetUtils.html" title="class in org.apache.hadoop.net"><B>PREV CLASS</B></A> |
---|
587 | <A HREF="../../../../org/apache/hadoop/net/Node.html" title="interface in org.apache.hadoop.net"><B>NEXT CLASS</B></A></FONT></TD> |
---|
588 | <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
---|
589 | <A HREF="../../../../index.html?org/apache/hadoop/net/NetworkTopology.html" target="_top"><B>FRAMES</B></A> |
---|
590 | <A HREF="NetworkTopology.html" target="_top"><B>NO FRAMES</B></A> |
---|
591 | <SCRIPT type="text/javascript"> |
---|
592 | <!-- |
---|
593 | if(window==top) { |
---|
594 | document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
---|
595 | } |
---|
596 | //--> |
---|
597 | </SCRIPT> |
---|
598 | <NOSCRIPT> |
---|
599 | <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> |
---|
600 | </NOSCRIPT> |
---|
601 | |
---|
602 | |
---|
603 | </FONT></TD> |
---|
604 | </TR> |
---|
605 | <TR> |
---|
606 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
---|
607 | SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> |
---|
608 | <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
---|
609 | DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> |
---|
610 | </TR> |
---|
611 | </TABLE> |
---|
612 | <A NAME="skip-navbar_bottom"></A> |
---|
613 | <!-- ======== END OF BOTTOM NAVBAR ======= --> |
---|
614 | |
---|
615 | <HR> |
---|
616 | Copyright © 2009 The Apache Software Foundation |
---|
617 | </BODY> |
---|
618 | </HTML> |
---|