Java Code Examples for org.hsqldb.server.ServerConstants

The following examples show how to use org.hsqldb.server.ServerConstants. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: c2mon   Source File: HsqlServer.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@PreDestroy
public void stop() {
  if (server != null && server.getState() == ServerConstants.SERVER_STATE_ONLINE) {
    log.info("Stopping HSQL server...");
    server.stop();
  }
}
 
Example 2
Source Project: hsqldb-maven-plugin   Source File: StartHsqldbMojo.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void doExecute() throws MojoExecutionException {
    try {
        if (isRunning()) {
            if (failIfAlreadyRunning) {
                throw new MojoExecutionException("Failed to start the HSQLDB server, the server is already running on " + getConnectionURI());
            }
            getLog().warn("HSQLDB server is already running on " + getConnectionURI());
            return;
        } else {
            // try to start it
            if (server != null) {
                server.setDaemon(true);
                server.start();
                switch (server.getState()) {
                case ServerConstants.SERVER_STATE_CLOSING:
                case ServerConstants.SERVER_STATE_SHUTDOWN:
                    if (failIfAlreadyRunning) {
                        throw new MojoExecutionException("Failed to start the HSQLDB server");
                    }
                    break;
                }
                getLog().info("HSQLDB server started on " + getConnectionURI());
            } else {
                throw new MojoExecutionException("Failed to start the HSQLDB server");
            }
        }
    } catch (Exception e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }
}