Changeset 349255d2


Ignore:
Timestamp:
Mar 28, 2015 10:49:43 AM (6 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
72b9c92
Parents:
ac902ba
Message:

exit code checks and javadocs

File:
1 edited

Legend:

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

    rac902ba r349255d2  
    542542     *
    543543     *  @since public as of 0.9 for Android and other embedded uses
     544     *  @throws IllegalStateException if called more than once
    544545     */
    545546    public synchronized void runRouter() {
     
    10031004     * files, then reboot the router.
    10041005     *
     1006     *  Calls exit(), never returns.
     1007     *
    10051008     *  Not for external use.
    10061009     */
     
    10641067    /**
    10651068     *  Shutdown with no chance of cancellation.
    1066      *  Blocking, will call exit() and not return unless setKillVMOnExit(false) was previously called.
     1069     *  Blocking, will call exit() and not return unless setKillVMOnExit(false) was previously called,
     1070     *  or a final shutdown is already in progress.
    10671071     *  May take several seconds as it runs all the shutdown hooks.
     1072     *
     1073     *  @param exitCode one of the EXIT_* values, non-negative
     1074     *  @throws IllegalArgumentException if exitCode negative
    10681075     */
    10691076    public synchronized void shutdown(int exitCode) {
     1077        if (exitCode < 0)
     1078            throw new IllegalArgumentException();
    10701079        synchronized(_stateLock) {
    10711080            if (_state == State.FINAL_SHUTDOWN_1 ||
     
    10891098     *  Called by the ShutdownHook.
    10901099     *  NOT to be called by others, use shutdown().
     1100     *
     1101     *  @param exitCode one of the EXIT_* values, non-negative
     1102     *  @throws IllegalArgumentException if exitCode negative
    10911103     */
    10921104    public synchronized void shutdown2(int exitCode) {
     1105        if (exitCode < 0)
     1106            throw new IllegalArgumentException();
    10931107        changeState(State.FINAL_SHUTDOWN_2);
    10941108        // help us shut down esp. after OOM
     
    11851199    /**
    11861200     *  Cancel the JVM runtime hook before calling this.
     1201     *
     1202     *  @param exitCode one of the EXIT_* values, non-negative
    11871203     */
    11881204    private synchronized void finalShutdown(int exitCode) {
     
    12331249     * {@link #cancelGracefulShutdown}.
    12341250     *
     1251     * Exit code will be EXIT_GRACEFUL.
     1252     *
    12351253     * Shutdown delay will be from zero to 11 minutes.
    12361254     */
     
    12471265     * Returns silently if a final shutdown is already in progress.
    12481266     *
    1249      * @param exitCode VM exit code
     1267     * @param exitCode one of the EXIT_* values, non-negative
     1268     * @throws IllegalArgumentException if exitCode negative
    12501269     */
    12511270    public void shutdownGracefully(int exitCode) {
     1271        if (exitCode < 0)
     1272            throw new IllegalArgumentException();
    12521273        synchronized(_stateLock) {
    12531274            if (isFinalShutdownInProgress())
     
    12841305    /**
    12851306     * What exit code do we plan on using when we shut down (or -1, if there isn't a graceful shutdown planned)
     1307     *
     1308     * @return one of the EXIT_* values or -1
    12861309     */
    12871310    public int scheduledGracefulExitCode() { return _gracefulExitCode; }
     
    13761399     */
    13771400    public void clockShift(long delta) {
     1401        if (delta > -60*1000 && delta < 60*1000)
     1402            return;
    13781403        synchronized(_stateLock) {
    13791404            if (gracefulShutdownInProgress() || !isAlive())
    13801405                return;
    13811406        }
    1382         if (delta > -60*1000 && delta < 60*1000)
    1383             return;
    13841407        _eventLog.addEvent(EventLog.CLOCK_SHIFT, Long.toString(delta));
    13851408        // update the routing key modifier
     
    14851508     * Context must be available.
    14861509     * Unzip update file found in the router dir OR base dir, to the base dir
     1510     *
     1511     * If successfull, will call exit() and never return.
    14871512     *
    14881513     * If we can't write to the base dir, complain.
Note: See TracChangeset for help on using the changeset viewer.