Marek Laca created QPID-8532:
--------------------------------

             Summary: [Broker-J] Inaccurate calculation of selection timeout
                 Key: QPID-8532
                 URL: https://issues.apache.org/jira/browse/QPID-8532
             Project: Qpid
          Issue Type: Improvement
          Components: Broker-J
            Reporter: Marek Laca


The SelectorThread.SelectTask inner class is responsible for selecting the 
incoming data from the connection socket.

The selection timeout in SelectorThread.SelectionTask defines how long will be 
the IO-thread blocked in select method waiting for new connection data.
The timeout is calculated based on the nearest connection event of all 
registered connection.
SelectionTask is working in the loop:
# IO-thread waits for new connection data, the timeout is utilized.
# The new connection jobs are registered pushed into the scheduler queue.
# The nearest connection event is picked up from all registered connections.
# The next timeout is calculated based on current time.
# IO-thread processes all new connection jobs.

Hence, the calculated timeout is inaccurate and absolute when the 'select' 
method is called.
The '_nextTimeout' is neither volatile nor atomic variable despite the fact 
that it could be used by multiple IO-threads.

If the SelectionTask kept the time of the nearest connection event instead of 
the next timeout then the timeout would be calculated just before calling the 
select method based on the current time.
If the timeout is bigger than zero then the select method (blocking selection 
operation) will be called. If the time of the nearest connection event has 
passed then the selectNow (non-blocking selection operation) method will be 
called.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to