Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.1.8, 2.1.9
-
None
-
Normal
-
Patch available
Description
On some J2EE servers (WebSphere, SAP NetWeaver), HSQLDB server that is started with Cocoon is not shut down properly when an application is stopped.
For some reason even though the server stops, the DB's lock and log files remain locked and that prevents the database startup when the application is started again.
If the ServerImpl for HSQLDB block explicitely closes all the databases, the locks are released and the problem does not occur.
To close the databases, the following code was added to cocoon-2.1.9\src\blocks\hsqldb\java\org\apache\cocoon\components\hsqldb\ServerImpl.java
@@ -35,6 +35,9 @@ import org.apache.avalon.framework.threa
import org.apache.cocoon.Constants;
import org.apache.cocoon.components.thread.RunnableManager;
+import org.hsqldb.Database; /** Only needed for a close mode constant */
+import org.hsqldb.DatabaseManager;
+
/**
* This class runs an instance of the HSQLDB HSQL protocol network database server.
*
@@ -145,6 +148,8 @@ if (null != runnableManager)
/** Stop the server */
public void stop() {
getLogger().debug("Shutting down HSQLDB");
+ DatabaseManager.closeDatabases(Database.CLOSEMODE_COMPACT);
hsqlServer.stop();
getLogger().debug("Shutting down HSQLDB: Done");
}
For some reason even though the server stops, the DB's lock and log files remain locked and that prevents the database startup when the application is started again.
If the ServerImpl for HSQLDB block explicitely closes all the databases, the locks are released and the problem does not occur.
To close the databases, the following code was added to cocoon-2.1.9\src\blocks\hsqldb\java\org\apache\cocoon\components\hsqldb\ServerImpl.java
@@ -35,6 +35,9 @@ import org.apache.avalon.framework.threa
import org.apache.cocoon.Constants;
import org.apache.cocoon.components.thread.RunnableManager;
+import org.hsqldb.Database; /** Only needed for a close mode constant */
+import org.hsqldb.DatabaseManager;
+
/**
* This class runs an instance of the HSQLDB HSQL protocol network database server.
*
@@ -145,6 +148,8 @@ if (null != runnableManager)
/** Stop the server */
public void stop() {
getLogger().debug("Shutting down HSQLDB");
+ DatabaseManager.closeDatabases(Database.CLOSEMODE_COMPACT);
hsqlServer.stop();
getLogger().debug("Shutting down HSQLDB: Done");
}