[ 
https://issues.apache.org/jira/browse/ARTEMIS-2183?focusedWorklogId=203876&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-203876
 ]

ASF GitHub Bot logged work on ARTEMIS-2183:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Feb/19 20:11
            Start Date: 25/Feb/19 20:11
    Worklog Time Spent: 10m 
      Work Description: orpiske commented on issue #2566: ARTEMIS-2183 Useless 
statement in public synchronized List
URL: https://github.com/apache/activemq-artemis/pull/2566#issuecomment-467164632
 
 
   > So the only other thing here. Is this obviosuly has gone unnoticed for 
ages. To avoid this in future a test, ensuring its functionality (what ever 
that is)
   
   So, I dig a bit further to find out where it was used. This is part of the 
management API and is exposed both via Hawtio and Jolokia. 
   
   > 
   > "Transaction heuristic operations
   > 
   > In case of a server crash, when the server restarts, it it possible that 
some transaction requires manual 
   > intervention. The listPreparedTransactions() method lists the transactions 
which are in the prepared states (the transactions are represented as opaque 
Base64 Strings.) To commit or rollback a given prepared transaction, the 
commitPreparedTransaction() or rollbackPreparedTransaction() method can be used 
to resolve heuristic transactions. Heuristically completed transactions can be 
listed using the listHeuristicCommittedTransactions() and 
listHeuristicRolledBackTransactions methods."
   
   In my case here, I called it like this: 
   
   > curl -u admin:admin 
"http://localhost:8161/console/jolokia/exec/org.apache.activemq.artemis:broker=%220.0.0.0%22/listPreparedTransactionDetailsAsJSON()"
   
   And like this: 
   
   > curl -u admin:admin 
"http://localhost:8161/console/jolokia/exec/org.apache.activemq.artemis:broker=%220.0.0.0%22/listPreparedTransactionDetailsAsHTML()"
                                                  [21:07:49]
   > 
{"request":{"mbean":"org.apache.activemq.artemis:broker=\"0.0.0.0\"","type":"exec","operation":"listPreparedTransactionDetailsAsHTML()"},"value":"<h3>***
 Prepared Transaction Details ***<\/h3><p>No 
entry.<\/p>","timestamp":1551125316,"status":200}
   
   So, it looks like no one has ever been in a situation that used this 
functionality.
   
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 203876)
    Time Spent: 3h 50m  (was: 3h 40m)

> Useless statement in public synchronized List<MessageReference> 
> RefsOperation#getRelatedMessageReferences()
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-2183
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2183
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>            Reporter: Jiri Daněk
>            Priority: Trivial
>          Time Spent: 3h 50m
>  Remaining Estimate: 0h
>
> {code}
>    @Override
>    public synchronized List<MessageReference> getRelatedMessageReferences() {
>       List<MessageReference> listRet = new LinkedList<>();
>       listRet.addAll(listRet);  // 🐟
>       return listRet;
>    }
> {code}
> https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java#L184
> The method returns empty list, which may be wrong (looking at the method 
> name). There is absolutely nothing gained by adding content of empty inst 
> into itself, as in {{listRet.addAll(listRet)}}.
> Doing the addAll thing can be an error under ErrorProne compiler.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to