Java Reference
In-Depth Information
private String currentHost;
/**
* The ID of the current host.
*/
private int currentHostID = -1;
/**
* Add the specified URL to the workload.
*
* @param url
* The URL to be added.
* @param source
* The page that contains this URL.
* @param depth
* The depth of this URL.
* @return True if the URL was added, false otherwise.
* @throws WorkloadException
*/
public boolean add(URL url, URL source, int depth)
throws WorkloadException
{
boolean result = false;
try
{
this.addLock.acquire();
if (!contains(url))
{
String strURL = truncate(url.toString(), this.maxURLSize);
String strHost = truncate(url.getHost(), this.maxHostSize)
.toLowerCase();
result = true;
// get the host
int hostID = getHostID(url, false);
if (hostID == -1)
{
this.stmtAdd2.execute(strHost,
Status.STATUS_WAITING, 0, 0);
hostID = getHostID(url, true);
}
// need to set the current host for the first time?
if (this.currentHostID == -1)
{
Search WWH ::




Custom Search