Re: Need to wait() Thread in EJB code
- From: _ <billg@xxxxxxxxxxxxx>
- Date: Wed, 12 Oct 2005 15:40:58 -0400
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?
_ wrote:
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?
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.
.
- References:
- Need to wait() Thread in EJB code
- From: _
- Re: Need to wait() Thread in EJB code
- From: Jon Martin Solaas
- Need to wait() Thread in EJB code
- Prev by Date: JSP to Servlet: Dynamically Binding Form Data to a Bean??
- Next by Date: Re: JSP to Servlet: Dynamically Binding Form Data to a Bean??
- Previous by thread: Re: Need to wait() Thread in EJB code
- Next by thread: Why and when do I need to use clone?
- Index(es):
Relevant Pages
|