Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

asynchronous java

 
Ryan Acc
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way of making a Java program asynchronous without using Threads and/or JMS??
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you define what you mean by "making a program asynchronous?" Running it in the background? Running it as a service?
 
Ryan Acc
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Making the program asynchronous as in when calling functions on it, we do not have to wait for it to complete. Once the call is made, we can carry on with other things.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It pretty much has to involve threads at some level. If you're calling another method within your own program and want to continue without waiting for that method to return, it will have to run on another thread. If you use some API to call outside your program, say JMS to a queueing system, the external program can do the threading.

If you are feeling a bit intimidated by threads, relax. I put off learning them for quite a while, but found some very good uses after a while. You can have a fine time with Java and never do any threads and there are some environments like EJB servers where you are forbidden to mess with your own threads. But I'd encourage you to Google for a tutorial, play with some examples and get a good level of comfort with threads. They are good clean fun, and a useful way to make programs faster or at least feel faster some times.

Feel free to jump up to the threads forum and talk through the learning process with the gang.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic