This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Do I need to do a Thread.join() ?

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Servlet which instantiates a Service class and invokes a method (which I'll call doStuff).

Since the method sendToRemoteServer takes a long time, can I safely:
  • run it in a Thread ?
  • If yes to the previous question, do I need to join this Thread ? i.e. do I need to call thread.join() whereby thread is the reference to the Thread that executes "sendToRemoteServer".

  • Thanks all

    Regards,

    Pho
     
    Ove Lindström
    Ranch Hand
    Posts: 326
    Android Firefox Browser Mac OS X
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I would implement the print-job as a Task and then have an Excecutor-object run it. If you need to have some sort of callback when it is done, you can use a Semaphore or a CountDownLatch.
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic