How does the wait () function work?

The playframework documentation here says:

public static void loopWithoutBlocking() {
    for(int i=0; i<=10; i++) { 
         Logger.info(i);
         await("1s");
    }
    renderText("Loop finished");
}

I don’t understand how exactly this works:

for example, when we call the method in the first request i = 1, then ... unlock and wait .. and the new request goes to the method, and then it starts form i = 0 again? and when the first request wakes up, will it have i = 1 or 0 or 2?

No state mechanism is used here. for example, storage i .. between the request, for example?

+3
source share
1 answer

Play 1.1, suspend, Play 1.2 await(). 1.1 , , "" .

, Thread, "", ( Dev, , 10 , , ). , Play1.1 .

Play 1.2 await , , , .

( ), 9 1 . , , .

+6

All Articles