Hi all,
What is the expected behavior of TimingOutCallback.waitForResponse()
if the response has already arrived?  From looking at the code, it
seems like the wait thread would wait for the full timeout and then
throw a TimeoutException, because the callback's monitor was already
notified before the wait thread arrived.  It also seems to me that
there's no way (short of externally synchronizing on the callback
object) to guarantee that the response has *not* already arrived when
waitForResponse() is called.  A check in the method itself would
alleviate this concern:

Have people already developed a workaround for this, or do people
generally just call waitForResponse immediately after submitting the
request?

   public synchronized Object waitForResponse() throws Throwable {

       if (!responseSeen) { //  <----- new check
           wait(timeout);
           if (!responseSeen) {
               throw new TimeoutException(0, "No response after
waiting for " + timeout + " milliseconds.");

           }
       }
       if (error != null) {
           throw error;
       }
       return result;
   }


Have people already developed a workaround for this, or do people
generally just call waitForResponse immediately after submitting the
request?

Thanks,
-Jon

P.S.: Please cc: me in any replies.
P.P.S.: Yes, I'm familiar with this thing you call a "diff".  I'm also
quite lazy.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to