Skip to content

Instantly share code, notes, and snippets.

@tkawachi
Created October 26, 2011 10:33
Show Gist options
  • Save tkawachi/1315991 to your computer and use it in GitHub Desktop.
Save tkawachi/1315991 to your computer and use it in GitHub Desktop.
19:32:42,599 INFO ~ Sleeping...
19:32:44,599 INFO ~ Woke up!
$ telnet localhost 9000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET http://localhost:9000/test/test HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
Server: Play! Framework;1.2.x-f3dd9e5;dev
Content-Type: text/plain; charset=utf-8
Set-Cookie: PLAY_FLASH=;Expires=Wed, 26-Oct-11 10:32:44 GMT;Path=/
Set-Cookie: PLAY_ERRORS=;Expires=Wed, 26-Oct-11 10:32:44 GMT;Path=/
Set-Cookie: PLAY_SESSION=;Expires=Wed, 26-Oct-11 10:32:44 GMT;Path=/
Cache-Control: no-cache
Content-Length: 2
OK
package controllers;
import play.Logger;
import play.jobs.Job;
import play.mvc.Controller;
public class Test extends Controller {
public static void test() {
subFunction();
renderText("OK");
}
private static void subFunction() {
await(new Job() {
@Override
public void doJob() throws Exception {
Logger.info("Sleeping...");
Thread.sleep(2000);
Logger.info("Woke up!");
};
}.now());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment