Doug,

What is the purpose of this utility?  If I knew that I might be able to
better answer this question.

You can modify your crawler class to be threaded and to leverage a listener
(publish/subscribe pattern).  Create a static method in the listener class
that will monitor the progress of the crawler.  You would them continue much
like you are now except that you would create a reference to the listener
class (createObject call) and replace line 5 with a loop that polls the
static method of the listener and flushes what it reads to the page display.
Naturally depending upon what you want to do with the information you will
need to be careful about deciding upon destructive vs. non-destructive
polling (will there, even remotely, be multiple users that might collide on
this task; you'll have to answer that one carefully).

Now depending upon the purpose of this utility, you might continue to use
some (or all) of the ideas I suggested and use some additional things as
well.  If the display is merely an administrative report or you want to then
proceed to so something that doesn't require direct user interaction, you
might have the crawler thread make a http connection to a template when it
is done (you could specify this in the constructor or in a config file).
The processed data could still be statically held by the listener connected
to the crawler instance or, better, a data file somewhere and you could then
collect that information.
Thus the code snippet you've given below is nothing more than a launcher for
the process and it will not leave the user in a waiting state.

rish

________________________________

From: Doug James [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 23, 2004 3:45 PM
To: CF-Talk
Subject: repost: java to cf


I have written a java class that crawls our site and compiles a list
of
links. I then populate a cf array from a java method that returns a
java
vector. The crawling portion  (line 4) appears to take a couple of
minutes, no surprise. I have to stop the population of the array
(line
5) after many minutes. Any suggestions? ideas?

code snippet:
1: <cfscript>
2: pages = ArrayNew(1);
3: crawler = createObject("java","Crawler");
4: crawler.crawl("http://site", "http://site", "false", 9);
// this line seems to take a looooong time
5: pages = crawler.getVisitedPages();
6: </cfscript>

Thanks!

Doug James
IT Developer
MUSC - Hollings Cancer Center
http://hcc.musc.edu
________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to