Daniel John Debrunner <[EMAIL PROTECTED]> writes:

> In NetworkDerbyControlImpl.shutdown() there is code that logs the
> message "DRDA_ShutdownError.S", which is:
>
> Unable to shutdown server on port  {0} on host {1}.
>
> The position of the code looks wrong, it is in a catch block for an
> exception with an if statement to check that the server has looped
> through SHUTDOWN_CHECK_ATTEMPTS.
>
> It seems that really the intention of the code would mean it should be
> logged outside the loop. See the following extracted code, it seems to
> me the code between the MOVE and END-MOVE comments should be moved to
> the end, where the TO-HERE comment is?

I agree. (ntry == SHUTDOWN_CHECK_ATTEMPTS) is always false inside the
loop, so the message is never printed. Moving the code as you
suggested sounds fine. Then the message will be printed if and only if
ping() has returned successfully SHUTDOWN_CHECK_ATTEMPTS times, which
seems to be the intention.

> Dan.
>
> int ntry;
> for (ntry = 0; ntry < SHUTDOWN_CHECK_ATTEMPTS; ntry++)
> {
>    Thread.sleep(SHUTDOWN_CHECK_INTERVAL);
>    try {
>      ping();
>    } catch (Exception e)
>    {
>      // as soon as we can't ping return
>      // MOVE
>      if (ntry == SHUTDOWN_CHECK_ATTEMPTS)
>       consolePropertyMessage("DRDA_ShutdownError.S", new String [] {
>               Integer.toString(portNumber), hostArg});
>      // END-MOVE
>      break;
>    }
> }
> // TO-HERE

-- 
Knut Anders

Reply via email to