Skip to content

Commit 26a89c2

Browse files
committed
code cleanups in LogicalConnectionManagedImpl
1 parent 815ada8 commit 26a89c2

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

hibernate-core/src/main/java/org/hibernate/resource/jdbc/internal/LogicalConnectionManagedImpl.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public class LogicalConnectionManagedImpl extends AbstractLogicalConnectionImple
4242
private transient Connection physicalConnection;
4343
private boolean closed;
4444

45-
public LogicalConnectionManagedImpl(JdbcSessionOwner sessionOwner, ResourceRegistry resourceRegistry) {
46-
this.jdbcSessionOwner = sessionOwner;
47-
this.resourceRegistry = resourceRegistry;
45+
public LogicalConnectionManagedImpl(JdbcSessionOwner sessionOwner, ResourceRegistry registry) {
46+
jdbcSessionOwner = sessionOwner;
47+
resourceRegistry = registry;
4848

4949
connectionHandlingMode = determineConnectionHandlingMode( sessionOwner );
5050
if ( connectionHandlingMode.getAcquisitionMode() == IMMEDIATELY ) {
@@ -131,10 +131,10 @@ public void afterStatement() {
131131
super.afterStatement();
132132
if ( connectionHandlingMode.getReleaseMode() == AFTER_STATEMENT ) {
133133
if ( getResourceRegistry().hasRegisteredResources() ) {
134-
CONNECTION_LOGGER.skipConnectionReleaseAfterStatementDueToResources( hashCode() );
134+
CONNECTION_LOGGER.skipConnectionReleaseAfterStatementDueToResources( hashCode() );
135135
}
136136
else {
137-
CONNECTION_LOGGER.initiatingConnectionReleaseAfterStatement( hashCode() );
137+
CONNECTION_LOGGER.initiatingConnectionReleaseAfterStatement( hashCode() );
138138
releaseConnectionIfNeeded();
139139
}
140140
}
@@ -144,7 +144,7 @@ public void afterStatement() {
144144
public void beforeTransactionCompletion() {
145145
super.beforeTransactionCompletion();
146146
if ( connectionHandlingMode.getReleaseMode() == BEFORE_TRANSACTION_COMPLETION ) {
147-
CONNECTION_LOGGER.initiatingConnectionReleaseBeforeTransactionCompletion( hashCode() );
147+
CONNECTION_LOGGER.initiatingConnectionReleaseBeforeTransactionCompletion( hashCode() );
148148
releaseConnectionIfNeeded();
149149
}
150150
}
@@ -157,7 +157,7 @@ public void afterTransaction() {
157157
// - AFTER_STATEMENT cases that were circumvented due to held resources
158158
// - BEFORE_TRANSACTION_COMPLETION cases that were circumvented because a rollback occurred
159159
// (we don't get a beforeTransactionCompletion event on rollback).
160-
CONNECTION_LOGGER.initiatingConnectionReleaseAfterTransaction( hashCode() );
160+
CONNECTION_LOGGER.initiatingConnectionReleaseAfterTransaction( hashCode() );
161161
releaseConnectionIfNeeded();
162162
}
163163
}
@@ -167,7 +167,7 @@ public Connection manualDisconnect() {
167167
if ( closed ) {
168168
throw new ResourceClosedException( "Logical connection is closed" );
169169
}
170-
final Connection connection = physicalConnection;
170+
final var connection = physicalConnection;
171171
releaseConnectionIfNeeded();
172172
return connection;
173173
}
@@ -238,7 +238,7 @@ private void beforeRelease() {
238238
jdbcSessionOwner.beforeReleaseConnection( physicalConnection );
239239
}
240240
catch (SQLException e) {
241-
CONNECTION_LOGGER.errorBeforeReleasingJdbcConnection( hashCode(), e );
241+
CONNECTION_LOGGER.errorBeforeReleasingJdbcConnection( hashCode(), e );
242242
}
243243
}
244244

@@ -256,14 +256,14 @@ public static LogicalConnectionManagedImpl deserialize(ObjectInputStream ois, Jd
256256
public Connection close() {
257257
if ( !closed ) {
258258
getResourceRegistry().releaseResources();
259-
CONNECTION_LOGGER.closingLogicalConnection( hashCode() );
259+
CONNECTION_LOGGER.closingLogicalConnection( hashCode() );
260260
try {
261261
releaseConnectionIfNeeded();
262262
}
263263
finally {
264264
// no matter what
265265
closed = true;
266-
CONNECTION_LOGGER.logicalConnectionClosed( hashCode() );
266+
CONNECTION_LOGGER.logicalConnectionClosed( hashCode() );
267267
}
268268
}
269269
return null;

0 commit comments

Comments
 (0)