()
| 38 | } |
| 39 | |
| 40 | public synchronized long createId() throws Exception { |
| 41 | while (true) { |
| 42 | |
| 43 | long newId = getNow(); |
| 44 | if (newId == lastId) { |
| 45 | |
| 46 | Thread.sleep(1); |
| 47 | continue; |
| 48 | } else if (newId < lastId) { |
| 49 | |
| 50 | err("Time of your pc seemed to be changed..."); |
| 51 | } |
| 52 | return lastId = newId; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | private long getNow() throws Exception { |
| 57 | return System.currentTimeMillis(); |
no test coverage detected