Pour la gestion de Mon Pool de connexion avec l'API : org.apache.commons.dbcp
Je voulais savoir s'il ya un mécanisme automatique de recyclage des connexions si le nombre max active est atteint ? Ou ya til une config à faire pour ça pour le timeOut ..?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import org.apache.commons.dbcp.ConnectionFactory; import org.apache.commons.dbcp.DriverManagerConnectionFactory; import org.apache.commons.dbcp.PoolableConnectionFactory; import org.apache.commons.dbcp.PoolingDataSource; import org.apache.commons.pool.ObjectPool; import org.apache.commons.pool.impl.GenericObjectPool; //TODO Feten add 07/12 for int maxSize = Integer.MAX_VALUE; int minSize = 0; long timeout = ORBConstants.DEFAULT_INACTIVITY_TIMEOUT; try { maxSize = Integer.parseInt(properties.getProperty(POOL_MAX_SIZE_PROPERTIE)); } catch (Exception e) {} try { minSize = Integer.parseInt(properties.getProperty(POOL_MIN_SIZE_PROPERTIE));; } catch (Exception e) {} try { timeout = Long.parseLong(properties.getProperty(POOL_TIMEOUT_SIZE_PROPERTIE));; } catch (Exception e) {} ((com.sun.corba.se.impl.orb.ORBImpl) orb).setThreadPoolManager(new ThreadPoolManagerImpl(minSize, maxSize, timeout));
Partager