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 15:06:00 UTC
[jira] [Created] (QPID-8533) [Broker-J] SelectorThread is not
actual thread
Marek Laca created QPID-8533:
--------------------------------
Summary: [Broker-J] SelectorThread is not actual thread
Key: QPID-8533
URL: https://issues.apache.org/jira/browse/QPID-8533
Project: Qpid
Issue Type: Improvement
Components: Broker-J
Reporter: Marek Laca
SelectorThread in Broker-J code extends Thread but it should not be used as a thread.
SelectorThread works as a command parameter (Runnable) that is put in a new thread:
{code:java}
SelectorThread command = new SelectorThread(scheduler, numberOfSelectors);
Thread t = new Thread(command);
{code}
There has to be exactly one SelectorThread for every NetworkConnectionScheduler, the SelectorThread maintain a common data that are share among IO-threads from the scheduler thread pool. We can find the following code in the SelectorThread:
{code:java}
Thread.currentThread().setName(_scheduler.getSelectorThreadName());
{code}
If anybody replaced previous code and set the name directly (calling the inherited setName method) then it would be a bug and the name would not be set to the current thread. The code lure a developer in using the methods inherited from Thread, but these methods would not have the expected effect. SelectorThread is not mentioned to be used as a thread and SelectorThread should only implement Runnable interface instead of extending Thread.
--
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