Hi I am writing a servlet to check HTTP links stored in a database and record the status code for each link present
obviously forming a connection to a website can take a while so Ideally I want to construct a thread group so it would be possible to have five threads doing the link checking
however I have no idea how I can do this as the data comes out of the database
Code:
while (rs.next())
{
String linkToCheck = rs.getString("location");
if (linkToCheck != null)
{
try
{
link.openConnection(linkToCheck);
String headerInfo[] = link.splitHeaderInfo(link.getHeaderData());
out.println("RESPONSE CODE "+headerInfo[1]);
}
catch (MalformedURLException ex)
{
out.println(
Malformed URL"+ ex.toString());
}
catch (IOException ex)
{
out.println(
"IO Exception"+ex.toString());
}
So what I want ideally is a way for the thread to signal it is finished and then pick up the next bit of data from the database (or could store this in a collection and use that)
Social Networking Bookmarks