Package com.foundationdb.sql.pg

Examples of com.foundationdb.sql.pg.PostgresServer


    protected Map<String, String> startupConfigProperties() {
        return uniqueStartupConfigProperties(PostgresMTBase.class);
    }

    protected Connection createConnection() throws SQLException {
        PostgresServer server = serviceManager().getServiceByClass(PostgresService.class).getServer();
        int retry = 0;
        while(!server.isListening()) {
            if(retry == 1) {
                LOG.warn("Postgres server not listening. Waiting...");
            } else if(retry == 5) {
                fail("Postgres server still not listening. Giving up.");
            }
            try {
                Thread.sleep(200);
            } catch(InterruptedException ex) {
                LOG.error("caught an interrupted exception; re-interrupting", ex);
                Thread.currentThread().interrupt();
            }
            ++retry;
        }
        int port = server.getPort();
        if(port <= 0) {
            throw new IllegalStateException("port not set.");
        }
        String url = String.format(CONNECTION_URL, server.getHost(), port);
        return DriverManager.getConnection(url, USER_NAME, USER_PASSWORD);
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.sql.pg.PostgresServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.