Java Reference
In-Depth Information
/**
* Set the status for the specified URL.
*
* @param url
* The URL to set the status for.
* @param status
* What to set the status to.
* @throws WorkloadException
* Thrown if the status cannot be set.
* @throws SQLException
* Thrown if a SQL error occurs.
*/
private void setStatus(URL url, String status)
throws SQLException,
WorkloadException
{
int id = getWorkloadID(url, true);
this.stmtSetWorkloadStatus.execute("" + status, id);
if (status.equalsIgnoreCase(Status.STATUS_ERROR))
{
this.stmtSetWorkloadStatus2.execute(
0, 1, url.getHost().toLowerCase());
} else if (status.equalsIgnoreCase(Status.STATUS_DONE))
{
this.stmtSetWorkloadStatus2.execute(1, 0,
url.getHost().toLowerCase());
}
}
/**
* Truncate a string to the specified length.
*
* @param str
* The string to truncate.
* @param length
* The length to truncate the string to.
* @return The truncated string.
*/
private String truncate(String str, int length)
{
if (str.length() < length)
{
return str;
} else
{
Search WWH ::




Custom Search