Skip to content

Commit 64b8913

Browse files
DATAREDIS-988 - Polishing.
Original Pull Request: #453
1 parent ae2042b commit 64b8913

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/main/java/org/springframework/data/redis/core/RedisConnectionUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ private static RedisConnection createConnectionProxy(RedisConnection connection,
187187
*
188188
* @param conn the Redis connection to close.
189189
* @param factory the Redis factory that the connection was created with.
190-
* @deprecated since 2.1.9, use {@link #releaseConnection(RedisConnection, RedisConnectionFactory, boolean)}
190+
* @deprecated since 2.1.10, use {@link #releaseConnection(RedisConnection, RedisConnectionFactory, boolean)} instead.
191191
*/
192192
@Deprecated
193193
public static void releaseConnection(@Nullable RedisConnection conn, RedisConnectionFactory factory) {
@@ -200,11 +200,11 @@ public static void releaseConnection(@Nullable RedisConnection conn, RedisConnec
200200
*
201201
* @param conn the Redis connection to close.
202202
* @param factory the Redis factory that the connection was created with.
203-
* @param enableTransactionSupport whether transaction support is enabled.
203+
* @param transactionSupport whether transaction support is enabled.
204204
* @since 2.1.9
205205
*/
206206
public static void releaseConnection(@Nullable RedisConnection conn, RedisConnectionFactory factory,
207-
boolean enableTransactionSupport) {
207+
boolean transactionSupport) {
208208

209209
if (conn == null) {
210210
return;
@@ -223,23 +223,23 @@ public static void releaseConnection(@Nullable RedisConnection conn, RedisConnec
223223

224224
// release transactional/read-only and non-transactional/non-bound connections.
225225
// transactional connections for read-only transactions get no synchronizer registered
226-
if (enableTransactionSupport && TransactionSynchronizationManager.isCurrentTransactionReadOnly()) {
226+
if (transactionSupport && TransactionSynchronizationManager.isCurrentTransactionReadOnly()) {
227227
if (log.isDebugEnabled()) {
228-
log.debug("Unbinding Redis Connection");
228+
log.debug("Unbinding Redis Connection.");
229229
}
230230
unbindConnection(factory);
231231
} else {
232232

233233
// Not participating in transaction management.
234234
// Connection could have been attached via session callback.
235235
if (log.isDebugEnabled()) {
236-
log.debug("Leaving bound Redis Connection attached");
236+
log.debug("Leaving bound Redis Connection attached.");
237237
}
238238
}
239239

240240
} else {
241241
if (log.isDebugEnabled()) {
242-
log.debug("Closing Redis Connection");
242+
log.debug("Closing Redis Connection.");
243243
}
244244
conn.close();
245245
}

src/test/java/org/springframework/data/redis/core/RedisTemplateUnitTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ public void executeSessionShouldReuseConnection() {
111111
@Nullable
112112
@Override
113113
public <K, V> Object execute(RedisOperations<K, V> operations) throws DataAccessException {
114+
114115
template.multi();
115116
template.multi();
116117
return null;
@@ -129,6 +130,7 @@ public void executeSessionInTransactionShouldReuseConnection() {
129130
template.execute(new SessionCallback<Object>() {
130131
@Override
131132
public <K, V> Object execute(RedisOperations<K, V> operations) throws DataAccessException {
133+
132134
template.multi();
133135
template.multi();
134136
return null;
@@ -146,8 +148,10 @@ public void transactionAwareTemplateShouldReleaseConnection() {
146148
TransactionSynchronizationManager.setCurrentTransactionReadOnly(true);
147149

148150
template.execute(new SessionCallback<Object>() {
151+
149152
@Override
150153
public <K, V> Object execute(RedisOperations<K, V> operations) throws DataAccessException {
154+
151155
template.multi();
152156
template.multi();
153157
return null;

0 commit comments

Comments
 (0)