List of usage examples for com.mongodb MongoClient fsync
@Deprecated public CommandResult fsync(final boolean async)
From source file:com.softinstigate.restheart.Bootstrapper.java
License:Open Source License
private static void stopServer() { logger.info("stopping RESTHeart"); logger.info("waiting for pending request to complete (up to 1 minute)"); try {//from w w w . j a v a 2 s. com hanldersPipe.shutdown(); hanldersPipe.awaitShutdown(60 * 1000); // up to 1 minute } catch (InterruptedException ie) { logger.error("error while waiting for pending request to complete", ie); } if (server != null) { try { server.stop(); } catch (Throwable t) { logger.error("error stopping undertow server", t); } } try { MongoClient client = MongoDBClientSingleton.getInstance().getClient(); client.fsync(false); client.close(); } catch (Throwable t) { logger.error("error flushing and clonsing the mongo cliet", t); } tmpExtractedFiles.keySet().forEach(k -> { try { ResourcesExtractor.deleteTempDir(k, tmpExtractedFiles.get(k)); } catch (URISyntaxException | IOException ex) { logger.error("error cleaning up temporary directory {}", tmpExtractedFiles.get(k).toString(), ex); } }); logger.info("RESTHeart stopped"); }
From source file:org.apache.gora.mongodb.store.MongoStore.java
License:Apache License
/** * Ensure the data is synced to disk./* ww w . ja v a 2s. c o m*/ */ @Override public void flush() { for (MongoClient client : mapsOfClients.values()) { client.fsync(false); LOG.info("Forced synced of database for Mongo instance {}.", new Object[] { client }); } }