Tuesday, October 30, 2018

Stop MongoDB in java

private static void stopMongoDB() throws IOException {
ProcessBuilder pb = new ProcessBuilder("taskkill", "/IM", "mongod.exe").inheritIO();
Process proc = pb.start();
try {
proc.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
}

calling the above method:

stopMongoDB();

No comments:

Post a Comment

Recent Post

Databricks Delta table merge Example

here's some sample code that demonstrates a merge operation on a Delta table using PySpark:   from pyspark.sql import SparkSession # cre...