Changeset beb0879


Ignore:
Timestamp:
Feb 5, 2019 3:19:29 PM (18 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
8a77db1
Parents:
6f75680
Message:

Router: OutNetMessage? cleanup (ticket #2386)

File:
1 edited

Legend:

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

    r6f75680 rbeb0879  
    3030 */
    3131public class OutNetMessage implements CDPQEntry {
    32     private final Log _log;
    3332    private final RouterContext _context;
    3433    private final RouterInfo _target;
     
    5150    private long _enqueueTime;
    5251    private long _seqNum;
     52    private final boolean _shouldTimestamp;
    5353    /** for debugging, contains a mapping of even name to Long (e.g. "begin sending", "handleOutbound", etc) */
    5454    private HashMap<String, Long> _timestamps;
     
    9797    public OutNetMessage(RouterContext context, I2NPMessage msg, long expiration, int priority, RouterInfo target) {
    9898        _context = context;
    99         _log = context.logManager().getLog(OutNetMessage.class);
    10099        _message = msg;
    101100        if (msg != null) {
     
    114113        //_createdBy = new Exception("Created by");
    115114        _created = context.clock().now();
    116         if (_log.shouldLog(Log.INFO))
     115        Log log = context.logManager().getLog(OutNetMessage.class);
     116        _shouldTimestamp = log.shouldLog(Log.INFO);
     117        if (_shouldTimestamp)
    117118            timestamp("Created");
    118119        //_context.messageStateMonitor().outboundMessageAdded();
     
    129130     * @return how long this message has been 'in flight'
    130131     */
    131     public long timestamp(String eventName) {
    132         long now = _context.clock().now();
    133         if (_log.shouldLog(Log.INFO)) {
     132    public void timestamp(String eventName) {
     133        if (_shouldTimestamp) {
    134134            // only timestamp if we are debugging
     135            long now = _context.clock().now();
    135136            synchronized (this) {
    136137                locked_initTimestamps();
     
    143144            }
    144145        }
    145         return now - _created;
    146146    }
    147147
     
    149149    @Deprecated
    150150    public Map<String, Long> getTimestamps() {
    151         if (_log.shouldLog(Log.INFO)) {
     151        if (_shouldTimestamp) {
    152152            synchronized (this) {
    153153                locked_initTimestamps();
     
    161161    @Deprecated
    162162    public Long getTimestamp(String eventName) {
    163         if (_log.shouldLog(Log.INFO)) {
     163        if (_shouldTimestamp) {
    164164            synchronized (this) {
    165165                locked_initTimestamps();
     
    391391        if (_onFailedSend != null)
    392392            buf.append(" with onFailedSend job: ").append(_onFailedSend);
    393         if (_timestamps != null && _timestampOrder != null && _log.shouldLog(Log.INFO)) {
     393        if (_timestamps != null && _timestampOrder != null) {
    394394            buf.append(" {timestamps: \n");
    395395            renderTimestamps(buf);
Note: See TracChangeset for help on using the changeset viewer.