X Tutup
Skip to content

Commit fa7224f

Browse files
committed
implement a workaround for GemStone internal Bug 42963: ensure: block executed twice (don't return from ensure: block)
1 parent 27ae1e2 commit fa7224f

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed
Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
*grease-gemstone-core
22
doTransaction: aBlock
3-
"Evaluate aBlock in a transaction.
3+
"Evaluate aBlock in a transaction.
44
Return true if the transaction succeeds and false if the transaction fails.
55
Nested calls are allowed and will always return true.
66
See System class>>transactionConflicts for dealing with failed transactions."
77

8-
"Ensure that each block evaluation is mutually exclusive: https://code.google.com/p/glassdb/issues/detail?id=355"
9-
self transactionMutex critical: [
10-
"Get the transactionMutex, and perform the transaction."
11-
System inTransaction
12-
ifTrue: [ "We already are in a transaction, so just evaluate the block"
13-
aBlock value.
14-
^ true]
15-
ifFalse:[
16-
[
17-
self doBeginTransaction.
18-
aBlock value
19-
] ensure: [ ^self doCommitTransaction]]]
20-
8+
"Ensure that each block evaluation is mutually exclusive: https://code.google.com/p/glassdb/issues/detail?id=355"
9+
10+
self transactionMutex
11+
critical: [
12+
| commitResult |
13+
"Get the transactionMutex, and perform the transaction."
14+
System inTransaction
15+
ifTrue: [
16+
"We already are in a transaction, so just evaluate the block"
17+
aBlock value.
18+
^ true ]
19+
ifFalse: [
20+
[
21+
self doBeginTransaction.
22+
aBlock value ]
23+
ensure: [
24+
"workaround for Bug 42963: ensure: block executed twice (don't return from ensure: block)"
25+
commitResult := self doCommitTransaction ] ].
26+
^ commitResult ]

repository/Grease-GemStone-Core.package/GRGemStonePlatform.class/methodProperties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"doAbortTransaction" : "dkh 11/06/2009 08:41",
1717
"doBeginTransaction" : "dkh 11/06/2009 08:41",
1818
"doCommitTransaction" : "dkh 11/06/2009 08:41",
19-
"doTransaction:" : "JohanBrichau 03/21/2014 17:45",
19+
"doTransaction:" : "dkh 12/21/2014 16:11",
2020
"ensureExistenceOfFolder:" : "DaleHenrichs 12/03/2010 16:28",
2121
"filesIn:" : "DaleHenrichs 09/02/2010 15:45",
2222
"isProcessTerminated:" : "dkh 11/06/2009 08:41",

0 commit comments

Comments
 (0)
X Tutup