do {
numchars = sock.read(buffer);
-
String curr = (new String(buffer)).subString(0, numchars);
-
lq.response.append(curr);
buffer = new byte[1024];
} while(numchars > 0);
public class Spider {
+ public Spider() {}
public static void main(String[] args) {
int NUM_THREADS = 3;
int maxDepth = 3;
}
Thread.myStart(tmp, mid[i]);
}
+
+ while(true)
+ Thread.sleep(100000);
+
for (i = 0; i < NUM_THREADS; i++) {
atomic {
tmp = ts.threads[i];
public class Task {
//Current worker thread
Worker w;
+ public Task() {}
public void execute();
public void setWorker(Worker w) {
this.w = w;
if (!tasks.todo.isEmpty()) {
//grab segment from todo list
t=workingtask=(Task) tasks.todo.pop();
- t.setWorker(this);
+ if(t!=null)
+ t.setWorker(this);
} else {
//steal work from dead threads
Worker[] threads=tasks.threads;
Worker w=(Worker)threads[i];
if (w.workingtask!=null)
shouldexit=false;
- if (w.getStatus()==-1&&w.workingtask!=null) {
+ if (w.getStatus(i)==-1&&w.workingtask!=null) {
//steal work from this thread
t=workingtask=w.workingtask;
w.workingtask=null;
if (t!=null) {
t.execution();
continue;
- } else if (notdone)
- sleep(500000);
+ } else if (notdone) {
+ System.out.println("Not done");
+ sleep(500000);
+ }
+ }
+ System.out.println("\n\nDone\n\n");
+ while(true) {
+ sleep(100000);
}
}
public static native void printRecoveryStat();
-}
\ No newline at end of file
+}
SRC1=${MAINCLASS}.java
SRC2=Global${SUBCLASS}.java
SRC3=${SUBCLASS}Task.java
-FLAGS=-recoverystats -recovery -transstats -dsmcaching -dsm -dsmtask -debug -nooptimize -mainclass ${MAINCLASS}
-DSMFLAGS=-dsm -dsmtask -sandbox -transstats -debug -nooptimize -mainclass ${MAINCLASS}
+FLAGS=-recoverystats -recovery -transstats -dsmcaching -dsm -dsmtask -optimize -mainclass ${MAINCLASS}
+DSMFLAGS= -dsm -dsmtask -sandbox -transstats -optimize -mainclass ${MAINCLASS}
default:
-# ../../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC2} ${SRC3} ${SRC1}
- ../../../../buildscript ${DSMFLAGS} -o ${MAINCLASS}DSM *.java
+ ../../../../buildscript ${DSMFLAGS} -o ${MAINCLASS}DSM GlobalQuery.java LocalQuery.java QueryTask.java Spider.java Task.java GlobalQueue.java Worker.java TaskSet.java
+ ../../../../buildscript ${FLAGS} -o ${MAINCLASS} GlobalQuery.java LocalQuery.java QueryTask.java Spider.java Task.java GlobalQueue.java Worker.java TaskSet.java
clean:
rm -rf tmpbuilddirectory
rm *.bin
+