Re: Need to wait() Thread in EJB code




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.


.



Relevant Pages

  • Re: Running queries one after the other
    ... > event code as follows to run two Queries, ... > changed something and forgot to retest it at the time. ... > The first query is called Append School Offers to Archive ... The form that calls the queries? ...
    (microsoft.public.access.queries)
  • Re: Counting Number of Min/Max Instances
    ... For example, for q1 the min response value was "2", ... Split your reports record source into several queries: ... qryCountMin ... select myMin as q1, minCount as qCount ...
    (microsoft.public.access.reports)
  • Re: The queries look the same in designview??_Again
    ... the first part of the first query does a logical AND with Type ... > the same in Access 97:s designview. ... The results from the queries are also different. ... > SELECT MSysObjects.Name, Type FROM MSysObjects ...
    (microsoft.public.access.queries)
  • Re: Dialog box - paramater query
    ... Thanks for the hints, they are valueble for the future, but I found ... "Jeff Boyce" wrote: ... > How does your first query get it's parameters? ... >> queries, respectively. ...
    (microsoft.public.access.queries)
  • Join queries now not updateable. Need HELP
    ... My second query I have a table with the SDL field as the primary key. ... are fewer SDL numbers in my table than are in my first query. ... I am joining both queries where the SDL fields are equal. ... 1st qry ...
    (microsoft.public.access.formscoding)