This repository was archived by the owner on Aug 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
fix: 修复内存泄漏和数据库连接泄漏问题 #1
Open
MineSunshineone
wants to merge
1
commit into
Cherry7593:main
Choose a base branch
from
MineSunshineone:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -203,6 +203,14 @@ class McediaManager(private val plugin: JavaPlugin) { | |||||||
| } | ||||||||
|
|
||||||||
| fun deleteTemplate(playerUUID: UUID, templateId: Int): Boolean = storage?.deleteTemplate(playerUUID, templateId)?.join() ?: false | ||||||||
|
|
||||||||
| /** | ||||||||
| * 从缓存中移除播放器(用于实体被外部删除时的清理) | ||||||||
| */ | ||||||||
| fun removeFromCache(uuid: UUID) { | ||||||||
| players.remove(uuid) | ||||||||
|
||||||||
| players.remove(uuid) | |
| players.remove(uuid) | |
| storage?.delete(uuid) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DatabaseManager 改为返回单一持久 Connection,但目前仅在 getConnection 内部创建/切换连接时加锁;实际 SQL 执行发生在多个 CompletableFuture 线程中,会并发共享同一个 Connection。JDBC 的 SQLite 连接通常不支持并发使用,容易出现竞态/
database is locked等问题。建议把数据库操作整体串行化(例如提供withConnection {}并在其中同步执行 SQL,或使用单线程 Executor 运行所有 storage future),而不是只同步获取连接。