You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cu...@apache.org on 2007/04/02 23:35:25 UTC
svn commit: r524929 - in /lucene/hadoop/trunk/src/java/org/apache/hadoop:
ipc/Client.java mapred/Task.java mapred/TaskUmbilicalProtocol.java
Author: cutting
Date: Mon Apr 2 14:35:24 2007
New Revision: 524929
URL: http://svn.apache.org/viewvc?view=rev&rev=524929
Log:
HADOOP-1191. Fix a problem with the earlier patch, where interrupts received under an RPC were not causing the thread to exit.
Modified:
lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Client.java
lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/Task.java
lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskUmbilicalProtocol.java
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Client.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Client.java?view=diff&rev=524929&r1=524928&r2=524929
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Client.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Client.java Mon Apr 2 14:35:24 2007
@@ -454,16 +454,14 @@
* <code>address</code>, returning the value. Throws exceptions if there are
* network problems or if the remote code threw an exception. */
public Writable call(Writable param, InetSocketAddress address)
- throws IOException {
+ throws InterruptedException, IOException {
Connection connection = getConnection(address);
Call call = new Call(param);
synchronized (call) {
connection.sendParam(call); // send the parameter
long wait = timeout;
do {
- try {
- call.wait(wait); // wait for the result
- } catch (InterruptedException e) {}
+ call.wait(wait); // wait for the result
wait = timeout - (System.currentTimeMillis() - call.lastActivity);
} while (!call.done && wait > 0);
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/Task.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/Task.java?view=diff&rev=524929&r1=524928&r2=524929
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/Task.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/Task.java Mon Apr 2 14:35:24 2007
@@ -208,6 +208,8 @@
String status = taskProgress.toString();
try {
umbilical.progress(getTaskId(), progress, status, phase, counters);
+ } catch (InterruptedException ie) {
+ Thread.currentThread().interrupt(); // interrupt ourself
} catch (IOException ie) {
LOG.warn(StringUtils.stringifyException(ie));
}
@@ -222,9 +224,13 @@
try {
if (needProgress) {
// send a final status report
- umbilical.progress(getTaskId(), taskProgress.get(),
- taskProgress.toString(), phase, counters);
- needProgress = false;
+ try {
+ umbilical.progress(getTaskId(), taskProgress.get(),
+ taskProgress.toString(), phase, counters);
+ needProgress = false;
+ } catch (InterruptedException ie) {
+ Thread.currentThread().interrupt(); // interrupt ourself
+ }
}
umbilical.done(getTaskId());
return;
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskUmbilicalProtocol.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskUmbilicalProtocol.java?view=diff&rev=524929&r1=524928&r2=524929
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskUmbilicalProtocol.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskUmbilicalProtocol.java Mon Apr 2 14:35:24 2007
@@ -19,6 +19,7 @@
package org.apache.hadoop.mapred;
import java.io.IOException;
+import java.lang.InterruptedException;
import org.apache.hadoop.ipc.VersionedProtocol;
@@ -42,7 +43,7 @@
*/
void progress(String taskid, float progress, String state,
TaskStatus.Phase phase, Counters counters)
- throws IOException;
+ throws IOException, InterruptedException;
/** Report error messages back to parent. Calls should be sparing, since all
* such messages are held in the job tracker.