com.google.appengine.api.datastore
Class DatastoreServiceConfig

java.lang.Object
  extended by com.google.appengine.api.datastore.DatastoreServiceConfig

public final class DatastoreServiceConfig
extends java.lang.Object

User-configurable properties of the datastore. Notes on usage:
The recommended way to instantiate a DatastoreServiceConfig object is to statically import DatastoreServiceConfig.Builder.* and invoke a static creation method followed by an instance mutator (if needed):

 import static com.google.appengine.api.datastore.DatastoreServiceConfig.Builder.*;
 import com.google.appengine.api.datastore.ReadPolicy.Consistency;

 ...

 // eventually consistent reads
 DatastoreServiceConfig config = withReadPolicy(new ReadPolicy(Consistency.EVENTUAL));

 // eventually consistent reads with a 5 second deadline
 DatastoreServiceConfig config =
   withReadPolicy(new ReadPolicy(Consistency.EVENTUAL)).deadline(5.0);
 


Nested Class Summary
static class DatastoreServiceConfig.Builder
          Contains static creation methods for DatastoreServiceConfig.
 
Method Summary
 DatastoreServiceConfig deadline(double deadline)
          Sets the deadline, in seconds, for all rpcs initiated by the DatastoreService with which this config is associated.
 java.lang.Double getDeadline()
           
 ImplicitTransactionManagementPolicy getImplicitTransactionManagementPolicy()
           
 java.lang.Integer getMaxEntityGroupsPerRpc()
           
 ReadPolicy getReadPolicy()
           
 DatastoreServiceConfig implicitTransactionManagementPolicy(ImplicitTransactionManagementPolicy p)
          Sets the implicit transaction management policy.
 DatastoreServiceConfig maxEntityGroupsPerRpc(int maxEntityGroupsPerRpc)
          Sets the maximum number of entity groups that can be represented in a single rpc.
 DatastoreServiceConfig readPolicy(ReadPolicy readPolicy)
          Sets the read policy.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

implicitTransactionManagementPolicy

public DatastoreServiceConfig implicitTransactionManagementPolicy(ImplicitTransactionManagementPolicy p)
Sets the implicit transaction management policy.

Parameters:
p - the implicit transaction management policy to set.
Returns:
this (for chaining)

readPolicy

public DatastoreServiceConfig readPolicy(ReadPolicy readPolicy)
Sets the read policy.

Parameters:
readPolicy - the read policy to set.
Returns:
this (for chaining)

deadline

public DatastoreServiceConfig deadline(double deadline)
Sets the deadline, in seconds, for all rpcs initiated by the DatastoreService with which this config is associated.

Parameters:
deadline - the deadline to set.
Returns:
this (for chaining)
Throws:
java.lang.IllegalArgumentException - if deadline is not positive

maxEntityGroupsPerRpc

public DatastoreServiceConfig maxEntityGroupsPerRpc(int maxEntityGroupsPerRpc)
Sets the maximum number of entity groups that can be represented in a single rpc. For a non-transactional operation that involves more entity groups than the maximum, the operation will be performed by executing multiple, asynchronous rpcs to the datastore, each of which has no more entity groups represented than the maximum. So, if a put() operation has 8 entity groups and the maximum is 3, we will send 3 rpcs, 2 with 3 entity groups and 1 with 2 entity groups. This is a performance optimization - in many cases multiple, small, asynchronous rpcs will finish faster than a single large asynchronous rpc. The optimal value for this property will be application-specific, so experimentation is encouraged.

Parameters:
maxEntityGroupsPerRpc - the maximum number of entity groups per rpc
Returns:
this (for chaining)
Throws:
java.lang.IllegalArgumentException - if maxEntityGroupsPerRpc is not greater than zero

getImplicitTransactionManagementPolicy

public ImplicitTransactionManagementPolicy getImplicitTransactionManagementPolicy()
Returns:
The ImplicitTransactionManagementPolicy to use.

getReadPolicy

public ReadPolicy getReadPolicy()
Returns:
The ReadPolicy to use.

getMaxEntityGroupsPerRpc

public java.lang.Integer getMaxEntityGroupsPerRpc()
Returns:
The maximum number of entity groups per rpc.

getDeadline

public java.lang.Double getDeadline()
Returns:
The deadline to use. Can be null.