@Override
public void run()
{
// Each thread gets its dedicated connection, and posts requests against it.
ClientConnection con = null;
try
{
con = ClientConnectionPool.get(servers, port);
long endTime = System.currentTimeMillis() + (1000l * this.duration);
while (endTime > System.currentTimeMillis())
{
try
{
con.execute(procedure, (long)rand.nextInt(this.poolSize), this.wait);
TrackingResults.incrementAndGet(0);
}
catch(Exception x)
{
TrackingResults.incrementAndGet(1);
}
}
}
catch(Exception x)
{
System.err.println("Exception: " + x);
x.printStackTrace();
}
finally
{
try { con.close(); } catch (Exception x) {}
}
}