()
| 120 | } |
| 121 | |
| 122 | @Test |
| 123 | public void testBank() throws Exception { |
| 124 | createAccounts(); |
| 125 | logger.debug(Arrays.toString(uids.toArray())); |
| 126 | |
| 127 | ExecutorService totalEx = Executors.newSingleThreadExecutor(); |
| 128 | totalEx.execute(this::runTotalInLoop); |
| 129 | totalEx.shutdown(); |
| 130 | |
| 131 | ExecutorService txnEx = Executors.newCachedThreadPool(); |
| 132 | for (int i = 0; i < 10; i++) { |
| 133 | txnEx.execute(this::txnLoop); |
| 134 | } |
| 135 | txnEx.shutdown(); |
| 136 | |
| 137 | if (!txnEx.awaitTermination(5, TimeUnit.MINUTES)) { |
| 138 | logger.debug("Timeout elapsed"); |
| 139 | } |
| 140 | totalEx.awaitTermination(5, TimeUnit.SECONDS); |
| 141 | } |
| 142 | |
| 143 | static class Account { |
| 144 | int bal; |
nothing calls this directly
no test coverage detected