@Test public void testGetGrossProgress() { List<MigrationRoutePair> migrationRoutePairs = new ArrayList<MigrationRoutePair>(); int t = 1, v = 10000 ; for (int i = 0; i < t; i++) { for (int j = 0; j < v; j++) { MigrationRoutePair pair = new MigrationRoutePair(j , "t"+i ); migrationRoutePairs.add( pair ); } } ProgressComputer progressComputer = new ProgressComputer(migrationRoutePairs); int lastProgress = -1; for (int i = 0; i < v ; i++) { boolean need = progressComputer.completeOneVNode( "t0", 0); int progress = progressComputer.getGrossProgress(); lastProgress = progress; } assertEquals("Progress=100", 100,lastProgress); }
public int getGrossProgress() { reentrantLock.lock(); try { return grossProgress; }finally { reentrantLock.unlock(); } }
ProgressComputer { public int getGrossProgress() { reentrantLock.lock(); try { return grossProgress; }finally { reentrantLock.unlock(); } } }
ProgressComputer { public int getGrossProgress() { reentrantLock.lock(); try { return grossProgress; }finally { reentrantLock.unlock(); } } ProgressComputer(List<MigrationRoutePair> migrationRoutePairs); }
ProgressComputer { public int getGrossProgress() { reentrantLock.lock(); try { return grossProgress; }finally { reentrantLock.unlock(); } } ProgressComputer(List<MigrationRoutePair> migrationRoutePairs); synchronized boolean completeOneVNode(String targetNodeId, Integer vnodeId); int getGrossProgress(); int getFinishCount(); int getProgressOfTarget(String tNodeId); }
ProgressComputer { public int getGrossProgress() { reentrantLock.lock(); try { return grossProgress; }finally { reentrantLock.unlock(); } } ProgressComputer(List<MigrationRoutePair> migrationRoutePairs); synchronized boolean completeOneVNode(String targetNodeId, Integer vnodeId); int getGrossProgress(); int getFinishCount(); int getProgressOfTarget(String tNodeId);  }