当前位置: 首页>>代码示例>>Java>>正文


Java WriteConcern.UNACKNOWLEDGED属性代码示例

本文整理汇总了Java中com.mongodb.WriteConcern.UNACKNOWLEDGED属性的典型用法代码示例。如果您正苦于以下问题:Java WriteConcern.UNACKNOWLEDGED属性的具体用法?Java WriteConcern.UNACKNOWLEDGED怎么用?Java WriteConcern.UNACKNOWLEDGED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.mongodb.WriteConcern的用法示例。


在下文中一共展示了WriteConcern.UNACKNOWLEDGED属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeConcern

/**
 * Prepares {@link WriteConcern} from given {@link WriteConcernEnum}
 *
 * @param writeConcernEnum  write concern provided in config.
 * @return  write concern for mongo client option.
 */
public static WriteConcern writeConcern(WriteConcernEnum writeConcernEnum) {
    switch (writeConcernEnum) {
        case MAJORITY:
            return WriteConcern.MAJORITY;

        case JOURNALED:
            return WriteConcern.JOURNALED;

        case ACKNOWLEDGED:
            return WriteConcern.ACKNOWLEDGED;

        case UNACKNOWLEDGED:
            return WriteConcern.UNACKNOWLEDGED;

        default:
            return null;
    }
}
 
开发者ID:AdeptJ,项目名称:adeptj-modules,代码行数:24,代码来源:Utils.java

示例2: determineWriteConcern

private WriteConcern determineWriteConcern(String label) {
    switch (label.toLowerCase()) {
        case "acknowledged":
            return WriteConcern.ACKNOWLEDGED;
        case "unacknowledged":
            return WriteConcern.UNACKNOWLEDGED;
        case "journaled":
            return WriteConcern.JOURNALED;
        case "majority":
            return WriteConcern.MAJORITY;
        default:
            return WriteConcern.ACKNOWLEDGED;
    }
}
 
开发者ID:Asymmetrik,项目名称:nifi-nars,代码行数:14,代码来源:AbstractMongoProcessor.java

示例3: toWriteConcern

public WriteConcern toWriteConcern(Object obj, WriteConcern defaultValue) {
	if(obj instanceof WriteConcern) return (WriteConcern) obj;
	if(decision.isSimpleValue(obj)) {
		String str = caster.toString(obj,"");
		str=str.trim().toUpperCase();
		if("ACKNOWLEDGED".equals(str))
			return WriteConcern.ACKNOWLEDGED;
		else if("ACKNOWLEDGED".equals(str))
			return WriteConcern.FSYNC_SAFE;
		else if("FSYNC_SAFE".equals(str) || "FSYNCSAFE".equals(str))
			return WriteConcern.FSYNCED;
		else if("JOURNAL_SAFE".equals(str) || "JOURNALSAFE".equals(str))
			return WriteConcern.JOURNAL_SAFE;
		else if("JOURNALED".equals(str))
			return WriteConcern.JOURNALED;
		else if("MAJORITY".equals(str))
			return WriteConcern.MAJORITY;
		else if("NORMAL".equals(str))
			return WriteConcern.NORMAL;
		else if("REPLICA_ACKNOWLEDGED".equals(str) || "REPLICAACKNOWLEDGED".equals(str))
			return WriteConcern.REPLICA_ACKNOWLEDGED;
		else if("REPLICAS_SAFE".equals(str) || "REPLICASSAFE".equals(str))
			return WriteConcern.REPLICAS_SAFE;
		else if("SAFE".equals(str))
			return WriteConcern.SAFE;
		else if("UNACKNOWLEDGED".equals(str))
			return WriteConcern.UNACKNOWLEDGED;
	}
	return defaultValue;
}
 
开发者ID:lucee,项目名称:extension-mongodb,代码行数:30,代码来源:ObjectSupport.java

示例4: getWriteConcern

@SuppressWarnings("deprecation")
private WriteConcern getWriteConcern(String writeConcern) {
	if ("ACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.ACKNOWLEDGED;
	}
	if ("W1".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W1;
	}
	if ("W2".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W2;
	}
	if ("W3".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W3;
	}
	if ("UNACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.UNACKNOWLEDGED;
	}
	if ("FSYNCED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.FSYNCED;
	}
	if ("REPLICA_ACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.REPLICA_ACKNOWLEDGED;
	}
	if ("NORMAL".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.NORMAL;
	}
	if ("SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.SAFE;
	}
	if ("MAJORITY".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.MAJORITY;
	}
	if ("FSYNC_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.FSYNC_SAFE;
	}
	if ("JOURNAL_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.JOURNAL_SAFE;
	}
	if ("REPLICAS_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.REPLICAS_SAFE;
	}
	return WriteConcern.ACKNOWLEDGED;
}
 
开发者ID:xsonorg,项目名称:tangyuan2,代码行数:43,代码来源:DefaultDataSourceCreater.java

示例5: loadConfiguration

private void loadConfiguration()
    throws UnknownHostException
{
    configuration.refresh();
    MongoDBEntityStoreConfiguration config = configuration.get();

    // Combine hostname, port and nodes configuration properties
    // If no configuration, use 127.0.0.1:27017
    serverAddresses = new ArrayList<>();
    int port = config.port().get() == null ? 27017 : config.port().get();
    List<String> nodes = config.nodes().get();
    if( nodes.isEmpty() )
    {
        String hostname = config.hostname().get() == null ? "127.0.0.1" : config.hostname().get();
        serverAddresses.add( new ServerAddress( hostname, port ) );
    }
    else
    {
        if( config.hostname().get() != null && !config.hostname().get().isEmpty() )
        {
            serverAddresses.add( new ServerAddress( config.hostname().get(), port ) );
        }
        serverAddresses.addAll( nodes.stream()
                                     .map( this::parseNode )
                                     .collect( toList() )
                              );
    }

    // If database name not configured, set it to polygene:entitystore
    databaseName = config.database().get();
    if( databaseName == null )
    {
        databaseName = DEFAULT_DATABASE_NAME;
    }

    // If collection name not configured, set it to polygene: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 W1:
        writeConcern = WriteConcern.W1;
        break;
    case W2:
        writeConcern = WriteConcern.W2;
        break;
    case W3:
        writeConcern = WriteConcern.W3;
        break;
    case UNACKNOWLEDGED:
        writeConcern = WriteConcern.UNACKNOWLEDGED;
        break;
    case JOURNALED:
        writeConcern = WriteConcern.JOURNALED;
        break;
    case MAJORITY:
        writeConcern = WriteConcern.MAJORITY;
        break;
    case ACKNOWLEDGED:
    default:
        writeConcern = WriteConcern.ACKNOWLEDGED;
    }

    // Username and password are defaulted to empty strings
    username = config.username().get();
    password = config.password().get().toCharArray();
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:72,代码来源:MongoDBEntityStoreMixin.java


注:本文中的com.mongodb.WriteConcern.UNACKNOWLEDGED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。