Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-4695

Opposite behaviour of AsyncResponse.setTimeout with <= 0 values.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.0.1.CR1, 7.0.1.GA
    • None
    • REST
    • None
    • EAP 7.0.1

      (I'm fairly new to resteasy and async jax-rs so apologies if I've gotten this all wrong)

      There appears to be a bug in the implementation of AsyncResponse.setTimeout for values of 0 or less - the javadoc says

      Value lower or equal to 0 causes the context to suspend indefinitely

      but what actually happens is values of 0 or less cause the response to not wait.

      I believe this is caused by the implementation in SynchronousExecutionContext@125 which uses syncLatch.await(long,TimeUnit) and passes in the exact values given in the AsyncResponse.setTimeout. However the intended semantics of these two methods w.r.t. <=0 values is the opposite, from the CountDownLatch docs:

      If the time is less than or equal to zero, the method will not wait at all

      A work around is to specify a timeout when configuring the AsyncResponse that is some distant time in the future.

            rsigal@redhat.com Ronald Sigal
            matt.nathan Matt Nathan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: