code: private <T> Future<T> submitTaskToQueue(SQLQueueCallable<T> callable){
          if(acceptTasks.get()){
              return queue.submit(callable);
          } else {
              throw new RejectedExecutionException("Database is closed");
          }
      }
docs: Adds a task to the queue, checking if the queue is still open
  to accepting tasks
  @param callable The task to submit to the queue
  @param <T> The type of object that the callable returns
  @return Future representing the task to be executed.
  @throws RejectedExecutionException If the queue has been shutdown.