@Override public void stop() { synchronized (this) { if (!stopped) { stopped = true; logger.info("try to stop mongos"); if (!sendStopToMongoInstance()) { logger.warning("could not stop mongos with db command, try next"); if (!sendKillToProcess()) { logger.warning("could not stop mongos, try next"); if (!tryKillToProcess()) { logger.warning("could not stop mongos the second time, try one last thing"); } } } stopProcess(); if ((dbDir != null) && (dbDirIsTemp) && (!Files.forceDelete(dbDir))) logger.warning("Could not delete temp db dir: " + dbDir); } } }