Class RoundRobinPartitioningPolicy
- java.lang.Object
-
- org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy
-
- org.eclipse.persistence.descriptors.partitioning.ReplicationPartitioningPolicy
-
- org.eclipse.persistence.descriptors.partitioning.RoundRobinPartitioningPolicy
-
- All Implemented Interfaces:
java.io.Serializable
public class RoundRobinPartitioningPolicy extends ReplicationPartitioningPolicy
PUBLIC: RoundRobinPartitioningPolicy sends requests in a round robin fashion to the set of connection pools. It is for load-balancing read queries across a cluster of database machines. It requires that the full database be replicated on each machine, so does not support partitioning. The data should either be read-only, or writes should be replicated on the database.- See Also:
- Serialized Form
- Author:
- James Sutherland
- Since:
- EclipseLink 2.2
-
-
Field Summary
Fields Modifier and Type Field Description protected int
currentIndex
protected boolean
replicateWrites
-
Fields inherited from class org.eclipse.persistence.descriptors.partitioning.ReplicationPartitioningPolicy
connectionPools
-
Fields inherited from class org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy
name
-
-
Constructor Summary
Constructors Constructor Description RoundRobinPartitioningPolicy()
RoundRobinPartitioningPolicy(boolean replicateWrites)
RoundRobinPartitioningPolicy(java.lang.String... pools)
RoundRobinPartitioningPolicy(java.util.List<java.lang.String> pools)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.boolean
getReplicateWrites()
PUBLIC: Return if write queries should be replicated.org.eclipse.persistence.internal.databaseaccess.Accessor
nextAccessor(ServerSession session, DatabaseQuery query)
INTERNAL: Return the next connection accessor.int
nextIndex()
INTERNAL: Return the next pool index to use.void
setReplicateWrites(boolean replicateWrites)
PUBLIC: Set if write queries should be replicated.-
Methods inherited from class org.eclipse.persistence.descriptors.partitioning.ReplicationPartitioningPolicy
addConnectionPool, getConnectionPools, initialize, setConnectionPools
-
Methods inherited from class org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy
acquireAccessor, convertClassNamesToClasses, getAccessor, getName, partitionPersist, setName
-
-
-
-
Constructor Detail
-
RoundRobinPartitioningPolicy
public RoundRobinPartitioningPolicy()
-
RoundRobinPartitioningPolicy
public RoundRobinPartitioningPolicy(boolean replicateWrites)
-
RoundRobinPartitioningPolicy
public RoundRobinPartitioningPolicy(java.lang.String... pools)
-
RoundRobinPartitioningPolicy
public RoundRobinPartitioningPolicy(java.util.List<java.lang.String> pools)
-
-
Method Detail
-
getReplicateWrites
public boolean getReplicateWrites()
PUBLIC: Return if write queries should be replicated. This allows for a set of database to be written to and kept in synch, and have reads load-balanced across the databases.
-
setReplicateWrites
public void setReplicateWrites(boolean replicateWrites)
PUBLIC: Set if write queries should be replicated. This allows for a set of database to be written to and kept in synch, and have reads load-balanced across the databases.
-
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.- Overrides:
getConnectionsForQuery
in classReplicationPartitioningPolicy
-
nextIndex
public int nextIndex()
INTERNAL: Return the next pool index to use.
-
nextAccessor
public org.eclipse.persistence.internal.databaseaccess.Accessor nextAccessor(ServerSession session, DatabaseQuery query)
INTERNAL: Return the next connection accessor.
-
-