You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Marek Laca (Jira)" <ji...@apache.org> on 2021/05/28 14:26:00 UTC

[jira] [Created] (QPID-8530) [Broker-J] Duplicated functionality of the Selector::wakeup method in SelectorThread

Marek Laca created QPID-8530:
--------------------------------

             Summary: [Broker-J] Duplicated functionality of the Selector::wakeup method in SelectorThread
                 Key: QPID-8530
                 URL: https://issues.apache.org/jira/browse/QPID-8530
             Project: Qpid
          Issue Type: Improvement
          Components: Broker-J
            Reporter: Marek Laca


It is stated in Java documentation of the [Selector::wakeup|https://docs.oracle.com/javase/7/docs/api/java/nio/channels/Selector.html#wakeup()] method that:
{code:none}
Causes the first selection operation that has not yet returned to return immediately.

If another thread is currently blocked in an invocation of the select() or select(long) methods then that invocation will return immediately. If no selection operation is currently in progress then the next invocation of one of these methods will return immediately unless the selectNow() method is invoked in the meantime. In any case the value returned by that invocation may be non-zero. Subsequent invocations of the select() or select(long) methods will block as usual unless this method is invoked again in the meantime.

Invoking this method more than once between two successive selection operations has the same effect as invoking it just once. 
{code}
SelectorThread.SelectionTask inner class in Java broker duplicates build in functionality of the Selector::wakeup method, what complicates the implementation. If the class attributes '_inSelect' and '_wakeups' were removed then the code of SelectorThread.SelectionTask class would be simplified. The wakeup method could be directly executed, there is no need for another checks.



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

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