奇数线程
| 76 | * 奇数线程 |
| 77 | */ |
| 78 | public static class JiNum implements Runnable { |
| 79 | |
| 80 | private TwoThread number; |
| 81 | |
| 82 | public JiNum(TwoThread number) { |
| 83 | this.number = number; |
| 84 | } |
| 85 | |
| 86 | @Override |
| 87 | public void run() { |
| 88 | while (number.start <= 1000) { |
| 89 | |
| 90 | if (!number.flag) { |
| 91 | try { |
| 92 | LOCK.lock(); |
| 93 | System.out.println(Thread.currentThread().getName() + "+-+" + number.start); |
| 94 | number.start++; |
| 95 | number.flag = true; |
| 96 | |
| 97 | |
| 98 | } finally { |
| 99 | LOCK.unlock(); |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | } |
nothing calls this directly
no outgoing calls
no test coverage detected