Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

Need to wait() Thread in EJB code

Thread view: 
_ - 11 Oct 2005 19:43 GMT
    I need to accept a request and then query two systems.  I need to send
off the first query to a queue then execute the second query.  After
getting the result from the second query I need to wait for a response
from the first query via an MDB before combining the data from both
queries and returning a response.

    Of course the first thing about EJBs is that you can't muck around
waiting and notifying threads so how can I do this.

    Options

    Some JBoss specific classes that are safe to use.  But I'll want to
move to WebSphere next year.

    Implement this as a separate stand-alone non-J2EE server.

    Use some J2EE API designed for this purpose.  Am I missing this?
Jon Martin Solaas - 12 Oct 2005 19:25 GMT
>     I need to accept a request and then query two systems.  I need to
> send off the first query to a queue then execute the second query.  
[quoted text clipped - 13 lines]
>
>     Use some J2EE API designed for this purpose.  Am I missing this?

Put the result from the second query into a buffer and pick it up when
your MDB is triggered by the result of the first query.

The buffer could be anything from a singleton to a database table,
depending on lots of things that I don't know anything about :-) Anyway,
I don't think you have to write stuff that breaks portability and the
J2EE standard to achieve this. Just make sure the buffer won't become a
bottleneck.

Signature

jon martin solaas

_ - 12 Oct 2005 20:40 GMT
    Thanks for the suggestion Jon.  One of my main objectives is to devise
a solution that works inside the J2EE container.  Your solution does
work for a setup where a client is sending queries and concurrently
listening for responses to past queries.  Unfortunately I also have the
situation where the initial request thread is fired up by an HTTP
request and so needs to wind up by building a response and returning
that to the browser.  I also don't know which query will finish first.
Any ideas?

   

>>     I need to accept a request and then query two systems.  I need to
>> send off the first query to a queue then execute the second query.  
[quoted text clipped - 22 lines]
> J2EE standard to achieve this. Just make sure the buffer won't become a
> bottleneck.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.