我有Hibernate的问题(hibernate-core-4.1.9.Final.jar)
当我在for循环中测试hibernate时工作正常:
for(int i=0;i<1500;i++){
UserDAO.getInstance.getById(1);
}
Run Code Online (Sandbox Code Playgroud)
当我在for循环中添加Thread.sleep()时
for(int i=0;i<1500;i++){
UserDAO.getInstance.getById(1);
Thread.sleep(60000);
}
Run Code Online (Sandbox Code Playgroud)
1分钟后,我得到例外:
00:20:06,447 WARN SqlExceptionHelper:143 - SQL Error: 0, SQLState: 08S01
00:20:06,448 ERROR SqlExceptionHelper:144 - Communications link failure
The last packet successfully received from the server was 120,017 milliseconds ago. The last packet sent successfully to the server was 9 milliseconds ago.
Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Communications link failure
The last packet successfully received from the server was 120,017 milliseconds ago. The last packet …Run Code Online (Sandbox Code Playgroud)