if (engines!=null){ // it will be null unless remoteStop = true System.out.println("Exitting remote servers"); Iterator it = engines.iterator(); while(it.hasNext()){ JMeterEngine e = (JMeterEngine) it.next(); e.exit(); } }
synchronized (allSamplers) { Iterator i = allSamplers.iterator(); while (i.hasNext()) { JavaSampler sampler = (JavaSampler) i.next(); sampler.releaseJavaClient(); i.remove(); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/JMeter.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
Method name: void run() Method name: void testEnded()
Number of AST nodes: 6 Number of AST nodes: 6
1
if (engines!=null){ // it will be null unless remoteStop = true
2
				System.out.println("Exitting remote servers");
1
synchronized (allSamplers) {
3
				Iterator it = engines.iterator();
2
			Iterator i = allSamplers.iterator();
4
				while(it.hasNext()){
3
			while (i.hasNext()) {
5
					JMeterEngine e = (JMeterEngine) it.next();
4
				JavaSampler sampler = (JavaSampler) i.next();
6
					e.exit();
5
				
7
				}
6
sampler.releaseJavaClient();
7
				i.remove();
8
			}
8
			}
9
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in different classes
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)4.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    System.out.println("Exitting remote servers");
                                                                                                      
    5
    Iterator it = engines.iterator();
    5
    Iterator it = engines.iterator();
    3
    Iterator i = allSamplers.iterator();
    Differences
    Expression1Expression2Difference
    itiVARIABLE_NAME_MISMATCH
    enginesallSamplersVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.SetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable engines does not match with type java.util.Set of variable allSamplers
    • Make classes java.util.List and java.util.Set extend a common superclass
    3
    Iterator i = allSamplers.iterator();
    6
    while (it.hasNext())
    6
    while (it.hasNext())
    4
    while (i.hasNext())
    Differences
    Expression1Expression2Difference
    itiVARIABLE_NAME_MISMATCH
    4
    while (i.hasNext())
                                                                                              
    5
    JavaSampler sampler = (JavaSampler)i.next();
    Preondition Violations
    Unmatched statement JavaSampler sampler=(JavaSampler)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    JavaSampler sampler = (JavaSampler)i.next();
                                                                  
    6
    sampler.releaseJavaClient();
    Preondition Violations
    Unmatched statement sampler.releaseJavaClient(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    sampler.releaseJavaClient();
                                
    7
    i.remove();
    Preondition Violations
    Unmatched statement i.remove(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    i.remove();
    7
    JMeterEngine e = (JMeterEngine)it.next();
    7
    JMeterEngine e = (JMeterEngine)it.next();
    Preondition Violations
    Unmatched statement JMeterEngine e=(JMeterEngine)it.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                        
    8
    e.exit();
                            
    Precondition Violations (5)
    Row Violation
    1Type java.util.List of variable engines does not match with type java.util.Set of variable allSamplers
    2Unmatched statement JavaSampler sampler=(JavaSampler)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement sampler.releaseJavaClient(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement i.remove(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement JMeterEngine e=(JMeterEngine)it.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted