• Post Reply Bookmark Topic Watch Topic
  • New Topic

Asynchronous process in java  RSS feed

 
sanjey asok
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create an asynchronous process in java; I explain my scenario as follow
In my java code ,I call a DB operations which takes more time to finish ,I want to implement this as asynchronous process ,so when the DB operation complete then it call the handler ex ample:A
In the handler A ,I code the required functionality
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds like "sequence", which is simply the behaviour of a single thread. You don't need to do anything unusual.

"Sequence" is one of the three components of structured programming, the other two being selection and repetition.
 
Martin Vanyavchich
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sanjey asok, you might be talking about multiple threads and the use of join() method. Take a good look here.
 
Garik Ustinov
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might be interested in java.util.concurrent package. There is plenty of stuff for asynchronous processing. For example, implementations of Future interface provide the sort of functionality you're asking for
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!