List of usage examples for com.mongodb WriteConcern NORMAL
WriteConcern NORMAL
To view the source code for com.mongodb WriteConcern NORMAL.
Click Source Link
Write operations that use this write concern will return as soon as the message is written to the socket.
From source file:org.qi4j.entitystore.mongodb.MongoMapEntityStoreMixin.java
License:Apache License
private void loadConfiguration() throws UnknownHostException { configuration.refresh();// w ww. j a v a 2 s. co m MongoEntityStoreConfiguration config = configuration.get(); // Combine hostname, port and nodes configuration properties serverAddresses = new ArrayList<ServerAddress>(); if (config.hostname().get() != null && !config.hostname().get().isEmpty()) { serverAddresses.add(new ServerAddress(config.hostname().get(), config.port().get())); } serverAddresses.addAll(config.nodes().get()); // If database name not configured, set it to qi4j:entitystore databaseName = config.database().get(); if (databaseName == null) { databaseName = DEFAULT_DATABASE_NAME; } // If collection name not configured, set it to qi4j:entitystore:entities collectionName = config.collection().get(); if (collectionName == null) { collectionName = DEFAULT_COLLECTION_NAME; } // If write concern not configured, set it to normal switch (config.writeConcern().get()) { case FSYNC_SAFE: writeConcern = WriteConcern.FSYNC_SAFE; break; case JOURNAL_SAFE: writeConcern = WriteConcern.JOURNAL_SAFE; break; case MAJORITY: writeConcern = WriteConcern.MAJORITY; break; case NONE: writeConcern = WriteConcern.NONE; break; case REPLICAS_SAFE: writeConcern = WriteConcern.REPLICAS_SAFE; break; case SAFE: writeConcern = WriteConcern.SAFE; break; case NORMAL: default: writeConcern = WriteConcern.NORMAL; } // Username and password are defaulted to empty strings username = config.username().get(); password = config.password().get().toCharArray(); }
From source file:org.slc.sli.ingestion.model.da.BatchJobWriteConcernResolver.java
License:Apache License
@Override public WriteConcern resolve(MongoAction action) { Class<?> entityClass = action.getEntityClass(); if (entityClass != null && "Error".equals(entityClass.getSimpleName())) { return WriteConcern.NORMAL; }//from w w w . j a v a2 s .c om return WriteConcern.SAFE; }