How to know when a Thread has been completed

Asked

Viewed 108 times

0

I have the following implementation javascript on the call of a Thread.

I would like to print in the log the moment Thread was finished. That’s possible?

func4 = {
        run: function(){
            atv4();
        }
    };
    r4 = new java.lang.Runnable(func4);
    t4 = new java.lang.Thread(r4);
    t4.start();
    log.info("Iniciei a thread atv4");
    return;
  • javascript implementation

1 answer

1


Every time you finish running the thread or even when an error occurs it goes to the state TERMINATED .

if(t4.getState()!=Thread.State.TERMINATED){...}
  • I’ll test and warn you

  • Ok, I don’t know how it will behave in "javascript implementation" but in java it is like this, anything we find something equivalent.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.