Changeset d167b5e for core


Ignore:
Timestamp:
Feb 28, 2018 8:04:40 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
74dc427
Parents:
5cd1419
Message:

LogManager?: Don't register runtime shutdown hook in router context.
This was causing shutdown() to be called twice, resulting
in lost log messages when stopped from i2prouter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/util/LogManager.java

    r5cd1419 rd167b5e  
    151151        // In the router context, we have to rotate to a new log file at startup or the logs.jsp
    152152        // page will display the old log.
    153         if (context.isRouterContext())
     153        if (context.isRouterContext()) {
    154154            startLogWriter();
    155         try {
    156             Runtime.getRuntime().addShutdownHook(new ShutdownHook());
    157         } catch (IllegalStateException ise) {
    158             // shutdown in progress, fsck it
    159         }
    160         //System.out.println("Created logManager " + this + " with context: " + context);
     155        } else {
     156            // Only in App Context.
     157            // In Router Context, the router has its own shutdown hook,
     158            // and will call our shutdown() from Router.finalShutdown()
     159            try {
     160                Runtime.getRuntime().addShutdownHook(new ShutdownHook());
     161            } catch (IllegalStateException ise) {
     162                // shutdown in progress
     163            }
     164        }
    161165    }
    162166
Note: See TracChangeset for help on using the changeset viewer.