<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          Druid 異常分析 java.sql.SQLException: interrupt Druid

          共 2261字,需瀏覽 5分鐘

           ·

          2021-05-14 12:58

          java.sql.SQLException: interrupt Druid

          今天看線上一直報 java.sql.SQLException: interrupt 因為第一次遇到也在網(wǎng)上找了一些資料,其中網(wǎng)上的大部分內(nèi)容如下:

          1. 我也遇到了這個問題,您這邊解決了嗎?我這邊是雙數(shù)據(jù)源,我懷疑是多數(shù)據(jù)源導(dǎo)致的

          2. 這個錯誤是什么引起的,我使用ThreadPoolExecutor運行多線程,調(diào)用shutdownNow關(guān)閉線程的時候出現(xiàn)的

          3. 先調(diào)用了 cacel 方法,再調(diào)用查詢方法導(dǎo)致

          4. 因為私有云網(wǎng)卡和阿里云的不匹配導(dǎo)致了 只要是請求超過1k的就會響應(yīng)不了,能連接上數(shù)據(jù)庫但是沒有響應(yīng)

          5. 我也碰到了類似的問題,在中斷某一個線程后,我緊跟著需要執(zhí)行的數(shù)據(jù)庫操作并沒有執(zhí)行。報錯為  Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: interrupt

          異常具體內(nèi)容如下:

          2021-05-10 at 16:25:05.262 CST ERROR java.sql.SQLException: interrupt
              at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1201) ~[skyrim.engine.jar:?]
              at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1086) ~[skyrim.engine.jar:?]
              at com.alibaba.druid.filter.FilterChainImpl.dataSource_connect(FilterChainImpl.java:4544) ~[skyrim.engine.jar:?]
              at com.alibaba.druid.filter.stat.StatFilter.dataSource_getConnection(StatFilter.java:670) ~[skyrim.engine.jar:?]

          查看具體的錯誤位置代碼為:

          private DruidPooledConnection getConnectionInternal(long maxWait) throws SQLException {
              ...
              try {
                lock.lockInterruptibly();
              } catch (InterruptedException e) {
                connectErrorCount.incrementAndGet();
                throw new SQLException("interrupt", e);
              }
            ...

          其中 lock 為 ReentrantLock 也就是當(dāng)獲取連接時,如果線程被中斷就會拋出 interrupt

          在我們的項目代碼中,為了控制響應(yīng)時間使用了

          List<Callable<Record>> callableList = new ArrayList<>();

          ...

          List<Future<Record>> futures =
                         executorService.invokeAll(callableList, 300, TimeUnit.MILLISECONDS);

          其中當(dāng) 300 毫秒內(nèi) callableList 還沒有執(zhí)行完成,就會到線程進行中斷,導(dǎo)致 Druid 在 getConnectionInternal 響應(yīng)線程中斷,拋出異常。


          瀏覽 293
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  成人性生活免费视频 | 成人电影久久久久久 | jzzjzz日本丰满成熟少妇 | 中文无码一区二区三区 | 日韩黄色真人直播 |