org.apache.avalon.excalibur.datasource.cluster
Interface HashedDataSourceCluster

All Superinterfaces:
Component, Configurable, DataSourceComponent, ThreadSafe
All Known Implementing Classes:
DefaultHashedDataSourceCluster

public interface HashedDataSourceCluster
extends DataSourceComponent

Since:
4.1
Version:
CVS $Revision: 1.4 $ $Date: 2003/02/27 15:20:56 $
Author:
Leif Mortenson

Field Summary
static String ROLE
          The name of the role for convenience
 
Method Summary
 int getClusterSize()
          Returns the number of DataSources in the cluster.
 Connection getConnectionForHashCode(int hashCode)
          Gets a Connection to a database given a hash code.
 Connection getConnectionForHashObject(Object hashObject)
          Gets a Connection to a database given a hash object.
 Connection getConnectionForIndex(int index)
          Gets a Connection to a database given an index.
 int getIndexForHashCode(int hashCode)
          Gets the index which will be resolved for a given hashCode.
 int getIndexForHashObject(Object hashObject)
          Gets the index which will be resolved for a given hashCode.
 
Methods inherited from interface org.apache.avalon.excalibur.datasource.DataSourceComponent
getConnection
 
Methods inherited from interface org.apache.avalon.framework.configuration.Configurable
configure
 

Field Detail

ROLE

public static final String ROLE
The name of the role for convenience

See Also:
Constant Field Values
Method Detail

getClusterSize

public int getClusterSize()
Returns the number of DataSources in the cluster.

Returns:
size of the cluster.

getConnectionForHashObject

public Connection getConnectionForHashObject(Object hashObject)
                                      throws SQLException
Gets a Connection to a database given a hash object.

Parameters:
hashObject - Object whose hashCode will be used to select which of the Clusted DataSources will be provide a Connection.
Throws:
NoValidConnectionException - when there is no valid Connection wrapper available in the classloader or when the index is not valid.
NoAvailableConnectionException - when there are no more available Connections in the pool.
SQLException

getConnectionForHashCode

public Connection getConnectionForHashCode(int hashCode)
                                    throws SQLException
Gets a Connection to a database given a hash code.

Parameters:
hashCode - HashCode which will be used to select which of the Clusted DataSources will be provide a Connection.
Throws:
NoValidConnectionException - when there is no valid Connection wrapper available in the classloader or when the index is not valid.
NoAvailableConnectionException - when there are no more available Connections in the pool.
SQLException

getConnectionForIndex

public Connection getConnectionForIndex(int index)
                                 throws SQLException
Gets a Connection to a database given an index.

Parameters:
index - Index of the DataSource for which a connection is to be returned.
Throws:
NoValidConnectionException - when there is no valid Connection wrapper available in the classloader or when the index is not valid.
NoAvailableConnectionException - when there are no more available Connections in the pool.
SQLException

getIndexForHashObject

public int getIndexForHashObject(Object hashObject)
Gets the index which will be resolved for a given hashCode. This can be used by user code to optimize the use of DataSource Clusters.

Parameters:
hashObject - Object whose hashCode will be used to select which of the Clusted DataSources will be provide a Connection.

getIndexForHashCode

public int getIndexForHashCode(int hashCode)
Gets the index which will be resolved for a given hashCode. This can be used by user code to optimize the use of DataSource Clusters.

Parameters:
hashCode - HashCode which will be used to select which of the Clusted DataSources will be provide a Connection.


Copyright © 2000-2002 Apache Jakarta Project. All Rights Reserved.