Changeset 30043 for main/trunk


Ignore:
Timestamp:
2015-07-20T17:51:14+12:00 (9 years ago)
Author:
ak19
Message:

Fixed a bug in shutting down the derbyserver. Noticed on Windows after previewing in GLI and then quitting GLI, the DOS prompt with the tomcat output displayed the message Warning: Derby did not shut down normally. Actually it had shut down but the code re-structure was wrong for when the message gets displayed.

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/sql/derby/DerbySQLServer.java

    r29977 r30043  
    5555
    5656    public boolean disconnect(String databasePath){
     57
     58    // Only shutdown if using embedded derby,
     59    // not if it's a networked derby server, which is what we now use
     60
     61    if(!DRIVER.equals("org.apache.derby.jdbc.EmbeddedDriver")) {
     62        return true;
     63    }
     64
     65    // embedded derby driver
    5766    try{
    58         // Only shutdown if using embedded derby,
    59         // not if it's a networked derby server, which is what we now use
    60 
    61         if(DRIVER.equals("org.apache.derby.jdbc.EmbeddedDriver")) {
    62         String protocol_str = PROTOCOL + databasePath + ";shutdown=true";       
    63         DriverManager.getConnection(protocol_str);
    64         }
     67        String protocol_str = PROTOCOL + databasePath + ";shutdown=true";       
     68        DriverManager.getConnection(protocol_str);
     69       
    6570    }catch (SQLException se){
    6671        String theError = (se).getSQLState();
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java

    r29977 r30043  
    131131    public static void shutdownDatabaseServer()
    132132    {
     133
     134        // shutdown the server if we're using an embedded derby
     135        // if we're a derby client using the derby network server
     136       
     137        if(!DRIVER.equals("org.apache.derby.jdbc.EmbeddedDriver")) {
     138            return;
     139        }
     140
    133141        boolean gotSQLExc = false;
    134 
    135         try
    136         {
    137             //  shutdown the whole server
    138             // but not if we're a derby client using the derby network server
    139             // only if we're using an embedded derby
    140             if(DRIVER.equals("org.apache.derby.jdbc.EmbeddedDriver")) {
    141             DriverManager.getConnection(PROTOCOL + ";shutdown=true");
    142             }
     142        try
     143        {
     144            DriverManager.getConnection(PROTOCOL + ";shutdown=true");
    143145        }
    144146        catch (SQLException se)
Note: See TracChangeset for help on using the changeset viewer.