show-queue cannot be starved for admins

When admin executes the show-queue command a new thread will be
created to make sure that the commmand is always executed even if
the thread pool is exhausted.

Bug: issue 570
This commit is contained in:
carloseduardo.baldacin
2010-05-20 14:41:52 -03:00
committed by Ulrik Sjölin
parent 8ef3b69f35
commit 617be71c21
3 changed files with 39 additions and 1 deletions

View File

@@ -238,7 +238,8 @@ public abstract class BaseCommand implements Command {
*/
protected synchronized void startThread(final CommandRunnable thunk) {
final TaskThunk tt = new TaskThunk(thunk);
if (isAdminCommand()) {
if (isAdminCommand()||(isAdminHighPriorityCommand() && userProvider.get().isAdministrator())) {
// Admin commands should not block the main work threads (there
// might be an interactive shell there), nor should they wait
// for the main work threads.
@@ -253,6 +254,10 @@ public abstract class BaseCommand implements Command {
return getClass().getAnnotation(AdminCommand.class) != null;
}
private final boolean isAdminHighPriorityCommand() {
return getClass().getAnnotation(AdminHighPriorityCommand.class) != null;
}
/**
* Terminate this command and return a result code to the remote client.
* <p>