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.logging.log4j.LogManager;
|
19
|
import org.apache.logging.log4j.Logger;
|
20
|
|
21
|
/**
|
22
|
* @author n.hoffmann
|
23
|
* @since Sep 22, 2009
|
24
|
*/
|
25
|
public class DbcpSaveDataSource extends BasicDataSource {
|
26
|
|
27
|
@SuppressWarnings("unused")
|
28
|
private static final Logger logger = LogManager.getLogger();
|
29
|
|
30
|
/* FIXME This is a workaround to solve a problem with dbcp connection pooling.
|
31
|
* Remove this when dbcp connection pool gets configured correctly
|
32
|
*/
|
33
|
@Override
|
34
|
protected synchronized DataSource createDataSource() throws SQLException {
|
35
|
super.createDataSource();
|
36
|
connectionPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
|
37
|
return dataSource;
|
38
|
}
|
39
|
}
|