Changeset 4397


Ignore:
Timestamp:
2003-05-29T11:02:00+12:00 (21 years ago)
Author:
jmt12
Message:

Forgot to increment attempt counter for server.exe close down so attempt never timed out.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r4380 r4397  
    712712
    713713    private void stopServerEXE() {
    714     // See if its already exited for some reason.
    715     gsdlsite_cfg.load();
    716     if(gsdlsite_cfg.getURL() != null) {
    717         // Send the command for it to exit.
    718         Gatherer.g_man.preview_pane.configServer(GSDLSiteConfig.QUIT_COMMAND);
    719         // Wait until it exits.
    720         try {
    721         gsdlsite_cfg.load();
    722         int try_again = JOptionPane.YES_OPTION;
    723         while(try_again == JOptionPane.YES_OPTION) {
    724             int count = 0;
    725             while(gsdlsite_cfg.getURL() != null && count < 60) {
    726             synchronized(this) {
    727                 wait(1000);
     714    if(server != null) {
     715        // See if its already exited for some reason.
     716        gsdlsite_cfg.load();
     717        if(gsdlsite_cfg.getURL() != null) {
     718        // Send the command for it to exit.
     719        Gatherer.g_man.preview_pane.configServer(GSDLSiteConfig.QUIT_COMMAND);
     720        // Wait until it exits.
     721        try {
     722            gsdlsite_cfg.load();
     723            int try_again = JOptionPane.YES_OPTION;
     724            while(try_again == JOptionPane.YES_OPTION) {
     725            int attempt_count = 0;
     726            while(gsdlsite_cfg.getURL() != null && attempt_count < 60) {
     727                synchronized(this) {
     728                wait(1000); // Wait one second (give or take)
     729                }
     730                gsdlsite_cfg.load();
     731                attempt_count++;
    728732            }
    729             gsdlsite_cfg.load();
     733            if(attempt_count == 60) {
     734                try_again = JOptionPane.showConfirmDialog(Gatherer.g_man, dictionary.get("Server.QuitTimeOut"), dictionary.get("General.Warning"), JOptionPane.YES_NO_OPTION);
     735            }
     736            else {
     737                try_again = JOptionPane.NO_OPTION;
     738            }
    730739            }
    731             if(count == 60) {
    732             try_again = JOptionPane.showConfirmDialog(Gatherer.g_man, dictionary.get("Server.QuitTimeOut"), dictionary.get("General.Warning"), JOptionPane.YES_NO_OPTION);
     740            if(gsdlsite_cfg.getURL() != null) {
     741            JOptionPane.showMessageDialog(Gatherer.g_man, dictionary.get("Server.QuitManual"), dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    733742            }
    734             else {
    735             try_again = JOptionPane.NO_OPTION;
    736             }
    737         }
    738         if(gsdlsite_cfg.getURL() != null) {
    739             JOptionPane.showMessageDialog(Gatherer.g_man, dictionary.get("Server.QuitManual"), dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    740         }
    741         }
    742         catch (Exception error) {
    743         error.printStackTrace();
    744         }
    745     }
    746     // Restore the gsdlsite_cfg.
    747     if(gsdlsite_cfg != null) {
    748         gsdlsite_cfg.restore();
    749     }
    750     // If the local server is still running then our changed values will get overwritten.
    751     if(gsdlsite_cfg.getURL() != null) {
    752         JOptionPane.showMessageDialog(Gatherer.g_man, dictionary.get("Server.QuitFailed"), dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    753     }
    754     gsdlsite_cfg = null;
     743        }
     744        catch (Exception error) {
     745            error.printStackTrace();
     746        }
     747        }
     748        // Restore the gsdlsite_cfg.
     749        if(gsdlsite_cfg != null) {
     750        gsdlsite_cfg.restore();
     751        }
     752        // If the local server is still running then our changed values will get overwritten.
     753        if(gsdlsite_cfg.getURL() != null) {
     754        JOptionPane.showMessageDialog(Gatherer.g_man, dictionary.get("Server.QuitFailed"), dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     755        }
     756        gsdlsite_cfg = null;
     757        server = null;
     758    }
    755759    }
    756760
Note: See TracChangeset for help on using the changeset viewer.