Changeset b984748


Ignore:
Timestamp:
Sep 4, 2012 1:50:24 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
9fd2f1e
Parents:
5347d29
Message:

OutNetMessage?: Speedup after profiling (ticket #707 - thx dg, kytv, zab)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/OutNetMessage.java

    r5347d29 rb984748  
    3333    private RouterInfo _target;
    3434    private I2NPMessage _message;
    35     /** cached message class name, for use after we discard the message */
    36     private String _messageType;
    3735    private int _messageTypeId;
    3836    /** cached message ID, for use after we discard the message */
     
    149147        _message = msg;
    150148        if (msg != null) {
    151             _messageType = msg.getClass().getSimpleName();
    152149            _messageTypeId = msg.getType();
    153150            _messageId = msg.getUniqueId();
     
    157154   
    158155    /**
     156     *  For debugging only.
    159157     *  @return the simple class name
    160158     */
    161     public String getMessageType() { return _messageType; }
     159    public String getMessageType() {
     160        I2NPMessage msg = _message;
     161        return msg != null ? msg.getClass().getSimpleName() : "null";
     162    }
    162163
    163164    public int getMessageTypeId() { return _messageTypeId; }
     
    273274        if (_log.shouldLog(Log.DEBUG)) {
    274275            long timeToDiscard = _context.clock().now() - _created;
    275             _log.debug("Discard " + _messageSize + "byte " + _messageType + " message after "
     276            _log.debug("Discard " + _messageSize + "byte " + getMessageType() + " message after "
    276277                       + timeToDiscard);
    277278        }
     
    309310        } else {
    310311            buf.append("a ").append(_messageSize).append(" byte ");
    311             buf.append(_messageType);
     312            buf.append(getMessageType());
    312313        }
    313314        buf.append(" expiring on ").append(new Date(_expiration));
Note: See TracChangeset for help on using the changeset viewer.