Changeset 14a839e for router


Ignore:
Timestamp:
Dec 16, 2016 6:01:30 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
ce47d4ea
Parents:
636badc
Message:

synch graceful exit code

File:
1 edited

Legend:

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

    r636badc r14a839e  
    13621362                return; // too late
    13631363            changeState(State.GRACEFUL_SHUTDOWN);
    1364         }
    1365         _gracefulExitCode = exitCode;
     1364            _gracefulExitCode = exitCode;
     1365        }
    13661366        //_config.put(PROP_SHUTDOWN_IN_PROGRESS, "true");
    13671367        _context.throttle().setShutdownStatus();
     
    13811381                return; // too late
    13821382            changeState(State.RUNNING);
    1383         }
    1384         _gracefulExitCode = -1;
     1383            _gracefulExitCode = -1;
     1384        }
    13851385        //_config.remove(PROP_SHUTDOWN_IN_PROGRESS);
    13861386        _context.throttle().cancelShutdownStatus();
     
    13951395     * @return one of the EXIT_* values or -1
    13961396     */
    1397     public int scheduledGracefulExitCode() { return _gracefulExitCode; }
     1397    public int scheduledGracefulExitCode() {
     1398        synchronized(_stateLock) {
     1399            return _gracefulExitCode;
     1400        }
     1401    }
    13981402
    13991403    /**
     
    14021406     */
    14031407    public long getShutdownTimeRemaining() {
    1404         if (_gracefulExitCode <= 0) return -1; // maybe Long.MAX_VALUE would be better?
    1405         if (_gracefulExitCode == EXIT_HARD || _gracefulExitCode == EXIT_HARD_RESTART)
    1406             return 0;
     1408        synchronized(_stateLock) {
     1409            if (_gracefulExitCode <= 0) return -1; // maybe Long.MAX_VALUE would be better?
     1410            if (_gracefulExitCode == EXIT_HARD || _gracefulExitCode == EXIT_HARD_RESTART)
     1411                return 0;
     1412        }
    14071413        long exp = _context.tunnelManager().getLastParticipatingExpiration();
    14081414        if (exp < 0)
Note: See TracChangeset for help on using the changeset viewer.