KeyHolder { private synchronized void merge() { if (merged.get()) { return; } merged.set(true); } KeyHolder(); void initialize(int size); int size(); void requireMerge(); boolean isRequireMerge(); boolean isMerged(); void waitForMerge(); void waitForMerge(int timeout); Number getKey(); Number getKey(int index); @Deprecated Map<String, Object> getKeys(); Map<String, Object> getUniqueKey(); List<Map<String, Object>> getKeyList(); List<Number> getIdList(); void addKeys(List<Map<String, Object>> keys); void addKey(Map<String, Object> key); static Hints prepareLocalHints(DaoTask<?> task, Hints hints); static void mergePartial(DaoTask<?> task, KeyHolder originalHolder, Integer[] indexList,
                                    KeyHolder localHolder, Throwable error); static void mergePartial(DaoTask<?> task, KeyHolder originalHolder, KeyHolder localHolder, Throwable error); void addEmptyKeys(int count); void addPatial(Integer[] indexList, KeyHolder tmpHolder); static void setGeneratedKeyBack(DaoTask<?> task, Hints hints, List<?> rawPojos); static final String NOT_SET; }
@Test(timeout = 1000) public void testMerge() throws InterruptedException { KeyHolder keyHolder = new KeyHolder(); KeyHolder tmp = new KeyHolder(); keyHolder.waitForMerge(1); keyHolder.addPatial(new Integer[]{}, tmp); keyHolder.waitForMerge(); }