if (!block.yield(ctx, larg).isTrue()) { synchronized (result) { result.append(larg); } }
if (threadService.getCritical()) { // If the target thread is sleeping or stopped, wake it synchronized (this) { notify(); } // interrupt the target thread in case it's blocking or waiting // WARNING: We no longer interrupt the target thread, since this usually means // interrupting IO and with NIO that means the channel is no longer usable. // We either need a new way to handle waking a target thread that's waiting // on IO, or we need to accept that we can't wake such threads and must wait // for them to complete their operation. //threadImpl.interrupt(); }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/RubyEnumerable.java File path: /jruby-1.4.0/src/org/jruby/RubyThread.java
Method name: IRubyObject call(ThreadContext, IRubyObject[], Block) Method name: IRubyObject join(IRubyObject[])
Number of AST nodes: 3 Number of AST nodes: 3
1
if (!block.yield(ctx, larg).isTrue()) {
1
if (
2
                    synchronized (result) {
3
                        result.append(larg);
4
                    }
5
    
2
threadService.getCritical()) {
3
                // If the target thread is sleeping or stopped, wake it
4
                synchronized (this) {
5
                    notify();
6
                }
7
                
8
                // interrupt the target thread in case it's blocking or waiting
9
                // WARNING: We no longer interrupt the target thread, since this usually means
10
                // interrupting IO and with NIO that means the channel is no longer usable.
11
                // We either need a new way to handle waking a target thread that's waiting
12
                // on IO, or we need to accept that we can't wake such threads and must wait
13
                // for them to complete their operation.
14
                //threadImpl.interrupt();
6
            }
15
            }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons5
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)171.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (!block.yield(ctx, larg).isTrue())
    2
    if (!block.yield(ctx, larg).isTrue())
    13
    if (threadService.getCritical())
    Differences
    Expression1Expression2Difference
    !block.yield(ctx,larg).isTrue()threadService.getCritical()TYPE_COMPATIBLE_REPLACEMENT
    13
    if (threadService.getCritical())
    3
    synchronized (result)
    3
    synchronized (result)
    14
    synchronized (this)
    Differences
    Expression1Expression2Difference
    resultthisTYPE_COMPATIBLE_REPLACEMENT
    14
    synchronized (this)
    4
    result.append(larg);
                                                  
                              
    15
    notify();
    3
    synchronized (result)
    3
    synchronized (result)
    14
    synchronized (this)
    Differences
    Expression1Expression2Difference
    resultthisTYPE_COMPATIBLE_REPLACEMENT
    14
    synchronized (this)
    Precondition Violations (0)
    Row Violation