[Util] TaskChain - Bukkit Flow Control System

Discussion in 'Resources' started by Aikar, Feb 15, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Aikar

    So as any Bukkit developer knows, the API is not thread safe!
    However on my server, we very heavily depend on our MySQL Database to provide features. So running database queries on the main thread is common but undesired.

    However, running queries async creates complicated flow control issues, need to run this query… now need to access the bukkit api, so return to Sync processing, oh wait, now I need to act again with another database query!

    Easy to avoid all that flow control trouble by running everything sync – but then performance can be hurt.

    Node.JS / JavaScript has this problem in great detail, and turns code into call back hell, so there are plenty of Flow Control libraries out there like Q, Async, Chainsaw and more.

    Therefor, to avoid Java running into this same callback mess, I wrote an elegant Flow Control system on top of the Bukkit Scheduler.

    Feel free to use however you need!

    View Source: https://gist.github.com/aikar/9010136
     
    Maulss, Goblom, Bart and 2 others like this.
Thread Status:
Not open for further replies.

Share This Page