avoid the racing condition
This commit is contained in:
		
							parent
							
								
									46b48a5460
								
							
						
					
					
						commit
						dd0dcc870d
					
				@ -37,12 +37,7 @@ public class TestProcStat extends SigarTestCase {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        long[] pids = sigar.getProcList();
 | 
					        long[] pids = sigar.getProcList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //oh-no a racing condition!
 | 
					        assertTrue(stat.getTotal() > 1);
 | 
				
			||||||
        //possible for this test to fail under normal 
 | 
					 | 
				
			||||||
        //conditions if the process table changes in between.
 | 
					 | 
				
			||||||
        //if this is a real problem, can just change to:
 | 
					 | 
				
			||||||
        //assertTrue(stat.getTotal() > 1);
 | 
					 | 
				
			||||||
        assertTrue(pids.length == stat.getTotal());
 | 
					 | 
				
			||||||
        traceln(stat.toString());
 | 
					        traceln(stat.toString());
 | 
				
			||||||
        SigarProxy proxy = SigarProxyCache.newInstance(getSigar());
 | 
					        SigarProxy proxy = SigarProxyCache.newInstance(getSigar());
 | 
				
			||||||
        traceln(CurrentProcessSummary.get(proxy).toString());
 | 
					        traceln(CurrentProcessSummary.get(proxy).toString());
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user