1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.database;
|
11
|
|
12
|
import java.sql.SQLException;
|
13
|
|
14
|
import javax.sql.DataSource;
|
15
|
|
16
|
import org.apache.commons.dbcp.BasicDataSource;
|
17
|
import org.apache.commons.pool.impl.GenericObjectPool;
|
18
|
import org.apache.log4j.Logger;
|
19
|
|
20
|
/**
|
21
|
* @author n.hoffmann
|
22
|
* @since Sep 22, 2009
|
23
|
*/
|
24
|
public class DbcpSaveDataSource extends BasicDataSource {
|
25
|
@SuppressWarnings("unused")
|
26
|
private static final Logger logger = Logger.getLogger(DbcpSaveDataSource.class);
|
27
|
|
28
|
/* FIXME This is a workaround to solve a problem with dbcp connection pooling.
|
29
|
* Remove this when dbcp connection pool gets configured correctly
|
30
|
*
|
31
|
* (non-Javadoc)
|
32
|
* @see org.apache.commons.dbcp.BasicDataSource#createDataSource()
|
33
|
*/
|
34
|
@Override
|
35
|
protected synchronized DataSource createDataSource() throws SQLException {
|
36
|
super.createDataSource();
|
37
|
connectionPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
|
38
|
return dataSource;
|
39
|
}
|
40
|
}
|