* @throws QueryInterruptedException if the operation is cancelled (by the user in another thread)
*/
protected Object performExecuteTask(final Object... args)
{
Integer timeout = getTimeoutMillis();
FutureTask theTask = null;
final Object[] threadResults = new Object[1];
try
{
// Execute the query in its own thread so we can time it out
theTask = new FutureTask(new Runnable()
{
public void run()
{
threadResults[0] = performExecuteInternal(args);
}
}, null);
tasks.add(theTask);
// start task in a new thread
if (NucleusLogger.QUERY.isDebugEnabled())
{
if (timeout != null && timeout > 0)
{
NucleusLogger.QUERY.debug(LOCALISER.msg("021019", toString(), timeout));
}
else
{
NucleusLogger.QUERY.debug(LOCALISER.msg("021022", toString()));
}
}
new Thread(theTask).start();
// wait for the execution to finish, timeout after the users limit is exceeded if required
if (timeout != null && timeout > 0)
{
theTask.get(timeout, TimeUnit.MILLISECONDS);
}
else
{
theTask.get();
}
tasks.remove(theTask);
}
catch (TimeoutException e)
{