Package oracle.kv

Examples of oracle.kv.KVStoreConfig


   
    /* Mandatory properties */
    String storeName = properties.getProperty("storeName", "kvstore");
    String[] helperHosts = properties.getProperty("helperHost", "localhost:5000").split(",");
   
    KVStoreConfig config = new KVStoreConfig(storeName, helperHosts);
   
    /* Optional properties */
    String p;
   
    p = properties.getProperty("consistency");
    if (p != null) {
      if (p.equalsIgnoreCase("ABSOLUTE")) {
        config.setConsistency(Consistency.ABSOLUTE);
      } else if (p.equalsIgnoreCase("NONE_REQUIRED")) {
        config.setConsistency(Consistency.NONE_REQUIRED);
      } else {
        throw new DBException("Illegal value in consistency property");
      }
    }
   
    p = properties.getProperty("durability");
    if (p != null) {
      if (p.equalsIgnoreCase("COMMIT_NO_SYNC")) {
        config.setDurability(Durability.COMMIT_NO_SYNC);
      } else if (p.equalsIgnoreCase("COMMIT_SYNC")) {
        config.setDurability(Durability.COMMIT_SYNC);
      } else if (p.equalsIgnoreCase("COMMIT_WRITE_NO_SYNC")) {
        config.setDurability(Durability.COMMIT_WRITE_NO_SYNC);
      } else {
        throw new DBException("Illegal value in durability property");
      }
    }
   
    int maxActiveRequests = getPropertyInt(properties,
        "requestLimit.maxActiveRequests", RequestLimitConfig.DEFAULT_MAX_ACTIVE_REQUESTS);
    int requestThresholdPercent = getPropertyInt(properties,
        "requestLimit.requestThresholdPercent", RequestLimitConfig.DEFAULT_REQUEST_THRESHOLD_PERCENT);
    int nodeLimitPercent = getPropertyInt(properties,
        "requestLimit.nodeLimitPercent", RequestLimitConfig.DEFAULT_NODE_LIMIT_PERCENT);
    RequestLimitConfig requestLimitConfig;
    /* It is said that the constructor could throw NodeRequestLimitException in Javadoc, the exception is not provided */
//    try {
      requestLimitConfig = new RequestLimitConfig(maxActiveRequests, requestThresholdPercent, nodeLimitPercent);
//    } catch (NodeRequestLimitException e) {
//      throw new DBException(e);
//    }
    config.setRequestLimit(requestLimitConfig);

    p = properties.getProperty("requestTimeout");
    if (p != null) {
      long timeout = 1;
      try {
        timeout = Long.parseLong(p);
      } catch (NumberFormatException e) {
        throw new DBException("Illegal number format in requestTimeout property");
      }
      try {
        // TODO Support other TimeUnit
        config.setRequestTimeout(timeout, TimeUnit.SECONDS);
      } catch (IllegalArgumentException e) {
        throw new DBException(e);
      }
    }
   
View Full Code Here


    private KVStore store;

    @PostConstruct
    private void initDB() {
        // bootstrap
        store = KVStoreFactory.getStore(new KVStoreConfig("kvstore", "localhost:5000"));
    }
View Full Code Here

        }
        if (poolSize == null)
        {
            poolSize = props.getProperty(PersistenceProperties.KUNDERA_POOL_SIZE_MAX_ACTIVE);
        }
        return KVStoreFactory.getStore(new KVStoreConfig(storeName, hostName + ":" + defaultPort));
    }
View Full Code Here

       graphKeyString = graphName;
       storestring = storeName;
       hostname = hostName;
       try {
           store = KVStoreFactory.getStore
               (new KVStoreConfig(storestring, hostName + ":" + hostPort));
              
       } catch (Exception e) {
               throw new RuntimeException(KVGraph.NOSQLDB_ERROR_EXCEPTION_MESSAGE);
       }
    }
View Full Code Here

TOP

Related Classes of oracle.kv.KVStoreConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.