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 | } | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 13 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 7 |
Time elapsed for statement mapping (ms) | 28.2 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | ensureRegionRootExists(); |
| 1 | errorIfClosed(); | |||||||||||||
|
| 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()); | ||||||||||||||
|
| 5 | autoFlushIfRequired(loader.getQuerySpaces()); | ||||||||||||||
|
| 6 | dontFlushFromFind++; | ||||||||||||||
| 7 | try | |||||||||||||||
|
| 8 | return loader.scroll(this, scrollMode); |
Row | Violation |
---|---|
1 | Expression ensureRegionRootExists() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression ensureRegionRootExists() is a void method call, and thus it cannot be parameterized |
3 | Expression errorIfClosed() is a void method call, and thus it cannot be parameterized |
4 | Unmatched statement checkTransactionSynchStatus(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | 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 |
6 | Unmatched statement autoFlushIfRequired(loader.getQuerySpaces()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
7 | Unmatched statement dontFlushFromFind++; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
8 | Unmatched return loader.scroll(this,scrollMode); |
9 | The 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 |