use of org.lastaflute.jta.dbcp.ConnectionWrapper in project lastaflute by lastaflute.
the class ConnectionPoolViewBuilder method setupTransactionViewListByReflection.
protected void setupTransactionViewListByReflection(ConnectionPool pool, List<String> txViewList) {
final Field field = DfReflectionUtil.getWholeField(pool.getClass(), "txActivePool");
@SuppressWarnings("unchecked") final Map<Transaction, ConnectionWrapper> txActivePool = (Map<Transaction, ConnectionWrapper>) DfReflectionUtil.getValueForcedly(field, pool);
synchronized (pool) {
// just in case
for (Entry<Transaction, ConnectionWrapper> entry : txActivePool.entrySet()) {
final Transaction tx = entry.getKey();
final ConnectionWrapper wrapper = entry.getValue();
final String romantic;
if (tx instanceof RomanticTransaction) {
romantic = ((RomanticTransaction) tx).toRomanticSnapshot(wrapper);
} else {
romantic = tx.toString();
}
txViewList.add(romantic);
}
}
}
Aggregations