Java Reference
In-Depth Information
* @throws WorkloadException
* Thrown if the SQL cannot be executed, and
* retrying the statement has failed.
*/
public Results executeQuery(Object... parameters)
throws WorkloadException
{
for (;;)
{
try
{
PreparedStatement statement = obtainStatement();
for (int i = 0; i < parameters.length; i++)
{
statement.setObject(i + 1, parameters[i]);
}
long time = System.currentTimeMillis();
ResultSet rs = statement.executeQuery();
time = System.currentTimeMillis() - time;
// System.out.println( time + ":" + sql);
return (new Results(statement, rs));
} catch (SQLException e)
{
logger.log(Level.SEVERE, "SQL Exception", e);
if (!(e.getCause() instanceof SQLException))
{
this.manager.tryOpen();
} else
{
throw (new WorkloadException(e));
}
}
}
}
/**
* Obtain a statement. Each thread should use their own
* statement, and then call the releaseStatement method
* when they are done.
*
* @return A PreparedStatement object.
* @throws SQLException
* Thrown if the statement could not be
Search WWH ::




Custom Search