Skip to content

Commit 3a103ac

Browse files
committed
Call beginRequest on innerMostDelegate
1 parent 446b47e commit 3a103ac

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/main/java/org/apache/commons/dbcp2/DelegatingConnection.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,17 @@ public void abort(final Executor executor) throws SQLException {
131131
protected void activate() {
132132
closed = false;
133133
setLastUsed();
134-
if (beginRequest != null && connection != null) {
135-
try {
136-
beginRequest.invoke(connection);
137-
} catch (InvocationTargetException | IllegalAccessException ex) {
138-
log.warn("Error calling beginRequest on connection", ex);
139-
}
140-
}
134+
141135
if (connection instanceof DelegatingConnection) {
142136
((DelegatingConnection<?>) connection).activate();
137+
} else {
138+
if (beginRequest != null && connection != null) {
139+
try {
140+
beginRequest.invoke(connection);
141+
} catch (InvocationTargetException | IllegalAccessException ex) {
142+
log.warn("Error calling beginRequest on connection", ex);
143+
}
144+
}
143145
}
144146
}
145147

src/test/java/org/apache/commons/dbcp2/TesterConnection.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,10 @@ public <T> T unwrap(final Class<T> iface) throws SQLException {
425425
throw new SQLException("Not implemented.");
426426
}
427427

428-
@Override
429428
public void beginRequest() {
430429
beginRequestCount.incrementAndGet();
431430
}
432431

433-
@Override
434432
public void endRequest() {
435433
endRequestCount.incrementAndGet();
436434
}

0 commit comments

Comments
 (0)