From c611c144b60078baec86e7e41ae3ccc541b561dd Mon Sep 17 00:00:00 2001 From: hkhang Date: Mon, 9 Nov 2009 23:43:44 +0000 Subject: [PATCH] *** empty log message *** --- .../Spider/recovery/GlobalQuery.java | 4 +- .../Benchmarks/Spider/recovery/QueryTask.java | 43 +++++++++++-------- .../Benchmarks/Spider/recovery/Spider.java | 16 ++++--- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/Robust/src/Benchmarks/Spider/recovery/GlobalQuery.java b/Robust/src/Benchmarks/Spider/recovery/GlobalQuery.java index 7efff695..718728b8 100644 --- a/Robust/src/Benchmarks/Spider/recovery/GlobalQuery.java +++ b/Robust/src/Benchmarks/Spider/recovery/GlobalQuery.java @@ -3,9 +3,9 @@ public class GlobalQuery { GlobalString path; int depth; - public GlobalQuery(GlobalString hostname) { + public GlobalQuery(GlobalString hostname, GlobalString path) { this.hostname = hostname; - this.path = global new GlobalString(""); + this.path = path; this.depth = 0; } diff --git a/Robust/src/Benchmarks/Spider/recovery/QueryTask.java b/Robust/src/Benchmarks/Spider/recovery/QueryTask.java index 743d63e0..d8b9a121 100644 --- a/Robust/src/Benchmarks/Spider/recovery/QueryTask.java +++ b/Robust/src/Benchmarks/Spider/recovery/QueryTask.java @@ -86,18 +86,21 @@ public class QueryTask extends Task { else if ((str.subString(index+1)).equals("ppt")) return true; else if ((str.subString(index+1)).equals("pptx")) return true; else if ((str.subString(index+1)).equals("jpg")) return true; + else if ((str.subString(index+1)).equals("mp3")) return true; + else if ((str.subString(index+1)).equals("wmv")) return true; + else if ((str.subString(index+1)).equals("doc")) return true; + else if ((str.subString(index+1)).equals("docx")) return true; + else if ((str.subString(index+1)).equals("mov")) return true; + else if ((str.subString(index+1)).equals("flv")) return true; else return false; } return false; } public void done(Object obj) { - if (gTitle != null) + if ((gTitle != null) && (gTitle.length() > 0)) { processList(); - - GlobalString str = global new GlobalString("true"); - - doneList.put(workingURL, str); + } while(!toprocess.isEmpty()) { GlobalQuery q = (GlobalQuery)toprocess.pop(); @@ -111,6 +114,9 @@ public class QueryTask extends Task { if (!doneList.containsKey(gsb.toGlobalString())) { todoList.push(q); + + GlobalString str = global new GlobalString("1"); + doneList.put(gsb.toGlobalString(), str); } } } @@ -325,18 +331,21 @@ public class QueryTask extends Task { else if (str.equals("but")) return true; else if (str.equals("to")) return true; else if (str.equals("The")) return true; - else if (str.equals(".")) return true; - else if (str.equals("-")) return true; - else if (str.equals("=")) return true; - else if (str.equals("_")) return true; - else if (str.equals(":")) return true; - else if (str.equals(";")) return true; - else if (str.equals("\'")) return true; - else if (str.equals("\"")) return true; - else if (str.equals("|")) return true; - else if (str.equals("@")) return true; - else if (str.equals("&")) return true; - else if (str.equals(" ")) return true; + else if (str.length() == 1) { + if (str.charAt(0) == '.') return true; + else if (str.charAt(0) == '.') return true; + else if (str.charAt(0) == '-') return true; + else if (str.charAt(0) == '=') return true; + else if (str.charAt(0) == '_') return true; + else if (str.charAt(0) == ':') return true; + else if (str.charAt(0) == ';') return true; + else if (str.charAt(0) == '\'') return true; + else if (str.charAt(0) == '\"') return true; + else if (str.charAt(0) == '|') return true; + else if (str.charAt(0) == '@') return true; + else if (str.charAt(0) == '&') return true; + else if (str.charAt(0) == ' ') return true; + } else return false; } diff --git a/Robust/src/Benchmarks/Spider/recovery/Spider.java b/Robust/src/Benchmarks/Spider/recovery/Spider.java index 54aea288..11f37189 100644 --- a/Robust/src/Benchmarks/Spider/recovery/Spider.java +++ b/Robust/src/Benchmarks/Spider/recovery/Spider.java @@ -1,7 +1,7 @@ public class Spider { public static void main(String[] args) { int NUM_THREADS = 3; - int maxDepth = 3; + int maxDepth = 4; int i, j; Work[] works; QueryTask[] qt; @@ -9,11 +9,12 @@ public class Spider { NUM_THREADS = Integer.parseInt(args[0]); - if (args.length == 3) { - maxDepth = Integer.parseInt(args[2]); - } +// if (args.length == 3) { +// maxDepth = Integer.parseInt(args[2]); +// } GlobalString firstmachine; + GlobalString firstpage; int mid[] = new int[NUM_THREADS]; // mid[0] = (128<<24)|(195<<16)|(180<<8)|21; @@ -25,12 +26,17 @@ public class Spider { atomic { firstmachine = global new GlobalString(args[1]); + if (args.length == 3) { + firstpage = global new GlobalString(args[2]); + } + else + firstpage = global new GlobalString("");; works = global new Work[NUM_THREADS]; qt = global new QueryTask[NUM_THREADS]; currentWorkList = global new GlobalQuery[NUM_THREADS]; - GlobalQuery firstquery = global new GlobalQuery(firstmachine); + GlobalQuery firstquery = global new GlobalQuery(firstmachine, firstpage); Queue todoList = global new Queue(); DistributedHashMap doneList = global new DistributedHashMap(500, 500, 0.75f); -- 2.34.1