Does the BukkitScheduler have any methods for asynchronously running a callable?

Discussion in 'Plugin Development' started by MrZoraman, Jan 4, 2014.

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

    MrZoraman

    Maybe I don't understand the api correctly. I see the method callSyncMethod(Plugin plugin, Callable<T> task), but that's synchronous, so it seems. The api docs say that it's run on the main thread. If that's the case, what advantage does this offer over just calling the call() method myself?

    I could make myself a threadpool and execute it there, but that seems pretty frowned down upon if I remember correctly.

    Any help is appreciated, thanks!

    -Z
     
  2. Offline

    xTrollxDudex

    MrZoraman
    Well for one Bukkit methods are not thread safe so it's probably just a precaution.
     
  3. Offline

    CubieX

    You can run async callables without using the Bukkit API. Just be sure to know what you are doing.
     
  4. Offline

    NathanWolf

    Couldn't you make a generic Runnable the calls a Callable in it's run? (And then use it with any of the normal async scheduler methods)?

    I agree with TrollDude- it was probably omitted as a precaution, since that might give people the idea that they could call Bukkit API methods directly in an asynch thread, which is generally not a good idea. But I imagine this would be fine to do as long as you're only calling your own code (and that code is all self-contained).
     
  5. Offline

    1Rogue

    Why?
     
Thread Status:
Not open for further replies.

Share This Page