• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

simulating synchrous behaviour in java

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In java what are the different mechanisms available to turn the asynchrous call into synchrous call. e.g when a message is put on the input queue of the thread the control returns to the caller. But the behaviour I want is not to return the control to caller until certin conditions happen. One condition could be certin message detected on the output queue of the same thread and other condition could be like a boolean value becoming true. I almost think like spawning the thread and waiting in the thread for differnt conditions to happen. I might be only scrating the surface. Are there standard techniques or pattern to achieve the similar think or do you think it is hack?

Thnx, Akhtar
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of Java are you using? There are utility classes included in JDK5 that would help you. Of course, if you're not using JDK5, you can download the classes you need. In particular, you might look into using a Latch or a CountDown.
 
I AM MIGHTY! Especially when I hold this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic