Opinions on this, if you will.

Discussion in 'Plugin Development' started by MrAwellstein, Jun 23, 2014.

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


    So I haven't gotten much sleep lately, so I might be a little out of it. Anyways I am creating this one plugin that doesn't at all touch on the bukkit thread (Except for the onEnable()); but now I'm going to try to get it to interact with bukkit. The idea that I have is with ConcurrentLinkedQueues I can have two parallel queues that allow two threads to communicate, and possible task objects similar to Runnables. The task are pretty much request methods to tell the threads to do things, and then the queues act out on their thread as the task tells them, carrying out whats needed to be done. I haven't programmed this yet (as I'm going to take a nap first), but I would love some opinions.

    Note: one of the two ConcurrentLinkedQueues would be running on a repeating sync bukkit thread so it can be thread safe.

    How it would work:
    EThread: *Sends Bukkit Thread Queuer a Task to tell it to gather information on a player*
    EThread: *waits*
    BukkitThread: *Creates a task or a data object and puts it in the EThread Queuer*
    EThreadQueuer: *Recieves the data object and notifies EThread with the data*
    EThread: *Wakes and deals with the data as needed*
  2. Offline


    There could be more efficient ways, or easier ways of doing it, but you haven't explained what you're trying to do so we couldn't tell you.
  3. Offline


    So are you running a task calling bukkit methods from a different thread?
Thread Status:
Not open for further replies.

Share This Page