Created
January 28, 2017 10:08
-
-
Save dilunika/5563b5a9e1114e48e021f6c7c03067af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JdbcUtil { | |
private static JDBCClient jdbcClient; | |
public static void initialize(Vertx vertx) { | |
JsonObject config = vertx.getOrCreateContext().config(); | |
if(jdbcClient == null) { | |
final JsonObject jdbcConfig = new JsonObject() | |
.put("url", config.getString(DB_URL, "jdbc:postgresql://localhost/majan")) | |
.put("driver_class", config.getString(DB_DRIVER_CLASS, "org.postgresql.Driver")) | |
.put("max_pool_size", config.getInteger(DB_MAX_POOL_SIZE, 30)); | |
jdbcClient = JDBCClient.createShared(io.vertx.rxjava.core.Vertx.newInstance(vertx),jdbcConfig); | |
} | |
} | |
public static JDBCClient databaseClient() { | |
return jdbcClient; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment