Skip to content

Instantly share code, notes, and snippets.

@Raidok
Created February 21, 2014 12:40
Show Gist options
  • Save Raidok/9133578 to your computer and use it in GitHub Desktop.
Save Raidok/9133578 to your computer and use it in GitHub Desktop.
How many connections are wasted at each cycle?
public void run() {
try {
openConnections();
...
if (use_expiring) {
openConnections();
...
dl.setConnection(dbm.getWrite().getConnection());
..
}
} finally {
closeConnections();
}
}
private void openConnections() {
connWrite = dbm.getWrite().getConnection();
connRead = dbm.getRead().getConnection();
}
private void closeConnections() {
connWrite.close();
connRead.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment