Pausing Thread

Discussion in 'Plugin Development' started by The_Spaceman, Jul 1, 2018.

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

    The_Spaceman

    Code:
    Thead t = new Thread(() -> {
    //some heavy stuff that may take a long time to do it
    });
    t.start();
    
    when I pause the Thead with .wait() it works fine, but when I try to restart it with .notify() of .notifyAll()
    the server stops responding...
    even when I put it in a new Thead


    is there any other way to do this? Or what am I doing wrong?
     
  2. Offline

    timtower Administrator Administrator Moderator

    @The_Spaceman And why do you need the thread?
    Why not an async task?
     
  3. Offline

    The_Spaceman

    thats because the async task is basicly a Thead, the BukkitWorker has some extra data saved I don't nead.
     
  4. Offline

    timtower Administrator Administrator Moderator

    Made for this though, and the amount extra is minimal
     
  5. Offline

    The_Spaceman

    but it wont let me pause it, so unnecessary.
    and lets say I put it in a BukkitWorker, it does not chance anything for the purpose...
     
  6. Offline

    timtower Administrator Administrator Moderator

Thread Status:
Not open for further replies.

Share This Page