package forager.client;

import java.io.IOException;
import java.util.logging.Logger;

/**
 * Monitors currently running tasks and decides when new tasks should be
 * requested based on current processing directives.
 *
 * @author malensek
 */
public class StatusMonitor implements Runnable {

    private static final Logger logger = Logger.getLogger("forager");

    /** Maximum number of concurrent tasks */
    int maxActive = 4;

    boolean online;

    private Forager forager;

    public StatusMonitor(Forager forager) {
        this.forager = forager;
        this.maxActive = forager.getMaxTasks();
    }

    public void run() {
        online = true;

        while (online) {
            int active = forager.getNumActive() + forager.getNumPending();
            if (active < maxActive) {
                int numTasks = maxActive - active;
                try {
                    forager.submitTaskRequest(numTasks);
                } catch (IOException e) {
                    System.out.println("Failed to submit task request!");
                    e.printStackTrace();
                }
            }
            try {
                Thread.sleep(30000);
            } catch (InterruptedException e) {
                logger.fine("Waking up StatusMonitor thread");
            }
        }
    }
}

@@ -448,17 +448,16 @@
 online;%0A
-%0A
     priv
@@ -468,23 +468,30 @@
 Forager 
-forager
+clientInstance
 ;%0A%0A    p
@@ -518,23 +518,30 @@
 Forager 
-forager
+clientInstance
 ) %7B%0A    
@@ -553,25 +553,39 @@
 his.
-forager = forager
+clientInstance = clientInstance
 ;%0A  
@@ -603,31 +603,38 @@
 maxActive = 
-forager
+clientInstance
 .getMaxTasks
@@ -742,23 +742,30 @@
 ctive = 
-forager
+clientInstance
 .getNumA
@@ -775,18 +775,41 @@
 ve()
- + forager
+%0A                + clientInstance
 .get
@@ -953,23 +953,30 @@
         
-forager
+clientInstance
 .submitT

Use "clientInstance" instead of just "forager"