org.hsqldb.server.ServerConstants Java Examples

The following examples show how to use org.hsqldb.server.ServerConstants. 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 File: HsqlServer.java    From c2mon with 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 File: StartHsqldbMojo.java    From hsqldb-maven-plugin with 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);
    }
}