Created
October 26, 2011 10:33
-
-
Save tkawachi/1315991 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19:32:42,599 INFO ~ Sleeping... | |
19:32:44,599 INFO ~ Woke up! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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