EclipseLink 2.2.0, build 'v20110202-r8913' API Reference

org.eclipse.persistence.descriptors.partitioning
Class HashPartitioningPolicy

java.lang.Object
  extended by org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy
      extended by org.eclipse.persistence.descriptors.partitioning.FieldPartitioningPolicy
          extended by org.eclipse.persistence.descriptors.partitioning.HashPartitioningPolicy
All Implemented Interfaces:
java.io.Serializable

public class HashPartitioningPolicy
extends FieldPartitioningPolicy

PUBLIC: HashPartitioningPolicy partitions access to a database cluster by the hash of a field value from the object, such as the object's location, or tenant. The hash indexes into the list of connection pools. All write or read request for object's with that hash value are sent to the server. If a query does not include the field as a parameter, then it can either be sent to all server's and unioned, or left to the sesion's default behavior.

See Also:
Serialized Form
Author:
James Sutherland
Since:
EclipseLink 2.2

Field Summary
protected  java.util.List<java.lang.String> connectionPools
           
 
Fields inherited from class org.eclipse.persistence.descriptors.partitioning.FieldPartitioningPolicy
partitionField, unionUnpartitionableQueries
 
Fields inherited from class org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy
name
 
Constructor Summary
HashPartitioningPolicy()
           
HashPartitioningPolicy(java.lang.String partitionField)
           
HashPartitioningPolicy(java.lang.String partitionField, boolean unionUnpartitionableQueries)
           
 
Method Summary
 void addConnectionPool(java.lang.String connectionPool)
          PUBLIC: Add the connection pool name to the list of pools to rotate queries through.
 java.util.List<java.lang.String> getConnectionPools()
          PUBLIC: Return the list of connection pool names to replicate queries to.
 java.util.List<org.eclipse.persistence.internal.databaseaccess.Accessor> getConnectionsForQuery(org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord arguments)
          INTERNAL: Get a connection from one of the pools in a round robin rotation fashion.
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Default the connection pools to all pools if unset.
 void setConnectionPools(java.util.List<java.lang.String> connectionPools)
          PUBLIC: Set the list of connection pool names to replicate queries to.
 
Methods inherited from class org.eclipse.persistence.descriptors.partitioning.FieldPartitioningPolicy
getPartitionField, getPartitionFieldName, getUnionUnpartitionableQueries, setPartitionField, setPartitionField, setUnionUnpartitionableQueries
 
Methods inherited from class org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy
acquireAccessor, convertClassNamesToClasses, getAccessor, getName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connectionPools

protected java.util.List<java.lang.String> connectionPools
Constructor Detail

HashPartitioningPolicy

public HashPartitioningPolicy()

HashPartitioningPolicy

public HashPartitioningPolicy(java.lang.String partitionField)

HashPartitioningPolicy

public HashPartitioningPolicy(java.lang.String partitionField,
                              boolean unionUnpartitionableQueries)
Method Detail

initialize

public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Default the connection pools to all pools if unset.

Overrides:
initialize in class PartitioningPolicy

getConnectionPools

public java.util.List<java.lang.String> getConnectionPools()
PUBLIC: Return the list of connection pool names to replicate queries to.


setConnectionPools

public void setConnectionPools(java.util.List<java.lang.String> connectionPools)
PUBLIC: Set the list of connection pool names to replicate queries to. A connection pool with the same name must be defined on the ServerSession.


addConnectionPool

public void addConnectionPool(java.lang.String connectionPool)
PUBLIC: Add the connection pool name to the list of pools to rotate queries through.


getConnectionsForQuery

public java.util.List<org.eclipse.persistence.internal.databaseaccess.Accessor> getConnectionsForQuery(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                                                       DatabaseQuery query,
                                                                                                       org.eclipse.persistence.internal.sessions.AbstractRecord arguments)
INTERNAL: Get a connection from one of the pools in a round robin rotation fashion.

Specified by:
getConnectionsForQuery in class PartitioningPolicy

EclipseLink 2.2.0, build 'v20110202-r8913' API Reference