Update of /var/cvs/speeltuin/andre/mmget/src/org/mmbase/mmget
In directory james.mmbase.org:/tmp/cvs-serv19351/src/org/mmbase/mmget
Modified Files:
CSSReader.java HTMLReader.java MMGet.java
Log Message:
needs more options like status etc, but seems to work ok now
See also:
http://cvs.mmbase.org/viewcvs/speeltuin/andre/mmget/src/org/mmbase/mmget
Index: CSSReader.java
===================================================================
RCS file: /var/cvs/speeltuin/andre/mmget/src/org/mmbase/mmget/CSSReader.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- CSSReader.java 24 Mar 2009 13:32:24 -0000 1.5
+++ CSSReader.java 24 Mar 2009 20:02:07 -0000 1.6
@@ -19,7 +19,7 @@
* @import url("mystyle.css");
*
* @author André van Toly
- * @version $Id: CSSReader.java,v 1.5 2009/03/24 13:32:24 andre Exp $
+ * @version $Id: CSSReader.java,v 1.6 2009/03/24 20:02:07 andre Exp $
*/
public final class CSSReader extends UrlReader {
private static final Logger log =
Logging.getLoggerInstance(CSSReader.class);
@@ -87,11 +87,8 @@
}
public void close() throws IOException {
- log.debug("closing...");
inrdr.close();
-
if (huc != null) {
- log.debug("disconnecting... " + getUrl().toString());
huc.disconnect();
}
}
Index: HTMLReader.java
===================================================================
RCS file: /var/cvs/speeltuin/andre/mmget/src/org/mmbase/mmget/HTMLReader.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- HTMLReader.java 24 Mar 2009 13:32:24 -0000 1.6
+++ HTMLReader.java 24 Mar 2009 20:02:07 -0000 1.7
@@ -15,7 +15,7 @@
* Reads a web resource an returns its tags that may contain links to other
resources.
*
* @author André van Toly
- * @version $Id: HTMLReader.java,v 1.6 2009/03/24 13:32:24 andre Exp $
+ * @version $Id: HTMLReader.java,v 1.7 2009/03/24 20:02:07 andre Exp $
*/
public final class HTMLReader extends UrlReader {
private static final Logger log =
Logging.getLoggerInstance(HTMLReader.class);
@@ -141,11 +141,8 @@
}
public void close() throws IOException {
- log.debug("closing...");
inrdr.close();
-
if (huc != null) {
- log.debug("disconnecting... " + getUrl().toString());
huc.disconnect();
}
}
Index: MMGet.java
===================================================================
RCS file: /var/cvs/speeltuin/andre/mmget/src/org/mmbase/mmget/MMGet.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- MMGet.java 24 Mar 2009 13:45:59 -0000 1.12
+++ MMGet.java 24 Mar 2009 20:02:07 -0000 1.13
@@ -25,7 +25,7 @@
* TODO: init rootURL early on, and check all urls against it (so we don't
travel up the rootURL)
*
* @author André van Toly
- * @version $Id: MMGet.java,v 1.12 2009/03/24 13:45:59 andre Exp $
+ * @version $Id: MMGet.java,v 1.13 2009/03/24 20:02:07 andre Exp $
*/
public final class MMGet {
@@ -145,7 +145,7 @@
*
* @param url The link to start from, normally the homepage
* @param dir The directory to save the files to
- * @return Message with the results
+ * @return Message with the name of the Future thread
*/
public String downloadSite(String url, String dir) {
this.directory = dir;
@@ -169,40 +169,32 @@
}
StringBuilder info = new StringBuilder();
- info.append("\n*** url: ").append(startURL.toString());
- //info.append("\n** dir.: ").append(startdirURL.toString());
- info.append("\n* saved in: ").append(savedir.toString());
+ info.append("\n url: ").append(startURL.toString());
+ info.append("\n saved in: ").append(savedir.toString());
log.info(info.toString());
- /*
- ThreadPools.jobsExecutor.submit(new Callable() {
- public String call() {
- return start();
- }
- });
- */
- // this Future stuff prevents errors to surface
Future<String> fthread = ThreadPools.jobsExecutor.submit(new
Callable() {
public String call() {
return start();
}
});
+ ThreadPools.identify(fthread, "MMGet download of " +
startURL.toString());
String tname = ThreadPools.getString(fthread);
- log.debug("thread: " + tname);
+ log.debug("threadname: " + tname);
try {
- status = fthread.get(60, TimeUnit.SECONDS);
+ status = "Job '" + tname + "' is " + fthread.get(10,
TimeUnit.SECONDS);
} catch(TimeoutException e) {
- log.error(e);
+ //log.error(e);
+ status = tname;
} catch(ExecutionException e) {
log.error(e);
} catch(InterruptedException e) {
log.error(e);
}
- info.append("\n").append(status);
log.info(status);
- return info.toString();
+ return status;
}
/**
@@ -217,7 +209,7 @@
startdirURL = null;
readUrl(startURL);
- return "Job finished!";
+ return "finished!";
}
/**
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs