org.apache.avalon.excalibur.datasource.cluster
Class AbstractDataSourceCluster
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.avalon.excalibur.datasource.cluster.AbstractDataSourceCluster
- All Implemented Interfaces:
- Configurable, Disposable, Initializable, LogEnabled, Serviceable, ThreadSafe
- Direct Known Subclasses:
- DefaultHashedDataSourceCluster, DefaultIndexedDataSourceCluster, DefaultRoundRobinDataSourceCluster
- public abstract class AbstractDataSourceCluster
- extends AbstractLogEnabled
- implements Serviceable, Configurable, Initializable, Disposable, ThreadSafe
- Since:
- 4.1
- Version:
- CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:20 $
- Author:
| Method Summary |
void |
configure(Configuration configuration)
Called by the Container to configure the component. |
void |
dispose()
Called by the Container to dispose the component. |
int |
getClusterSize()
Returns the number of DataSources in the cluster. |
java.sql.Connection |
getConnectionForIndex(int index)
Gets a Connection to a database given an index. |
void |
initialize()
Called by the Container to initialize the component. |
void |
service(ServiceManager manager)
Called by the Container to tell the component which ComponentLocator is controlling it. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_size
protected int m_size
-
m_dataSourceNames
private java.lang.String[] m_dataSourceNames
-
m_dbSelector
private ServiceSelector m_dbSelector
-
m_dataSources
private DataSourceComponent[] m_dataSources
-
AbstractDataSourceCluster
public AbstractDataSourceCluster()
getClusterSize
public int getClusterSize()
-
Returns the number of DataSources in the cluster.
-
-
- Returns:
- size of the cluster.
getConnectionForIndex
public java.sql.Connection getConnectionForIndex(int index)
throws java.sql.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.
NoValidConnectionException - when there are no more available Connections in the pool.
java.sql.SQLException
service
public void service(ServiceManager manager)
throws ServiceException
-
Called by the Container to tell the component which ComponentLocator is controlling it.
-
- Specified by:
service in interface Serviceable
-
- Parameters:
manager - which curently owns the component.
- Throws:
ServiceException - if an error occurs
configure
public void configure(Configuration configuration)
throws ConfigurationException
-
Called by the Container to configure the component.
-
- Specified by:
configure in interface Configurable
-
- Parameters:
configuration - configuration info used to setup the component.
- Throws:
ConfigurationException - if there are any problems with the configuration.
initialize
public void initialize()
throws java.lang.Exception
-
Called by the Container to initialize the component.
-
- Specified by:
initialize in interface Initializable
-
- Throws:
java.lang.Exception - if there were any problems durring initialization.
dispose
public void dispose()
-
Called by the Container to dispose the component.
-
- Specified by:
dispose in interface Disposable
-
Please see keelframework.org for information about new Keel releases.