Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.ReadPolicy


  }

  @Override
  public ObjectStoreSession beginSession()
  {
    return beginSession(DatastoreServiceConfig.Builder.withReadPolicy(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL)));
  }
View Full Code Here


    pmf = JDOHelper.getPersistenceManagerFactory(props, getPersistenceManagerFactoryName().name());
    pm = pmf.getPersistenceManager();
    DatastoreManager storeMgr = (DatastoreManager) getExecutionContext().getStoreManager();
    DatastoreServiceConfig config = storeMgr.getDefaultDatastoreServiceConfigForReads();
    assertEquals(.334d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
    config = storeMgr.getDefaultDatastoreServiceConfigForWrites();
    assertEquals(.335d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
  }
View Full Code Here

    pmf = JDOHelper.getPersistenceManagerFactory(props, getPersistenceManagerFactoryName().name());
    pm = pmf.getPersistenceManager();
    DatastoreManager storeMgr = (DatastoreManager) getExecutionContext().getStoreManager();
    DatastoreServiceConfig config = storeMgr.getDefaultDatastoreServiceConfigForReads();
    assertEquals(.334d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
    config = storeMgr.getDefaultDatastoreServiceConfigForWrites();
    assertEquals(.335d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
  }
View Full Code Here

    pmf = JDOHelper.getPersistenceManagerFactory("datastoreserviceconfigprops");
    pm = pmf.getPersistenceManager();
    DatastoreManager storeMgr = (DatastoreManager) getExecutionContext().getStoreManager();
    DatastoreServiceConfig config = storeMgr.getDefaultDatastoreServiceConfigForReads();
    assertEquals(5.0d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
    config = storeMgr.getDefaultDatastoreServiceConfigForWrites();
    assertEquals(10.0d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
    pm.close();
    pmf.close();
  }
View Full Code Here

      // config wants the timeout in seconds
      config.deadline(query.getDatastoreReadTimeoutMillis() / 1000);
    }
    Map extensions = query.getExtensions();
    if (extensions != null && extensions.get(DatastoreManager.DATASTORE_READ_CONSISTENCY_PROPERTY) != null) {
      config.readPolicy(new ReadPolicy(
          ReadPolicy.Consistency.valueOf((String) extensions.get(DatastoreManager.DATASTORE_READ_CONSISTENCY_PROPERTY))));
    }
    DatastoreService ds = DatastoreServiceFactoryInternal.getDatastoreService(config);

    // Execute the most appropriate type of query
View Full Code Here

    }
    String defaultReadConsistencyStr = persistenceConfiguration.getStringProperty(
        DATASTORE_READ_CONSISTENCY_PROPERTY);
    if (defaultReadConsistencyStr != null) {
      try {
        datastoreServiceConfig.readPolicy(new ReadPolicy(Consistency.valueOf(defaultReadConsistencyStr)));
      } catch (IllegalArgumentException iae) {
        throw new NucleusFatalUserException(
            "Illegal value for " + DATASTORE_READ_CONSISTENCY_PROPERTY +
            ".  Valid values are " + Arrays.toString(Consistency.values()));
      }
View Full Code Here

    emf = Persistence.createEntityManagerFactory(getEntityManagerFactoryName().name(), props);
    em = emf.createEntityManager();
    DatastoreManager storeMgr = (DatastoreManager) getExecutionContext().getStoreManager();
    DatastoreServiceConfig config = storeMgr.getDefaultDatastoreServiceConfigForReads();
    assertEquals(.334d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
    config = storeMgr.getDefaultDatastoreServiceConfigForWrites();
    assertEquals(.335d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
  }
View Full Code Here

    emf = Persistence.createEntityManagerFactory("datastoreserviceconfigprops");
    em = emf.createEntityManager();
    DatastoreManager storeMgr = (DatastoreManager) getExecutionContext().getStoreManager();
    DatastoreServiceConfig config = storeMgr.getDefaultDatastoreServiceConfigForReads();
    assertEquals(5.0d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
    config = storeMgr.getDefaultDatastoreServiceConfigForWrites();
    assertEquals(10.0d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
    em.close();
    emf.close();
  }
View Full Code Here

    }
    String defaultReadConsistencyStr = persistenceConfiguration.getStringProperty(
        DATASTORE_READ_CONSISTENCY_PROPERTY);
    if (defaultReadConsistencyStr != null) {
      try {
        datastoreServiceConfig.readPolicy(new ReadPolicy(Consistency.valueOf(defaultReadConsistencyStr)));
      } catch (IllegalArgumentException iae) {
        throw new FatalNucleusUserException(
            "Illegal value for " + DATASTORE_READ_CONSISTENCY_PROPERTY +
            ".  Valid values are " + Arrays.toString(Consistency.values()));
      }
View Full Code Here

    }
    String defaultReadConsistencyStr = persistenceConfiguration.getStringProperty(
        DATASTORE_READ_CONSISTENCY_PROPERTY);
    if (defaultReadConsistencyStr != null) {
      try {
        datastoreServiceConfig.readPolicy(new ReadPolicy(Consistency.valueOf(defaultReadConsistencyStr)));
      } catch (IllegalArgumentException iae) {
        throw new FatalNucleusUserException(
            "Illegal value for " + DATASTORE_READ_CONSISTENCY_PROPERTY +
            ".  Valid values are " + Arrays.toString(Consistency.values()));
      }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.ReadPolicy

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.