try {
return work.doServiceWork();
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ServiceStateException("service operation interrupted", e);
}
finally {
synchronized (state) {
serviceThreads.remove(Thread.currentThread());
state.notifyAll();