TranxCraft / iTranxCraft

The Rewrite Of TranxCraft - a custom plugin that does many wonderful things.
3 stars 1 forks source link

Statistic Logging Queues #45

Closed Fyrsta closed 9 years ago

Fyrsta commented 9 years ago

Something that @TheCJGCJG thought of. The ability to add a queue of SQL queries to log to the database every so often (probably every 20 seconds - I don't see why it'll need to be any faster to be honest) asynchronously. This will free up performance as these queries can easily cause the server to slow down.

@JeromSar, I'd like your opinion on this as you've got a far better idea than I do about asynchronous threading, thread safety, etc.

JeromSar commented 9 years ago

@WickedGamingUK Seems like a good idea. Would be the best to have the entries stored in a synchronized list. Then, they could easily be pulled every so often by a BukkitRunnable, and synced with the server.

Fyrsta commented 9 years ago

@JeromSar By a synchronized list, do you mean by using Collections.synchronizedList? Also, would it be possible to empty the list after the Runnable has finished without losing any queries that were added whilst the Runnable was running (if this is a problem or not, I don't know)?

Fyrsta commented 9 years ago

@JeromSar

Fyrsta commented 9 years ago

@JeromSar

JeromSar commented 9 years ago

@WickedGamingUK I can't really go into specifics without writing a huge post, try something out and see if it works.

Fyrsta commented 9 years ago

@JeromSar Alright, thanks for your help.