337 lines
15 KiB
HTML
337 lines
15 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!-- NewPage -->
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Generated by javadoc (version 1.7.0_51) on Wed Apr 06 13:11:06 EDT 2016 -->
|
|
<title>Reducer (Parallel Java 2 Library Documentation)</title>
|
|
<meta name="date" content="2016-04-06">
|
|
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="Reducer (Parallel Java 2 Library Documentation)";
|
|
}
|
|
//-->
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a name="navbar_top">
|
|
<!-- -->
|
|
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/Reducer.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-files/index-1.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../edu/rit/pjmr/PjmrJob.html" title="class in edu.rit.pjmr"><span class="strong">Prev Class</span></a></li>
|
|
<li><a href="../../../edu/rit/pjmr/ReducerConfig.html" title="class in edu.rit.pjmr"><span class="strong">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?edu/rit/pjmr/Reducer.html" target="_top">Frames</a></li>
|
|
<li><a href="Reducer.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_top">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
|
<li><a href="#method_summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_detail">Constr</a> | </li>
|
|
<li><a href="#method_detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip-navbar_top">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<div class="header">
|
|
<div class="subTitle">edu.rit.pjmr</div>
|
|
<h2 title="Class Reducer" class="title">Class Reducer<K,V extends <a href="../../../edu/rit/pj2/Vbl.html" title="interface in edu.rit.pj2">Vbl</a>></h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>edu.rit.pjmr.Reducer<K,V></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>K</code> - Output key data type.</dd><dd><code>V</code> - Output value data type; must implement interface <a href="../../../edu/rit/pj2/Vbl.html" title="interface in edu.rit.pj2">Vbl</a>.</dd></dl>
|
|
<hr>
|
|
<br>
|
|
<pre>public abstract class <span class="strong">Reducer<K,V extends <a href="../../../edu/rit/pj2/Vbl.html" title="interface in edu.rit.pj2">Vbl</a>></span>
|
|
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
|
|
<div class="block">Class Reducer is the abstract base class for a reducer in the Parallel Java
|
|
Map Reduce Framework. See class <a href="../../../edu/rit/pjmr/PjmrJob.html" title="class in edu.rit.pjmr">PjmrJob</a> for further information
|
|
about configuring reducers as part of a PJMR job.
|
|
<P>
|
|
A <a href="../../../edu/rit/pjmr/ReducerTask.html" title="class in edu.rit.pjmr">ReducerTask</a> calls a reducer's methods as follows:
|
|
<OL TYPE=1>
|
|
<P><LI>
|
|
The reducer task calls the reducer's <a href="../../../edu/rit/pjmr/Reducer.html#start(java.lang.String[])"><code>start()</code></a> method.
|
|
The arguments are the reducer's argument strings if any. The <TT>start()</TT>
|
|
method may initialize the reducer based on the argument strings.
|
|
<P><LI>
|
|
The reducer task repeatedly calls the reducer's <a href="../../../edu/rit/pjmr/Reducer.html#reduce(K, V)"><code>reduce()</code></a> method. The arguments are a (key, value) pair from a <a href="../../../edu/rit/pjmr/Combiner.html" title="class in edu.rit.pjmr">Combiner</a>. The combiner holds the combined contents of all the mappers'
|
|
combiners in the PJMR job. The <TT>reduce()</TT> method may do whatever it
|
|
likes with the (key, value) pair, such as doing computations on the pair,
|
|
printing the pair, or storing the pair in a file. The <TT>reduce()</TT>
|
|
method may alter the state of the value (but not the key).
|
|
<P><LI>
|
|
When all pairs have been processed, the reducer task calls the reducer's
|
|
<a href="../../../edu/rit/pjmr/Reducer.html#finish()"><code>finish()</code></a> method. The <TT>finish()</TT> method may do
|
|
postprocessing operations.
|
|
</OL>
|
|
<P>
|
|
If a reducer task has more than one reducer, the reducers are run in parallel
|
|
in separate threads. There is one global combiner, and the reducers share the
|
|
work of processing the pairs in the combiner.</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="summary">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor_summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Summary</h3>
|
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
|
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colOne" scope="col">Constructor and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><strong><a href="../../../edu/rit/pjmr/Reducer.html#Reducer()">Reducer</a></strong>()</code>
|
|
<div class="block">Construct a new reducer.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method_summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Summary</h3>
|
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
|
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Method and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/pjmr/Reducer.html#finish()">finish</a></strong>()</code>
|
|
<div class="block">Finish this reducer.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>abstract void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/pjmr/Reducer.html#reduce(K, V)">reduce</a></strong>(<a href="../../../edu/rit/pjmr/Reducer.html" title="type parameter in Reducer">K</a> key,
|
|
<a href="../../../edu/rit/pjmr/Reducer.html" title="type parameter in Reducer">V</a> value)</code>
|
|
<div class="block">Reduce the given (key, value) pair.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../edu/rit/pjmr/Reducer.html#start(java.lang.String[])">start</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] args)</code>
|
|
<div class="block">Start this reducer.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
|
|
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/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://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="details">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor_detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Detail</h3>
|
|
<a name="Reducer()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>Reducer</h4>
|
|
<pre>public Reducer()</pre>
|
|
<div class="block">Construct a new reducer.</div>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method_detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Detail</h3>
|
|
<a name="start(java.lang.String[])">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>start</h4>
|
|
<pre>public void start(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] args)</pre>
|
|
<div class="block">Start this reducer.
|
|
<P>
|
|
The base class <TT>start()</TT> method does nothing. A subclass may
|
|
override the <TT>start()</TT> method to do something.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>args</code> - Array of zero or more argument strings.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="reduce(java.lang.Object,edu.rit.pj2.Vbl)">
|
|
<!-- -->
|
|
</a><a name="reduce(K, V)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>reduce</h4>
|
|
<pre>public abstract void reduce(<a href="../../../edu/rit/pjmr/Reducer.html" title="type parameter in Reducer">K</a> key,
|
|
<a href="../../../edu/rit/pjmr/Reducer.html" title="type parameter in Reducer">V</a> value)</pre>
|
|
<div class="block">Reduce the given (key, value) pair. The state of the <TT>key</TT> must
|
|
not be altered. The state of the <TT>value</TT> may be altered.
|
|
<P>
|
|
The <TT>reduce()</TT> method must be overridden in a subclass.</div>
|
|
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - Key; non-null.</dd><dd><code>value</code> - Value; may be null.</dd></dl>
|
|
</li>
|
|
</ul>
|
|
<a name="finish()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>finish</h4>
|
|
<pre>public void finish()</pre>
|
|
<div class="block">Finish this reducer.
|
|
<P>
|
|
The base class <TT>finish()</TT> method does nothing. A subclass may
|
|
override the <TT>finish()</TT> method to do something.</div>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<div class="bottomNav"><a name="navbar_bottom">
|
|
<!-- -->
|
|
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/Reducer.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-files/index-1.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../edu/rit/pjmr/PjmrJob.html" title="class in edu.rit.pjmr"><span class="strong">Prev Class</span></a></li>
|
|
<li><a href="../../../edu/rit/pjmr/ReducerConfig.html" title="class in edu.rit.pjmr"><span class="strong">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?edu/rit/pjmr/Reducer.html" target="_top">Frames</a></li>
|
|
<li><a href="Reducer.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_bottom">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
|
<li><a href="#method_summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li>Field | </li>
|
|
<li><a href="#constructor_detail">Constr</a> | </li>
|
|
<li><a href="#method_detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip-navbar_bottom">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
<p class="legalCopy"><small><FONT SIZE="-2">Copyright © 2013–2016 by Alan Kaminsky. All rights reserved. Send comments to ark</FONT><FONT SIZE="1" COLOR="#FFFFFF">­</FONT><FONT SIZE="-2">@</FONT><FONT SIZE="1" COLOR="#FFFFFF">­</FONT><FONT SIZE="-2">cs.rit.edu.</FONT></small></p>
|
|
</body>
|
|
</html>
|