List of usage examples for org.apache.ibatis.datasource.pooled PooledDataSource forceCloseAll
public void forceCloseAll()
From source file:com.bibisco.dao.SqlSessionFactoryManager.java
License:GNU General Public License
public void cleanSqlSessionFactoryProject() { mLog.debug("Start cleanSqlSessionFactoryProject()"); Validate.notEmpty(ContextManager.getInstance().getIdProject(), "There is no project in context"); String lStrProjectId = ContextManager.getInstance().getIdProject(); SqlSessionFactory lSqlSessionFactoryProject = mMapSqlSessionFactoryProjects.get(lStrProjectId); PooledDataSource lPooledDataSource = (PooledDataSource) lSqlSessionFactoryProject.getConfiguration() .getEnvironment().getDataSource(); lPooledDataSource.forceCloseAll(); mMapSqlSessionFactoryProjects.remove(lStrProjectId); mLog.debug("End cleanSqlSessionFactoryProject()"); }
From source file:org.camunda.bpm.engine.test.api.cfg.ForceCloseMybatisConnectionPoolTest.java
License:Apache License
@Test public void testForceCloseMybatisConnectionPoolFalse() { // given//from www. j a v a 2 s .c om // that the process engine is configured with forceCloseMybatisConnectionPool = false ProcessEngineConfigurationImpl configurationImpl = new StandaloneInMemProcessEngineConfiguration() .setJdbcUrl("jdbc:h2:mem:camunda-forceclose").setProcessEngineName("engine-forceclose") .setForceCloseMybatisConnectionPool(false); ProcessEngine processEngine = configurationImpl.buildProcessEngine(); PooledDataSource pooledDataSource = (PooledDataSource) configurationImpl.getDataSource(); PoolState state = pooledDataSource.getPoolState(); int idleConnections = state.getIdleConnectionCount(); // then // if the process engine is closed processEngine.close(); // the idle connections are not closed Assert.assertEquals(state.getIdleConnectionCount(), idleConnections); pooledDataSource.forceCloseAll(); Assert.assertTrue(state.getIdleConnectionCount() == 0); }
From source file:org.flowable.app.engine.test.cfg.ForceCloseMybatisConnectionPoolTest.java
License:Apache License
@Test public void testForceCloseMybatisConnectionPoolFalse() { // given//from www .java 2 s. c o m // that the AbstractEngineConfiguration is configured with forceCloseMybatisConnectionPool = false StandaloneInMemAppEngineConfiguration appEngineConfiguration = new StandaloneInMemAppEngineConfiguration(); appEngineConfiguration.setJdbcUrl("jdbc:h2:mem:flowable-app-" + this.getClass().getName()); appEngineConfiguration.setForceCloseMybatisConnectionPool(false); AppEngine appEngine = appEngineConfiguration.buildAppEngine(); PooledDataSource pooledDataSource = (PooledDataSource) appEngineConfiguration.getDataSource(); PoolState state = pooledDataSource.getPoolState(); assertTrue(state.getIdleConnectionCount() > 0); // then // if the engine is closed appEngine.close(); // the idle connections are not closed assertTrue(state.getIdleConnectionCount() > 0); pooledDataSource.forceCloseAll(); assertEquals(0, state.getIdleConnectionCount()); }
From source file:org.flowable.cmmn.test.cfg.ForceCloseMybatisConnectionPoolTest.java
License:Apache License
@Test public void testForceCloseMybatisConnectionPoolFalse() { // given// w w w .j av a 2 s.c o m // that the AbstractEngineConfiguration is configured with forceCloseMybatisConnectionPool = false StandaloneInMemCmmnEngineConfiguration standaloneInMemCmmnEngineConfiguration = new StandaloneInMemCmmnEngineConfiguration(); standaloneInMemCmmnEngineConfiguration.setJdbcUrl("jdbc:h2:mem:flowable-cmmn-" + this.getClass().getName()); standaloneInMemCmmnEngineConfiguration.setForceCloseMybatisConnectionPool(false); CmmnEngine cmmnEngine = standaloneInMemCmmnEngineConfiguration.buildCmmnEngine(); PooledDataSource pooledDataSource = (PooledDataSource) standaloneInMemCmmnEngineConfiguration .getDataSource(); PoolState state = pooledDataSource.getPoolState(); assertTrue(state.getIdleConnectionCount() > 0); // then // if the engine is closed standaloneInMemCmmnEngineConfiguration.close(); // the idle connections are not closed assertTrue(state.getIdleConnectionCount() > 0); pooledDataSource.forceCloseAll(); assertEquals(0, state.getIdleConnectionCount()); }
From source file:org.flowable.content.engine.test.ForceCloseMybatisConnectionPoolTest.java
License:Apache License
@Test public void testForceCloseMybatisConnectionPoolFalse() { // given// www. j a va 2s . c o m // that the AbstractEngineConfiguration is configured with forceCloseMybatisConnectionPool = false StandaloneInMemContentEngineConfiguration standaloneInMemContentEngineConfiguration = new StandaloneInMemContentEngineConfiguration(); standaloneInMemContentEngineConfiguration .setJdbcUrl("jdbc:h2:mem:flowable-content-" + this.getClass().getName()); standaloneInMemContentEngineConfiguration.setForceCloseMybatisConnectionPool(false); ContentEngine contentEngine = standaloneInMemContentEngineConfiguration.buildContentEngine(); PooledDataSource pooledDataSource = (PooledDataSource) standaloneInMemContentEngineConfiguration .getDataSource(); PoolState state = pooledDataSource.getPoolState(); assertTrue(state.getIdleConnectionCount() > 0); // then // if the engine is closed contentEngine.close(); // the idle connections are not closed assertTrue(state.getIdleConnectionCount() > 0); pooledDataSource.forceCloseAll(); assertEquals(0, state.getIdleConnectionCount()); }
From source file:org.flowable.dmn.engine.test.cfg.ForceCloseMybatisConnectionPoolTest.java
License:Apache License
@Test public void testForceCloseMybatisConnectionPoolFalse() { // given/* www.java 2s . c o m*/ // that the AbstractEngineConfiguration is configured with forceCloseMybatisConnectionPool = false StandaloneInMemDmnEngineConfiguration standaloneInMemDmnEngineConfiguration = new StandaloneInMemDmnEngineConfiguration(); standaloneInMemDmnEngineConfiguration.setJdbcUrl("jdbc:h2:mem:flowable-dmn-" + this.getClass().getName()); standaloneInMemDmnEngineConfiguration.setForceCloseMybatisConnectionPool(false); DmnEngine dmnEngine = standaloneInMemDmnEngineConfiguration.buildDmnEngine(); PooledDataSource pooledDataSource = (PooledDataSource) standaloneInMemDmnEngineConfiguration .getDataSource(); PoolState state = pooledDataSource.getPoolState(); assertTrue(state.getIdleConnectionCount() > 0); // then // if the engine is closed dmnEngine.close(); // the idle connections are not closed assertTrue(state.getIdleConnectionCount() > 0); pooledDataSource.forceCloseAll(); assertEquals(0, state.getIdleConnectionCount()); }
From source file:org.flowable.engine.test.cfg.ForceCloseMybatisConnectionPoolTest.java
License:Apache License
@Test public void testForceCloseMybatisConnectionPoolFalse() { // given//ww w . j a v a 2 s .co m // that the process engine is configured with forceCloseMybatisConnectionPool = false StandaloneInMemProcessEngineConfiguration standaloneInMemProcessEngineConfiguration = new StandaloneInMemProcessEngineConfiguration(); standaloneInMemProcessEngineConfiguration .setJdbcUrl("jdbc:h2:mem:flowable-bpmn-" + this.getClass().getName()); standaloneInMemProcessEngineConfiguration.setForceCloseMybatisConnectionPool(false); ProcessEngine processEngine = standaloneInMemProcessEngineConfiguration.buildProcessEngine(); PooledDataSource pooledDataSource = (PooledDataSource) standaloneInMemProcessEngineConfiguration .getDataSource(); PoolState state = pooledDataSource.getPoolState(); assertTrue(state.getIdleConnectionCount() > 0); // then // if the process engine is closed processEngine.close(); // the idle connections are not closed assertTrue(state.getIdleConnectionCount() > 0); pooledDataSource.forceCloseAll(); assertEquals(0, state.getIdleConnectionCount()); }
From source file:org.flowable.form.engine.test.ForceCloseMybatisConnectionPoolTest.java
License:Apache License
@Test public void testForceCloseMybatisConnectionPoolFalse() { // given// w ww . jav a 2s. co m // that the AbstractEngineConfiguration is configured with forceCloseMybatisConnectionPool = false StandaloneInMemFormEngineConfiguration standaloneInMemFormEngineConfiguration = new StandaloneInMemFormEngineConfiguration(); standaloneInMemFormEngineConfiguration.setJdbcUrl("jdbc:h2:mem:flowable-form-" + this.getClass().getName()); standaloneInMemFormEngineConfiguration.setForceCloseMybatisConnectionPool(false); FormEngine formEngine = standaloneInMemFormEngineConfiguration.buildFormEngine(); PooledDataSource pooledDataSource = (PooledDataSource) standaloneInMemFormEngineConfiguration .getDataSource(); PoolState state = pooledDataSource.getPoolState(); assertTrue(state.getIdleConnectionCount() > 0); // then // if the engine is closed formEngine.close(); // the idle connections are not closed assertTrue(state.getIdleConnectionCount() > 0); pooledDataSource.forceCloseAll(); assertEquals(0, state.getIdleConnectionCount()); }
From source file:org.flowable.idm.engine.test.api.identity.ForceCloseMybatisConnectionPoolTest.java
License:Apache License
@Test public void testForceCloseMybatisConnectionPoolFalse() { // given//from w ww.j av a2 s . c o m // that the AbstractEngineConfiguration is configured with forceCloseMybatisConnectionPool = false StandaloneInMemIdmEngineConfiguration standaloneInMemIdmEngineConfiguration = new StandaloneInMemIdmEngineConfiguration(); standaloneInMemIdmEngineConfiguration.setJdbcUrl("jdbc:h2:mem:flowable-idm-" + this.getClass().getName()); standaloneInMemIdmEngineConfiguration.setForceCloseMybatisConnectionPool(false); standaloneInMemIdmEngineConfiguration.setDatabaseSchemaUpdate("drop-create"); IdmEngine idmEngine = standaloneInMemIdmEngineConfiguration.buildIdmEngine(); PooledDataSource pooledDataSource = (PooledDataSource) standaloneInMemIdmEngineConfiguration .getDataSource(); PoolState state = pooledDataSource.getPoolState(); assertTrue(state.getIdleConnectionCount() > 0); // then // if the engine is closed idmEngine.close(); // the idle connections are not closed assertTrue(state.getIdleConnectionCount() > 0); pooledDataSource.forceCloseAll(); assertEquals(0, state.getIdleConnectionCount()); }