private static void initOperationThreads(
     OperationThread[] operationThreads, ThreadFactory threadFactory) {
   for (int threadId = 0; threadId < operationThreads.length; threadId++) {
     OperationThread operationThread = (OperationThread) threadFactory.newThread(null);
     operationThreads[threadId] = operationThread;
     operationThread.start();
   }
 }
 private static void awaitTermination(OperationThread[] operationThreads) {
   for (OperationThread thread : operationThreads) {
     try {
       thread.awaitTermination(TERMINATION_TIMEOUT_SECONDS, TimeUnit.SECONDS);
     } catch (InterruptedException ignored) {
       Thread.currentThread().interrupt();
     }
   }
 }
 private static void interruptAll(OperationThread[] operationThreads) {
   for (OperationThread thread : operationThreads) {
     thread.interrupt();
   }
 }