Search in sources :

Example 1 with Quorum

use of com.basho.riak.client.api.cap.Quorum in project YCSB by brianfrankcooper.

the class RiakKVClient method loadDefaultProperties.

private void loadDefaultProperties() {
    InputStream propFile = RiakKVClient.class.getClassLoader().getResourceAsStream("riak.properties");
    Properties propsPF = new Properties(System.getProperties());
    try {
        propsPF.load(propFile);
    } catch (IOException e) {
        e.printStackTrace();
    }
    hosts = propsPF.getProperty(HOST_PROPERTY).split(",");
    port = Integer.parseInt(propsPF.getProperty(PORT_PROPERTY));
    bucketType = propsPF.getProperty(BUCKET_TYPE_PROPERTY);
    rvalue = new Quorum(Integer.parseInt(propsPF.getProperty(R_VALUE_PROPERTY)));
    wvalue = new Quorum(Integer.parseInt(propsPF.getProperty(W_VALUE_PROPERTY)));
    readRetryCount = Integer.parseInt(propsPF.getProperty(READ_RETRY_COUNT_PROPERTY));
    waitTimeBeforeRetry = Integer.parseInt(propsPF.getProperty(WAIT_TIME_BEFORE_RETRY_PROPERTY));
    transactionTimeLimit = Integer.parseInt(propsPF.getProperty(TRANSACTION_TIME_LIMIT_PROPERTY));
    strongConsistency = Boolean.parseBoolean(propsPF.getProperty(STRONG_CONSISTENCY_PROPERTY));
    strongConsistentScansBucketType = propsPF.getProperty(STRONG_CONSISTENT_SCANS_BUCKET_TYPE_PROPERTY);
    debug = Boolean.parseBoolean(propsPF.getProperty(DEBUG_PROPERTY));
}
Also used : Quorum(com.basho.riak.client.api.cap.Quorum) InputStream(java.io.InputStream) IOException(java.io.IOException) StoreBucketProperties(com.basho.riak.client.api.commands.buckets.StoreBucketProperties)

Example 2 with Quorum

use of com.basho.riak.client.api.cap.Quorum in project YCSB by brianfrankcooper.

the class RiakKVClient method loadProperties.

private void loadProperties() {
    // First, load the default properties...
    loadDefaultProperties();
    // ...then, check for some props set at command line!
    Properties props = getProperties();
    String portString = props.getProperty(PORT_PROPERTY);
    if (portString != null) {
        port = Integer.parseInt(portString);
    }
    String hostsString = props.getProperty(HOST_PROPERTY);
    if (hostsString != null) {
        hosts = hostsString.split(",");
    }
    String bucketTypeString = props.getProperty(BUCKET_TYPE_PROPERTY);
    if (bucketTypeString != null) {
        bucketType = bucketTypeString;
    }
    String rValueString = props.getProperty(R_VALUE_PROPERTY);
    if (rValueString != null) {
        rvalue = new Quorum(Integer.parseInt(rValueString));
    }
    String wValueString = props.getProperty(W_VALUE_PROPERTY);
    if (wValueString != null) {
        wvalue = new Quorum(Integer.parseInt(wValueString));
    }
    String readRetryCountString = props.getProperty(READ_RETRY_COUNT_PROPERTY);
    if (readRetryCountString != null) {
        readRetryCount = Integer.parseInt(readRetryCountString);
    }
    String waitTimeBeforeRetryString = props.getProperty(WAIT_TIME_BEFORE_RETRY_PROPERTY);
    if (waitTimeBeforeRetryString != null) {
        waitTimeBeforeRetry = Integer.parseInt(waitTimeBeforeRetryString);
    }
    String transactionTimeLimitString = props.getProperty(TRANSACTION_TIME_LIMIT_PROPERTY);
    if (transactionTimeLimitString != null) {
        transactionTimeLimit = Integer.parseInt(transactionTimeLimitString);
    }
    String strongConsistencyString = props.getProperty(STRONG_CONSISTENCY_PROPERTY);
    if (strongConsistencyString != null) {
        strongConsistency = Boolean.parseBoolean(strongConsistencyString);
    }
    String strongConsistentScansBucketTypeString = props.getProperty(STRONG_CONSISTENT_SCANS_BUCKET_TYPE_PROPERTY);
    if (strongConsistentScansBucketTypeString != null) {
        strongConsistentScansBucketType = strongConsistentScansBucketTypeString;
    }
    String debugString = props.getProperty(DEBUG_PROPERTY);
    if (debugString != null) {
        debug = Boolean.parseBoolean(debugString);
    }
}
Also used : Quorum(com.basho.riak.client.api.cap.Quorum) StoreBucketProperties(com.basho.riak.client.api.commands.buckets.StoreBucketProperties)

Aggregations

Quorum (com.basho.riak.client.api.cap.Quorum)2 StoreBucketProperties (com.basho.riak.client.api.commands.buckets.StoreBucketProperties)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1