 +        // because it minimizing the amount of scanning we need to do if we
 +        // get a large set of offered nodes.
 +        List<Integer> indices = new LinkedList<Integer>();
++        List<List<TaskDescription>> replies =
++            new ArrayList<List<TaskDescription>>(numOffers);
 +        for (int i = 0; i < numOffers; i++) {
 +          indices.add(i);
++          replies.add(new ArrayList<TaskDescription>());
 +        }
 +        while (indices.size() > 0) {
 +          for (Iterator<Integer> it = indices.iterator(); it.hasNext();) {
 +            int i = it.next();
-+            SlaveOffer offer = offers.get(i);
++            Offer offer = offers.get(i);
 +            TaskDescription task = findTask(
 +                offer.getSlaveId(), offer.getHostname(), cpus[i], mem[i]);
 +            if (task != null) {
 +              cpus[i] -= getResource(task, "cpus");
 +              mem[i] -= getResource(task, "mem");
-+              tasks.add(task);
++              replies.get(i).add(task);
 +            } else {
 +              it.remove();
 +            }
 +          }
 +        }
-+        
-+        Map<String, String> params = new HashMap<String, String>();
-+        params.put("timeout", "1");
-+        d.replyToOffer(oid, tasks, params);
++
++        for (int i = 0; i < numOffers; i++) {
++          OfferID offerId = offers.get(i).getId();
++          Status status = d.launchTasks(offerId, replies.get(i));
++          if (status != Status.OK) {
++            LOG.warn("SchedulerDriver returned irregular status: " + status);
++          }
++        }
 +      }
 +    } catch(Exception e) {
 +      LOG.error("Error in resourceOffer", e);

+HADOOP_HOME="`dirname $0`/.."
+cd $HADOOP_HOME # Needed for MesosScheduler to find bin/mesos-executor
+$HADOOP_HOME/bin/hadoop-daemon.sh start $CLASS $TAG
diff -X excludes -Nru hadoop-0.20.2.orig/ivy/libraries.properties hadoop-0.20.2/ivy/libraries.properties
--- hadoop-0.20.2.orig/ivy/libraries.properties	2010-02-18 23:55:23.000000000 -0800
+++ hadoop-0.20.2/ivy/libraries.properties	2011-06-26 20:02:27.000000000 -0700
@@ -71,3 +71,5 @@
 
 xmlenc.version=0.52
 xerces.version=1.4.4
+
+protobuf-java.version=2.3.0
diff -X excludes -Nru hadoop-0.20.2.orig/src/contrib/build-contrib.xml hadoop-0.20.2/src/contrib/build-contrib.xml
--- hadoop-0.20.2.orig/src/contrib/build-contrib.xml	2010-02-18 23:55:24.000000000 -0800
+++ hadoop-0.20.2/src/contrib/build-contrib.xml	2011-06-26 20:02:27.000000000 -0700
@@ -77,6 +77,13 @@
   <property name="ivy.artifact.retrieve.pattern"
     			value="${ant.project.name}/[conf]/[artifact]-[revision].[ext]"/>

+    return bos.toByteArray();
+  }
+}
diff -X excludes -ruN hadoop-0.20.2.orig/src/contrib/mesos/src/java/org/apache/hadoop/mapred/MesosJobTrackerInstrumentation.java hadoop-0.20.2/src/contrib/mesos/src/java/org/apache/hadoop/mapred/MesosJobTrackerInstrumentation.java
--- hadoop-0.20.2.orig/src/contrib/mesos/src/java/org/apache/hadoop/mapred/MesosJobTrackerInstrumentation.java	1969-12-31 16:00:00.000000000 -0800
+++ hadoop-0.20.2/src/contrib/mesos/src/java/org/apache/hadoop/mapred/MesosJobTrackerInstrumentation.java	2011-10-12 18:24:05.000000000 -0700
@@ -0,0 +1,25 @@
+package org.apache.hadoop.mapred;
+
