Changeset 26911

Show
Ignore:
Timestamp:
21.02.2013 14:01:29 (7 years ago)
Author:
davidb
Message:

Introduction of a shutdown method (which shuts down the complete server, not just a connection to a particular database). This function is used in the cleanUp sequence of calls, triggered when the servlet is stopped. Done to avoid 'warning thread still running [derby.antiGC] ... possible memory leak' message reported in catalina.out

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java

    r25856 r26911  
    8787    public void closeDatabase() 
    8888    { 
    89         state = null; 
    90         conn = null; 
     89            //state = null; 
     90        //conn = null; 
    9191        boolean gotSQLExc = false; 
    9292        try 
    93         { 
    94             DriverManager.getConnection(protocol_str + ";shutdown=true"); 
    95         } 
     93            { 
     94            //  shutdown the database 
     95            DriverManager.getConnection(protocol_str + ";shutdown=true"); 
     96             
     97            } 
    9698        catch (SQLException se) 
    9799        { 
    98             gotSQLExc = true; 
    99         } 
     100            // this is good (i.e. what Derby is designed to do on a successful shutdown) 
     101            gotSQLExc = true; 
     102        } 
     103        catch (Exception e) { 
     104            e.printStackTrace(); 
     105        } 
     106 
    100107        if (!gotSQLExc) 
    101108        { 
    102             System.out.println("Database did not shut down normally"); 
    103         } 
    104     } 
     109            System.err.println("Warning: Derby Database did not shut down normally"); 
     110        } 
     111    } 
     112 
     113       public static void shutdownDatabaseServer() 
     114       { 
     115       boolean gotSQLExc = false; 
     116 
     117       try { 
     118           //  shutdown the whole server 
     119           DriverManager.getConnection(PROTOCOL + ";shutdown=true"); 
     120            
     121       } 
     122       catch (SQLException se) { 
     123           // this is good (i.e. what Derby is designed to do on a successful shutdown) 
     124           gotSQLExc = true; 
     125           //System.out.println("Shutdown returned: " + se); 
     126       } 
     127       catch (Exception e) { 
     128 
     129           e.printStackTrace(); 
     130       } 
     131       if (!gotSQLExc) { 
     132           System.err.println("Warning: Derby did not shut down normally"); 
     133       } 
     134 
     135       } 
    105136 
    106137    public void createDatabase()