今日、c3p0接続プールを見ると、データベースへの接続に関してクレイジーなエラーが報告されました
com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@1c83354 -- timeout at awaitAvailable()
最後に、BaiduやGoogleなどをチェックしたところ、Googleは本当に使いやすいことがわかりました。!!
最後に次のように解決策を見つけました:
<?xml version="1.0" encoding="utf-8"?>
<c3p0-config>
<default-config>
<property name="driverClass">com.mysql.cj.jdbc.Driver</property>
<property name="jdbcUrl">jdbc:mysql://localhost:3306/shopping?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC</property>
<property name="user">root</property>
<property name="password">123456</property>
<property name="initialPoolSize">5</property>
<property name="maxPoolSize">240</property>
<property name="checkoutTimeout">60000</property>
<property name="acquireIncrement">1</property>
</default-config>
</c3p0-config>
構成時にcheckoutTimeoutプロパティはまだ十分に大きくないため、接続を取得する前に接続プールが自動的に一時停止します。
この属性の値を3000から60000に変更します。