AipoのOpenSocialでDBConnectionを切る方法

https://github.com/aipocom/aipo-opensocial/commit/86f8076aab5bd9a8221952e8251135c1b9e6f9c8

 

 public void tearDown() {
    try {
      DataSource dataSource = CustomDataSourceUtil.getThreadDataSource();
      if (dataSource instanceof ThreadPoolingDataSource) {
        ThreadPoolingDataSource poolingDataSource =
          (ThreadPoolingDataSource) dataSource;
        if (poolingDataSource != null) {
          ObjectPool pool = poolingDataSource.getPool();
          if (pool != null) {
            try {
              pool.close();
            } catch (Throwable t) {
              //
            }
          }
        }
      }
    } catch (Throwable t) {
    }
  }

これがないとコネクションが張られ続ける場合があります。