ChestShop-authors / ChestShopNotifier

Bukkit plugin that allows your players to see who bought or sold what while they were offline.
https://www.spigotmc.org/resources/chestshopnotifier.30313/
10 stars 8 forks source link

The plugin is using the main server thread. #3

Closed erik1988 closed 8 years ago

erik1988 commented 8 years ago

Title says it all, its not recommended to use the main server thread for stuff like this, consequentially the plugin autosaveworld is warning us about this.

[16:39:20] [Server thread/WARN]: [AutoSaveWorld] Plugin ChestShopNotifier attempted to establish connection socket://localhost:3306 in main server thread

Could this be fixed?

Thanks.

Phoenix616 commented 8 years ago

On which action in the plugin does that occur? Afaik a lot is already running in its own thread. (Besides enabling and disabling obviously)

erik1988 commented 8 years ago

Thanks for your reply. I do not know specifically but I see this warning allot and it seems to only be when its connecting to SQL, sometimes it will show up many times i a row too.

This instance is from when the server is started:

[14:08:43] [Server thread/INFO]: [ChestShopNotifier] Enabling ChestShopNotifier v1.1.5
[14:08:43] [Server thread/INFO]: [ChestShopNotifier] Connecting to the database...
[14:08:43] [Server thread/WARN]: [AutoSaveWorld] Plugin ChestShopNotifier attempted to establish connection socket://localhost:3306 in main server thread
[14:08:43] [Server thread/INFO]: [ChestShopNotifier] Connecting to the database...
[14:08:43] [Server thread/WARN]: [AutoSaveWorld] Plugin ChestShopNotifier attempted to establish connection socket://localhost:3306 in main server thread
[14:08:43] [Server thread/INFO]: [ChestShopNotifier] Connected!

And this one just happens randomly: [18:54:59] [Server thread/WARN]: [AutoSaveWorld] Plugin ChestShopNotifier attempted to establish connection socket://localhost:3306 in main server thread

The last one happens many times, if you add autosaveworld as a plugin you will be able to see for yourself.

erik1988 commented 8 years ago

I dont know much about coding but I looked at how logblock handels mysql and noticed that they use "implements" instead of "extends". Could that be the reason?

LOGBLOCK: public class MySQLConnectionPool implements Closeable {
CSN: public class MySQL extends Database {

https://github.com/LogBlock/LogBlock/blob/master/src/main/java/de/diddiz/util/MySQLConnectionPool.java

Phoenix616 commented 8 years ago

This has nothing to do with that, it's just a different design choice.

erik1988 commented 8 years ago

Thanks! :)