private void addToQueue(Runnable command, long timeout, TimeUnit unit) {
try {
boolean added = executor.getQueue().offer(command, timeout, unit);
if (!added) {
throw new RejectedExecutionException();
}
} catch (InterruptedException e) {
throw new RejectedExecutionException(e);
}
}