List of usage examples for com.mongodb WriteConcern FSYNCED
WriteConcern FSYNCED
To view the source code for com.mongodb WriteConcern FSYNCED.
Click Source Link
From source file:org.openmama.dbwriter.MamaMongodb.java
/** * @return Write concern for database writes *///from w ww. j a v a 2s . co m private WriteConcern getWriteConcern(final String config) { switch (config.toLowerCase()) { case "none": case "errors_ignored": case "errorsignored": return WriteConcern.ERRORS_IGNORED; case "safe": case "acknowledged": return WriteConcern.ACKNOWLEDGED; case "normal": case "unacknowledged": return WriteConcern.UNACKNOWLEDGED; case "fsync_safe": case "fsyncsafe": case "fsynced": return WriteConcern.FSYNCED; case "journal_safe": case "journalsafe": case "journaled": return WriteConcern.JOURNALED; case "replicas_safe": case "replicassafe": case "replica_acknowledged": case "replicaacknowledged": return WriteConcern.REPLICA_ACKNOWLEDGED; case "majority": return WriteConcern.MAJORITY; default: logger.warning(String.format("%s writeTo concern not valid - using UNACKNOWLEDGED", config)); return WriteConcern.UNACKNOWLEDGED; } }
From source file:parser.mongodbContoller.java
public void add_page_data(pageData PageData) { try {/* w w w .ja v a 2 s . com*/ DB PageDataDB = MongoDbClient.getDB(PageDataDBName); if (!PageDataDB.collectionExists(PageDataCollectionName)) { DBObject DBOptions = BasicDBObjectBuilder.start().get(); PageDataDB.createCollection(PageDataCollectionName, DBOptions); } BasicDBObject PageDataDocument = new BasicDBObject(); //adds page url PageDataDocument.append("Web_Url", PageData.getPageUrl()); //adds page description if (PageData.getPageDescription() != null) { PageDataDocument.append("Page_Description", PageData.getPageDescription()); } //adds keyword frequencies if (PageData.get_keyword_frequencies_map() != null) { PageDataDocument.append("Keywords", new BasicDBObject(PageData.get_keyword_frequencies_map())); } //adds term frequencies if (PageData.get_term_frequencies_map() != null) { PageDataDocument.append("Terms", new BasicDBObject(PageData.get_term_frequencies_map())); } System.out.println("Inserting; \n " + PageDataDocument.toString()); System.out.println("Inserted " + PageDataDB.getCollection(PageDataCollectionName) .insert(PageDataDocument, WriteConcern.FSYNCED).getN() + " Documents"); System.out.println("Last error:\n" + PageDataDB.getLastError()); } catch (Exception e) { e.printStackTrace(); } }
From source file:pubsub.broker.model.Publisher.java
@Override public void save() { DBCollection packageColl = db.getCollection(DBConstants.PUBLISHER_COLLECTION); BasicDBObject query = new BasicDBObject(); query.put(DBConstants.PUBLISHER_EMAIL, this.email); packageColl.update(query, this, true, false, WriteConcern.FSYNCED); }
From source file:pubsub.broker.model.Publisher.java
public void addTopic(String title) { DBCollection coll = db.getCollection(DBConstants.TOPIC_COLLECTION); BasicDBObject query = new BasicDBObject(); query.put(DBConstants.TOPIC_TOPIC, title); query.put(DBConstants.TOPIC_EMAIL_LIST, new ArrayList<String>()); query.put(DBConstants.TOPIC_HOST_LIST, new ArrayList<String>()); coll.insert(query, WriteConcern.FSYNCED); }
From source file:rtpmt.models.Config.java
public void save() { DBCollection packageColl = db.getCollection(DBConstants.CONFIG_COLLECTION); BasicDBObject query = new BasicDBObject(); query.put(DBConstants.SENSOR_ID, this.get(DBConstants.SENSOR_ID)); query.put(DBConstants.TRUCK_ID, this.get(DBConstants.TRUCK_ID)); query.put(DBConstants.PACKAGE_ID, this.get(DBConstants.PACKAGE_ID)); //query.put(DBConstants.TIMESTAMP, this.get(DBConstants.TIMESTAMP)); packageColl.update(query, this, true, false, WriteConcern.FSYNCED); }