From: William K. <wk...@ei...> - 2006-04-20 16:17:14
|
So it looks like you're starting the server from the main thread. When the Server is fully started, can your swing app respond to UI events? -----Original Message----- From: Kuntz, Tim [mailto:tim...@pa...] Sent: Thursday, April 20, 2006 10:16 AM To: hsq...@li... Subject: RE: [Hsqldb-user] starting and stopping a server instance via a Swing app Sorry for the delayed reply... we just start the org.hsqldb.Server start() in the current thread but then block the thread with the blockForState() method to determine when it has fully started. -----Original Message----- From: hsq...@li... [mailto:hsq...@li...] On Behalf Of William Krick Sent: Wednesday, April 19, 2006 9:48 AM To: hsq...@li... Subject: RE: [Hsqldb-user] starting and stopping a server instance via a Swing app Did you start the server in its own thread? -----Original Message----- From: Kuntz, Tim [mailto:tim...@pa...] Sent: Wednesday, April 19, 2006 9:29 AM To: hsq...@li... Subject: RE: [Hsqldb-user] starting and stopping a server instance via a Swing app We used the polling mechanism as follows... (where getState() returns org.hsqldb.Server getState() value and ) ... getServer().start(); blockForState(SERVER_ONLINE /* 1 */); ... protected void blockForState(int desiredState) throws HsqldbTimeoutException { long start = makeSystemCurrentTimeMillis(); while (getState() != desiredState) { try { threadSleep(getSleepTimeMillis()); long elapsedTime = calculateElapsedTime(start); if (elapsedTime >= getSpecifiedTimeoutMillis()) { throw new HsqldbTimeoutException("Hsqldb server did not start. Waited " + elapsedTime + " ms."); } } catch (InterruptedException e) { // ignore interruptions } } } I'm no expert though. -----Original Message----- From: hsq...@li... [mailto:hsq...@li...] On Behalf Of William Krick Sent: Tuesday, April 18, 2006 5:15 PM To: hsq...@li... Subject: RE: [Hsqldb-user] starting and stopping a server instance via a Swing app The problem is that the Server instance still needs to be inside its own thread. Or at least, I think it does, unless something has changed since I wrote my code. TestBase doesn't really address that problem. I see this in the Server documentation... "In order to discover the success or failure of this operation, server state must be polled or a subclass of Server must be used that overrides the setState method to provide state change notification." I really don't know what that means in terms of code. -----Original Message----- From: fredt [mailto:fr...@us...] Sent: Tuesday, April 18, 2006 6:02 PM To: hsq...@li... Subject: Re: [Hsqldb-user] starting and stopping a server instance via a Swing app For starting the server programmatically check out the org.hsqldb.test.TestBase class as an example. We do need to write a How-to on this as a lot of functionality has been added to Server. Fred ----- Original Message ----- From: "William Krick" <wk...@ei...> To: <hsq...@li...> Sent: 18 April 2006 22:31 Subject: [Hsqldb-user] starting and stopping a server instance via a Swing app Our current app, is using HSQLDB 1.7.3. We developed an admittedly crude Swing database administrator tool when we first started using HSQLDB back with version 1.7.0... To start the database, it calls server.main() and spins off an instance of the HSQLDB server in its own thread, then waits in a loop until a connection can be made. To stop the database, it executes the sql "SHUTDOWN" command on the database and waits in a loop until connections to the database fail. Of course, we need to use the "server.no_system_exit" property so that the database doesn't take down the Swing app with it. This has served us well up to this point and we have had no major complaints. However, along with my attempted switch to 1.8.0, I wanted to re-visit this part of our app and see if anything has changed that will significantly simplify and/or improve on what we are currently doing. I'm particularly embarassed by the "wait in a loop" part on startup and shutdown and I'm hoping that there's a better/more elegant way to do this now. Any advice? ... Krick ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Hsqldb-user mailing list Hsq...@li... https://lists.sourceforge.net/lists/listinfo/hsqldb-user ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Hsqldb-user mailing list Hsq...@li... https://lists.sourceforge.net/lists/listinfo/hsqldb-user ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Hsqldb-user mailing list Hsq...@li... https://lists.sourceforge.net/lists/listinfo/hsqldb-user ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=k&kid0709&bid&3057&dat1642 _______________________________________________ Hsqldb-user mailing list Hsq...@li... https://lists.sourceforge.net/lists/listinfo/hsqldb-user ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Hsqldb-user mailing list Hsq...@li... https://lists.sourceforge.net/lists/listinfo/hsqldb-user ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=k&kid0709&bid&3057&dat1642 _______________________________________________ Hsqldb-user mailing list Hsq...@li... https://lists.sourceforge.net/lists/listinfo/hsqldb-user |