ensureRegionRootExists(); // Don't hold the JBC node lock throughout the tx, as that // prevents reads and other updates Transaction tx = suspend(); try { // TODO Why not use the timestamp in a DataVersion? Option opt = getNonLockingDataVersionOption(false); // We ensure ASYNC semantics (JBCACHE-1175) opt.setForceAsynchronous(true); CacheHelper.put(getCacheInstance(), getRegionFqn(), key, value, opt); } catch (Exception e) { throw new CacheException(e); } finally { resume(tx); }
errorIfClosed(); checkTransactionSynchStatus(); String entityName = criteria.getEntityOrClassName(); CriteriaLoader loader = new CriteriaLoader( getOuterJoinLoadable(entityName), factory, criteria, entityName, getEnabledFilters() ); autoFlushIfRequired( loader.getQuerySpaces() ); dontFlushFromFind++; try { return loader.scroll(this, scrollMode); } finally { dontFlushFromFind--; }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/timestamp/TimestampsRegionImpl.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/impl/SessionImpl.java
Method name: void put(Object, Object) Method name: ScrollableResults scroll(CriteriaImpl, ScrollMode)
Number of AST nodes: 6 Number of AST nodes: 8
1
ensureRegionRootExists();
1
e
2
        // Don't hold the JBC node lock throughout the tx, as that
3
        // prevents reads and other updates
4
        Transaction tx = suspend();
5
        try {
6
            // TODO Why not use the timestamp in a DataVersion?
7
            Option opt = getNonLockingDataVersionOption(false);
8
            // We ensure ASYNC semantics (JBCACHE-1175)
9
            opt.setForceAsynchronous(true);
10
            CacheHelper.put(getCacheInstan
2
rrorIfClosed();
3
		checkTransactionSynchStatus();
4
		String entityName = criteria.getEntityOrClassName();
5
		CriteriaLoader loader = new CriteriaLoader(
6
				getOuterJoinLoadable(entityName),
7
				factory,
8
				criteria,
9
				entityName,
10
				getEnabledFilters()
11
		);
11
ce(), getRegionFqn(), key, value, opt);
12
		autoFlushIfRequired( loader.getQuerySpaces()
12
        } catch (Exception e) {
13
            throw new CacheException(e);
14
        } finally {
15
            resume(tx);
16
        
13
 );
14
		dontFlushFromFind++;
15
		try {
16
			return loader.scroll(this, scrollMode);
17
		}
18
		finally {
19
			dontFlushFromFind--;
17
}
20
		}
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 comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment7
    Time elapsed for statement mapping (ms)28.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    ensureRegionRootExists();
    1
    ensureRegionRootExists();
    1
    errorIfClosed();
    Differences
    Expression1Expression2Difference
    ensureRegionRootExistserrorIfClosedMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression ensureRegionRootExists() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ensureRegionRootExists() is a void method call, and thus it cannot be parameterized
    Expression errorIfClosed() is a void method call, and thus it cannot be parameterized
    1
    errorIfClosed();
                                                                      
    2
    checkTransactionSynchStatus();
    Preondition Violations
    Unmatched statement checkTransactionSynchStatus(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2
    checkTransactionSynchStatus();
    2
    Transaction tx = suspend();
                                                            
                                                                                                              
    3
    String entityName = criteria.getEntityOrClassName();
    3
    try
                
    4
    Option opt = getNonLockingDataVersionOption(false);
                                                                                                            
    5
    opt.setForceAsynchronous(true);
                                                                        
    6
    CacheHelper.put(getCacheInstance(), getRegionFqn(), key, value, opt);
                                                                                                                                            
                                                                                                                                                                                                                                                                
    4
    CriteriaLoader loader = new CriteriaLoader(getOuterJoinLoadable(entityName), factory, criteria, entityName, getEnabledFilters());
    Preondition Violations
    Unmatched statement CriteriaLoader loader=new CriteriaLoader(getOuterJoinLoadable(entityName),factory,criteria,entityName,getEnabledFilters()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    CriteriaLoader loader = new CriteriaLoader(getOuterJoinLoadable(entityName), factory, criteria, entityName, getEnabledFilters());
                                                                                                    
    5
    autoFlushIfRequired(loader.getQuerySpaces());
    Preondition Violations
    Unmatched statement autoFlushIfRequired(loader.getQuerySpaces()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    autoFlushIfRequired(loader.getQuerySpaces());
                                                  
    6
    dontFlushFromFind++;
    Preondition Violations
    Unmatched statement dontFlushFromFind++; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    dontFlushFromFind++;
                
    7
    try
                                                                                      
    8
    return loader.scroll(this, scrollMode);
    Preondition Violations
    Unmatched return loader.scroll(this,scrollMode);
    8
    return loader.scroll(this, scrollMode);
    Precondition Violations (9)
    Row Violation
    1Expression ensureRegionRootExists() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ensureRegionRootExists() is a void method call, and thus it cannot be parameterized
    3Expression errorIfClosed() is a void method call, and thus it cannot be parameterized
    4Unmatched statement checkTransactionSynchStatus(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement CriteriaLoader loader=new CriteriaLoader(getOuterJoinLoadable(entityName),factory,criteria,entityName,getEnabledFilters()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement autoFlushIfRequired(loader.getQuerySpaces()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched statement dontFlushFromFind++; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched return loader.scroll(this,scrollMode);
    9The refactoring of the clones is infeasible, because classes org.hibernate.cache.jbc2.timestamp.TimestampsRegionImpl and org.hibernate.impl.SessionImpl do not have a common superclass