Hi all, This post is (hopefully) mostly to confirm my thoughts. I've got a process that might take some time. I do not want the client to wait for the entire process however. If the client's input is valid, I just want to send the client a 200 response and handle any subsequent errors internally.
My current solution for this is something like this: @Path ("test") public class Test { // I'm not really instantiating it like this (but rather in a lazy method), // but do want to check if I should be using newCachedThreadPool() // should I be getting some named or configured ThreadPool ???? private static ExecutorService executorService = Executors.newCachedThreadPool(); @GET public static String bla (@QueryParam ("me") String me) { if (me != null && me.trim().length() > 0) { // is this indeed the best way to go about this ???? executorService.execute(new TestMe()); return "Hallo " + me; } return null; } private static class TestMe implements Runnable { @Override public void run() { System.out.println("TestMe"); try { Thread.sleep(20000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Done sleeping"); } } } Which works, but I'm not sure if I'm handling the whole thread thing right (on JBoss 7AS) Any thoughts? Groeten, Friso ------------------------------------------------------------------------------ Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 _______________________________________________ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users