Last active
August 29, 2015 14:12
-
-
Save maxant/c013fa6e8cc99bca5d52 to your computer and use it in GitHub Desktop.
Extra bits related to persistence
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
private static final String SQL = "INSERT INTO SALES (BUYER_NAME, SELLER_NAME, PRODUCT_ID, PRICE, QUANTITY, PO_ID, SO_ID) VALUES (?, ?, ?, ?, ?, ?, ?)"; | |
private static final ConnectionPool<MySQLConnection> POOL; | |
static { | |
Duration connectTimeout = Duration.apply(5.0, TimeUnit.SECONDS); | |
Duration testTimeout = Duration.apply(5.0, TimeUnit.SECONDS); | |
Configuration configuration = new Configuration("root", Main.DB_HOST, 3306, Option.apply("password"), Option.apply("TRADER"), io.netty.util.CharsetUtil.UTF_8, 16777216, PooledByteBufAllocator.DEFAULT, connectTimeout, testTimeout); | |
MySQLConnectionFactory factory = new MySQLConnectionFactory(configuration); | |
POOL = new ConnectionPool<MySQLConnection>(factory, new PoolConfiguration(1000, 4, 1000, 4000), Main.system.dispatcher()); | |
} | |
private static interface PersistenceComplete { | |
void apply(Throwable failure); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment