* or a new one otherwise.
* @param dbi the IDBI instance from which to obtain the handle
*/
public static Handle getHandle(IDBI dbi)
{
Handle bound = (Handle) TransactionSynchronizationManager.getResource(dbi);
if (bound == null) {
bound = dbi.open();
if (TransactionSynchronizationManager.isSynchronizationActive()) {
TransactionSynchronizationManager.bindResource(dbi, bound);
TransactionSynchronizationManager.registerSynchronization(new Adapter(dbi, bound));