code: private boolean joinThreads(Thread pThreads[]) {
          for (int i=0;i< pThreads.length;i++) {
              final Thread t = pThreads[i];
              if (t.isDaemon() ||
                      t.getThreadGroup() == null || // has died on us
                      t.getThreadGroup().equals(threadGroup) ||
                      checkExcludedNames(t.getName()))
              {
                  // These are threads which should not prevent the server from stopping.
                  continue;
              }
              try {
                  t.join();
              } catch (Exception ex) {
                  // Ignore that one.
              } finally {
                  // We just joined a 'foreign' thread, so we redo the loop
                  return true;
              }
          }
          // All 'foreign' threads has finished, hence we are prepared to stop
          return false;
      }
docs: Join threads, return false if only our own threads are left.