()
| 202 | } |
| 203 | |
| 204 | @Override |
| 205 | void verify() throws Exception { |
| 206 | super.verify(); |
| 207 | |
| 208 | // verify 时,所有任务都执行完毕,不需要考虑并发。 |
| 209 | var name = Table1Long2Add1.class.getName(); |
| 210 | var app = Simulate.getInstance().randApp().app; // 任何一个app都能查到相同的结果。 |
| 211 | var success = getSuccessCounter(name).sum(); |
| 212 | var sum = 0L; |
| 213 | for (var it = getKeyCounters(name).keyIterator(); it.hasNext(); ) { |
| 214 | for (int tryCount = 10; ; ) { |
| 215 | try { |
| 216 | var key = it.next(); |
| 217 | var v1 = app.demo_Module1.getTable1().selectDirty(key); |
| 218 | if (v1 == null) |
| 219 | Simulate.logger.warn("app.demo_Module1.getTable1().selectDirty({}) = null", key); |
| 220 | else { |
| 221 | var v = v1.getLong2(); |
| 222 | sum += v; |
| 223 | if (debugTradeSum) |
| 224 | Simulate.logger.info("--- key:{} value:{}", key, v); |
| 225 | } |
| 226 | break; |
| 227 | } catch (GoBackZeze e) { |
| 228 | if (--tryCount <= 0) |
| 229 | throw e; |
| 230 | try { |
| 231 | //noinspection BusyWait |
| 232 | Thread.sleep(200); |
| 233 | } catch (InterruptedException ex) { |
| 234 | throw new RuntimeException(ex); |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | if (success != sum) { |
| 240 | var a = new OutLong(); |
| 241 | app.demo_Module1.getTable1().walk((k, v) -> { |
| 242 | a.value += v.getLong2(); |
| 243 | return true; |
| 244 | }); |
| 245 | Simulate.logger.error("Table1Long2Add1 verify failed: {} != {} (walk:{}, commitCount:{})", |
| 246 | success, sum, a.value, commitCount.sum()); |
| 247 | } |
| 248 | Assert.assertEquals(success, sum); |
| 249 | Simulate.logger.debug("{}.verify OK!", name); |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | static class Table1List9AddOrRemove extends Task { |
nothing calls this directly
no test coverage detected