TickNextTick out of sync

Discussion in 'Plugin Development' started by LennardF1989, Jul 23, 2011.

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

    LennardF1989

    Hi all,

    Please see: http://leaky.bukkit.org/issues/425#note-8

    Anyone experienced this? As said in the update, I'm trying to make a plugin which updates a set of blocks (for a non-disclosed reason as-of yet ;)), anyhow, no matter the delay between the updates, it will eventually throw the above error (the shorther the delay, the faster).

    I found this on the forums:
    But Sync (as the name implies), blocks untill the thread ends, which I don't want to happen. Is there some sort of boolean or sync-method which I can check if it is safe to update blocks?

    EDIT: Currently stress-testing a slightly different thread in scheduleAsyncDelayedTask.

    Lennard

    Using scheduleAsyncDelayedTask and a slightly refactored thread seems to have fixed it :) Just reporting back if people also had issues with it.

    My conclusion: Manually spawned threads cannot safely access minecraft and you have to use scheduleAsyncDelayedTask, it works fine if you leave thread handling COMPLETELY to Bukkit. Do not change your Async calls to Sync calls unless you have some sort of never-ending while(true) loop or code. Above quote I found on the forums is partly incorrect.

    A 1 second delay also seems to work fine now, rather than 5 seconds. Been stress-testing for 25 minutes now and it works fine, where I change 11x11 blocks each 1 second. My unmodified thread would have crashed the server only after 2 minutes :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
Thread Status:
Not open for further replies.

Share This Page