public class CollectionRegionAdapter extends BaseTransactionalDataRegionAdapter implements CollectionRegion { private static final Logger log = LoggerFactory.getLogger( CollectionRegionAdapter.class ); public CollectionRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) { super( underlyingCache, settings, metadata ); if ( underlyingCache instanceof OptimisticCache ) { ( ( OptimisticCache ) underlyingCache ).setSource( new OptimisticCacheSourceAdapter( metadata ) ); } } public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { CacheConcurrencyStrategy ccs; if ( AccessType.READ_ONLY.equals( accessType ) ) { if ( metadata.isMutable() ) { log.warn( "read-only cache configured for mutable collection [" + getName() + "]" ); } ccs = new ReadOnlyCache(); } else if ( AccessType.READ_WRITE.equals( accessType ) ) { ccs = new ReadWriteCache(); } else if ( AccessType.NONSTRICT_READ_WRITE.equals( accessType ) ) { ccs = new NonstrictReadWriteCache(); } else if ( AccessType.TRANSACTIONAL.equals( accessType ) ) { ccs = new TransactionalCache(); } else { throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" ); } ccs.setCache( underlyingCache ); return new CollectionAccessStrategyAdapter( this, ccs, settings );
public class EntityRegionAdapter extends BaseTransactionalDataRegionAdapter implements EntityRegion { private static final Logger log = LoggerFactory.getLogger( EntityRegionAdapter.class ); public EntityRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) { super( underlyingCache, settings, metadata ); if ( underlyingCache instanceof OptimisticCache ) { ( ( OptimisticCache ) underlyingCache ).setSource( new OptimisticCacheSourceAdapter( metadata ) ); } } public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { CacheConcurrencyStrategy ccs; if ( AccessType.READ_ONLY.equals( accessType ) ) { if ( metadata.isMutable() ) { log.warn( "read-only cache configured for mutable entity [" + getName() + "]" ); } ccs = new ReadOnlyCache(); } else if ( AccessType.READ_WRITE.equals( accessType ) ) { ccs = new ReadWriteCache(); } else if ( AccessType.NONSTRICT_READ_WRITE.equals( accessType ) ) { ccs = new NonstrictReadWriteCache(); } else if ( AccessType.TRANSACTIONAL.equals( accessType ) ) { ccs = new TransactionalCache(); } else { throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" ); } ccs.setCache( underlyingCache ); return new EntityAccessStrategyAdapter( this, ccs, settings );
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cache/impl/bridge/CollectionRegionAdapter.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cache/impl/bridge/EntityRegionAdapter.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class CollectionRegionAdapter extends BaseTransactionalDataRegionAdapter implements CollectionRegion {
1
public class EntityRegionAdapter extends BaseTransactionalDataRegionAdapter implements EntityRegion {
2
	private static final Logger log = LoggerFactory.getLogger( CollectionRegionAdapter.class );
2
	private static final Logger log = LoggerFactory.getLogger( EntityRegionAdapter.class );
3
	public CollectionRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) {
3
	public EntityRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) {
4
		super( underlyingCache, settings, metadata );
4
		super( underlyingCache, settings, metadata );
5
		if ( underlyingCache instanceof OptimisticCache ) {
5
		if ( underlyingCache instanceof OptimisticCache ) {
6
			( ( OptimisticCache ) underlyingCache ).setSource( new OptimisticCacheSourceAdapter( metadata ) );
6
			( ( OptimisticCache ) underlyingCache ).setSource( new OptimisticCacheSourceAdapter( metadata ) );
7
		}
7
		}
8
	}
8
	}
9
	public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
9
	public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
10
		CacheConcurrencyStrategy ccs;
10
		CacheConcurrencyStrategy ccs;
11
		if ( AccessType.READ_ONLY.equals( accessType ) ) {
11
		if ( AccessType.READ_ONLY.equals( accessType ) ) {
12
			if ( metadata.isMutable() ) {
12
			if ( metadata.isMutable() ) {
13
				log.warn( "read-only cache configured for mutable collection [" + getName() + "]" );
13
				log.warn( "read-only cache configured for mutable entity [" + getName() + "]" );
14
			}
14
			}
15
			ccs = new ReadOnlyCache();
15
			ccs = new ReadOnlyCache();
16
		}
16
		}
17
		else if ( AccessType.READ_WRITE.equals( accessType ) ) {
17
		else if ( AccessType.READ_WRITE.equals( accessType ) ) {
18
			ccs = new ReadWriteCache();
18
			ccs = new ReadWriteCache();
19
		}
19
		}
20
		else if ( AccessType.NONSTRICT_READ_WRITE.equals( accessType ) ) {
20
		else if ( AccessType.NONSTRICT_READ_WRITE.equals( accessType ) ) {
21
			ccs = new NonstrictReadWriteCache();
21
			ccs = new NonstrictReadWriteCache();
22
		}
22
		}
23
		else if ( AccessType.TRANSACTIONAL.equals( accessType ) ) {
23
		else if ( AccessType.TRANSACTIONAL.equals( accessType ) ) {
24
			ccs = new TransactionalCache();
24
			ccs = new TransactionalCache();
25
		}
25
		}
26
		else {
26
		else {
27
			throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );
27
			throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );
28
		}
28
		}
29
		ccs.setCache( underlyingCache );
29
		ccs.setCache( underlyingCache );
30
		return new CollectionAccessStrategyAdapter( this, ccs, settings );
30
		return new EntityAccessStrategyAdapter( this, ccs, settings );
31
	
31
	
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0