Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 27bf779

Browse files
committed
Polishing.
Tweak wording. See #2865 Original pull request: #2870
1 parent a4663d2 commit 27bf779

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

‎src/main/antora/modules/ROOT/pages/redis/transactions.adoc‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ System.out.println("Number of items added to set: " + txResults.get(0));
2525
`RedisTemplate` uses its value, hash key, and hash value serializers to deserialize all results of `exec` before returning.
2626
There is an additional `exec` method that lets you pass a custom serializer for transaction results.
2727

28-
It is worth mentioning that if between the commands multi() and exec() a query timeout exception happens (e.g. in case
29-
Redis is not available to respond fast) then the connection may get stuck in a transactional state. To prevent
30-
such situation you have to control the transaction state:
28+
It is worth mentioning that in case between `multi()` and `exec()` an exception happens (e.g. a timeout exception in case Redis does not respond within the timeout) then the connection may get stuck in a transactional state.
29+
To prevent such a situation need have to discard the transactional state to clear the connection:
3130

3231
[source,java]
3332
----
@@ -40,11 +39,9 @@ List<Object> txResults = redisOperations.execute(new SessionCallback<List<Object
4039
4140
// This will contain the results of all operations in the transaction
4241
return operations.exec();
43-
} finally{
44-
if (transactionStateIsActive) {
45-
LOG.error("Transaction state is active");
42+
} catch (RuntimeException e) {
4643
operations.discard();
47-
}
44+
throw e;
4845
}
4946
}
5047
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /