activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuriy Sidelnikov (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AMQ-4997) Dead code in VMTransport class
Date Sat, 01 Feb 2014 11:26:09 GMT

     [ https://issues.apache.org/jira/browse/AMQ-4997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Yuriy Sidelnikov updated AMQ-4997:
----------------------------------

    Description: 
The object with name DISCONNECT is created as 
private static final Object DISCONNECT = new Object();

so it can't be modified or be overwritten somewhere outside this class.

However this object is used only two times to check if:
public void doDispatch(VMTransport transport, TransportListener transportListener, Object
command) {
        if (command == DISCONNECT) {
            transportListener.onException(new TransportDisposedIOException("Peer (" + peer.toString()
+ ") disposed."));
        } else {
            transport.receiveCounter++;
            transportListener.onCommand(command);
        }
    }

and 
if( command == DISCONNECT ) {
                tl.onException(new TransportDisposedIOException("Peer (" + peer.toString()
+ ") disposed."));
            } else {
                tl.onCommand(command);
            }
so only one branch of ifs will be run.
Seems as some remnant of modification? 

  was:
The object with name DISCONNECT is created as 
private static final Object DISCONNECT = new Object();

so it can't be modified of be overwritten somewhere outside this class.

However this reference is used only two times to check if:
public void doDispatch(VMTransport transport, TransportListener transportListener, Object
command) {
        if (command == DISCONNECT) {
            transportListener.onException(new TransportDisposedIOException("Peer (" + peer.toString()
+ ") disposed."));
        } else {
            transport.receiveCounter++;
            transportListener.onCommand(command);
        }
    }

and 
if( command == DISCONNECT ) {
                tl.onException(new TransportDisposedIOException("Peer (" + peer.toString()
+ ") disposed."));
            } else {
                tl.onCommand(command);
            }
so only one branch of ifs will be run.
Seems as some remnant of modification? 


> Dead code in VMTransport class
> ------------------------------
>
>                 Key: AMQ-4997
>                 URL: https://issues.apache.org/jira/browse/AMQ-4997
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.9.0
>            Reporter: Yuriy Sidelnikov
>            Assignee: Kevin Earls
>            Priority: Minor
>
> The object with name DISCONNECT is created as 
> private static final Object DISCONNECT = new Object();
> so it can't be modified or be overwritten somewhere outside this class.
> However this object is used only two times to check if:
> public void doDispatch(VMTransport transport, TransportListener transportListener, Object
command) {
>         if (command == DISCONNECT) {
>             transportListener.onException(new TransportDisposedIOException("Peer (" +
peer.toString() + ") disposed."));
>         } else {
>             transport.receiveCounter++;
>             transportListener.onCommand(command);
>         }
>     }
> and 
> if( command == DISCONNECT ) {
>                 tl.onException(new TransportDisposedIOException("Peer (" + peer.toString()
+ ") disposed."));
>             } else {
>                 tl.onCommand(command);
>             }
> so only one branch of ifs will be run.
> Seems as some remnant of modification? 



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message