@Test public void testClearRound() { MeetingRound round = new MeetingRound(); round.setIndex(1l); roundManager.addRound(round); round = new MeetingRound(); round.setIndex(2l); roundManager.addRound(round); round = new MeetingRound(); round.setIndex(3l); roundManager.addRound(round); round = new MeetingRound(); round.setIndex(4l); roundManager.addRound(round); round = new MeetingRound(); round.setIndex(5l); roundManager.addRound(round); round = new MeetingRound(); round.setIndex(6l); roundManager.addRound(round); round = new MeetingRound(); round.setIndex(7l); roundManager.addRound(round); assertEquals(7, roundManager.getRoundList().size()); assertEquals(7L, roundManager.getCurrentRound().getIndex()); boolean success = roundManager.clearRound(3); assert(success); assertEquals(3, roundManager.getRoundList().size()); assertEquals(7L, roundManager.getCurrentRound().getIndex()); }
public boolean clearRound(int count) { Lockers.ROUND_LOCK.lock(); boolean doit = false; try { while (roundList.size() > count) { doit = true; roundList.remove(0); } if (doit) { MeetingRound round = roundList.get(0); round.setPreRound(null); } return true; } finally { Lockers.ROUND_LOCK.unlock(); } }
RoundManager { public boolean clearRound(int count) { Lockers.ROUND_LOCK.lock(); boolean doit = false; try { while (roundList.size() > count) { doit = true; roundList.remove(0); } if (doit) { MeetingRound round = roundList.get(0); round.setPreRound(null); } return true; } finally { Lockers.ROUND_LOCK.unlock(); } } }
RoundManager { public boolean clearRound(int count) { Lockers.ROUND_LOCK.lock(); boolean doit = false; try { while (roundList.size() > count) { doit = true; roundList.remove(0); } if (doit) { MeetingRound round = roundList.get(0); round.setPreRound(null); } return true; } finally { Lockers.ROUND_LOCK.unlock(); } } RoundManager(Chain chain); }
RoundManager { public boolean clearRound(int count) { Lockers.ROUND_LOCK.lock(); boolean doit = false; try { while (roundList.size() > count) { doit = true; roundList.remove(0); } if (doit) { MeetingRound round = roundList.get(0); round.setPreRound(null); } return true; } finally { Lockers.ROUND_LOCK.unlock(); } } RoundManager(Chain chain); MeetingRound getRoundByIndex(long roundIndex); void addRound(MeetingRound meetingRound); void checkIsNeedReset(); boolean clearRound(int count); MeetingRound getCurrentRound(); MeetingRound initRound(); MeetingRound resetRound(boolean isRealTime); MeetingRound getNextRound(BlockExtendsData roundData, boolean isRealTime); Chain getChain(); List<MeetingRound> getRoundList(); AccountService getAccountService(); }
RoundManager { public boolean clearRound(int count) { Lockers.ROUND_LOCK.lock(); boolean doit = false; try { while (roundList.size() > count) { doit = true; roundList.remove(0); } if (doit) { MeetingRound round = roundList.get(0); round.setPreRound(null); } return true; } finally { Lockers.ROUND_LOCK.unlock(); } } RoundManager(Chain chain); MeetingRound getRoundByIndex(long roundIndex); void addRound(MeetingRound meetingRound); void checkIsNeedReset(); boolean clearRound(int count); MeetingRound getCurrentRound(); MeetingRound initRound(); MeetingRound resetRound(boolean isRealTime); MeetingRound getNextRound(BlockExtendsData roundData, boolean isRealTime); Chain getChain(); List<MeetingRound> getRoundList(); AccountService getAccountService();  }