Skip to content

Commit 119b79f

Browse files
committed
Merge fix-stackoverflow
2 parents 10f89a4 + b14041a commit 119b79f

File tree

1 file changed

+10
-0
lines changed
  • smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc

1 file changed

+10
-0
lines changed

smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,13 +1199,15 @@ private DeliveredOrder getOldestNewOrderForDistrict(
11991199
final List<NewOrder> matchingNewOrders =
12001200
registry
12011201
.select(ctx, new NewOrder())
1202+
/* TODO this code causes a StackOverflowError for some reason
12021203
.matching(
12031204
new Registry.Matcher<NewOrder>() {
12041205
@Override
12051206
public boolean match(NewOrder entity) {
12061207
return entity.getNo_w_id() == w_id && entity.getNo_d_id() == d_id;
12071208
}
12081209
})
1210+
*/
12091211
.sortedBy(
12101212
new Comparator<NewOrder>() {
12111213
@Override
@@ -1214,6 +1216,14 @@ public int compare(final NewOrder a, final NewOrder b) {
12141216
}
12151217
})
12161218
.get();
1219+
/* Manually remove non-matching NewOrders, see above... */
1220+
final Iterator<NewOrder> it = matchingNewOrders.iterator();
1221+
while (it.hasNext()) {
1222+
final NewOrder no = it.next();
1223+
if (no.getNo_w_id() != w_id || no.getNo_d_id() != d_id) it.remove();
1224+
}
1225+
logger.debug("matchingNewOrders={}", matchingNewOrders);
1226+
12171227
/*
12181228
* [TPC-C 2.7.4.2 (3) (continued)]
12191229
* ... If no matching row is found, then the delivery of an order

0 commit comments

Comments
 (0)