|
@@ -70,9 +70,17 @@ public class ConnectionService {
|
|
// isConnected = false; // 连接失败,更新状态
|
|
// isConnected = false; // 连接失败,更新状态
|
|
JedisUtils.set("ccpmConnect", "false", 24);
|
|
JedisUtils.set("ccpmConnect", "false", 24);
|
|
System.out.println("Connection failed: " + e.getMessage());
|
|
System.out.println("Connection failed: " + e.getMessage());
|
|
|
|
+ } finally {
|
|
|
|
+ // 在任务完成后清理资源,
|
|
|
|
+ cleanUpResources();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void cleanUpResources() {
|
|
|
|
+
|
|
|
|
+ System.gc(); // 显式调用垃圾回收
|
|
|
|
+ }
|
|
|
|
+
|
|
// 可选:停止检查连接的方法
|
|
// 可选:停止检查连接的方法
|
|
public void stopCheckingConnection() {
|
|
public void stopCheckingConnection() {
|
|
if (scheduler != null) {
|
|
if (scheduler != null) {
|