Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

E28847-01


org.eclipse.persistence.descriptors.partitioning
Class RoundRobinPartitioningPolicy

java.lang.Object
  extended by org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy
      extended by org.eclipse.persistence.descriptors.partitioning.ReplicationPartitioningPolicy
          extended by 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.

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

Field Summary
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
RoundRobinPartitioningPolicy()
           
RoundRobinPartitioningPolicy(boolean replicateWrites)
           
RoundRobinPartitioningPolicy(java.util.List<java.lang.String> pools)
           
RoundRobinPartitioningPolicy(java.lang.String... pools)
           

 

Method Summary
 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

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

currentIndex

protected volatile int currentIndex

replicateWrites

protected boolean replicateWrites

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 class ReplicationPartitioningPolicy

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.

Skip navigation links

Copyright © 1998, 2012, Oracle. All Rights Reserved.