code: private synchronized void checkShutDownRunningProcesses() {
          smtpRequestsPhaser.arriveAndDeregister();
          LOGGER.trace("SMTP request threads left: {}", smtpRequestsPhaser.getUnarrivedParties());
          // if this thread is the last one finishing
          if (smtpRequestsPhaser.getUnarrivedParties() == 0) {
              LOGGER.trace("all threads have finished processing");
  			//noinspection ConstantConditions
  			if (needsAuthenticatedProxy() && proxyServer.isRunning() && !proxyServer.isStopping()) {
                  LOGGER.trace("stopping proxy bridge...");
                  proxyServer.stop();
              }
              // shutdown the threadpool, or else the Mailer will keep any JVM alive forever
              // executor is only available in async mode
              if (executor != null) {
                  executor.shutdown();
              }
          }
      }
docs: We need to keep a count of running threads in case a proxyserver is running or a connection pool needs to be shut down.