public class OptimisticReadOnlyAccess extends OptimisticTransactionalAccess { private static final Logger log = LoggerFactory.getLogger(OptimisticReadOnlyAccess.class); /** * Create a new OptimisticReadOnlyAccess. * * @param region The region to which this is providing access */ public OptimisticReadOnlyAccess(CollectionRegionImpl region) { super(region); } @Override public SoftLock lockItem(Object key, Object version) throws CacheException { throw new UnsupportedOperationException("Illegal attempt to edit read only item"); } @Override public SoftLock lockRegion() throws CacheException { throw new UnsupportedOperationException("Illegal attempt to edit read only region"); } @Override public void unlockItem(Object key, SoftLock lock) throws CacheException { log.error("Illegal attempt to edit read only item"); } @Override public void unlockRegion(SoftLock lock) throws CacheException { log.error("Illegal attempt to edit read only region")
public class ReadOnlyAccess extends TransactionalAccess { private static final Logger log = LoggerFactory.getLogger(ReadOnlyAccess.class); /** * Create a provider of read-only access to the specific region. * * @param region The region to which this provides access. */ public ReadOnlyAccess(CollectionRegionImpl region) { super(region); } /** * {@inheritDoc} */ @Override public SoftLock lockItem(Object key, Object version) throws CacheException { throw new UnsupportedOperationException("Illegal attempt to edit read only item"); } /** * {@inheritDoc} */ @Override public SoftLock lockRegion() throws CacheException { throw new UnsupportedOperationException("Illegal attempt to edit read only region"); } /** * {@inheritDoc} */ @Override public void unlockItem(Object key, SoftLock lock) throws CacheException { log.error("Illegal attempt to edit read only item"); } /** * {@inheritDoc} */ @Override public void unlockRegion(SoftLock lock) throws CacheException { log.error("Illegal attempt to edit read only region")
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/collection/OptimisticReadOnlyAccess.java File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/collection/ReadOnlyAccess.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class OptimisticReadOnlyAccess extends OptimisticTransactionalAccess {
1
public class ReadOnlyAccess extends TransactionalAccess {
2

3
    private static final Logger log = LoggerFactory.getLogger(OptimisticReadOnlyAccess.class);
2
    private static final Logger log = LoggerFactory.getLogger(ReadOnlyAccess.class);
4
    /**
5
     * Create a new OptimisticR
3
	/**
6
eadOnlyAccess.
4
	 * Create a provider of read-only access
7
     * 
8
    
5
 to the specific region.
6
	 *
9
 * @param region The region to which this is providing access
7
	 * @param region The region to which this provides access
10
     */
11
    public Optimistic
8
.
9
	 */
12
ReadOnlyAccess(CollectionRegionImpl region) {
10
	public ReadOnlyAccess(CollectionRegionImpl region) {
13
        super(region);
11
        super(region);
14
    }
12
    }
15

16
    
13
    /**
14
	 * {@inheritDoc}
15
	 */
17
@Override
16
	@Override
18
    public SoftLock lockItem(Object key, Object version) throws CacheException {
17
    public SoftLock lockItem(Object key, Object version) throws CacheException {
19
        throw new UnsupportedOperationException("Illegal attempt to edit read only item");
18
        throw new UnsupportedOperationException("Illegal attempt to edit read only item");
20
    }
19
    }
21

22
    
20
    /**
21
	 * {@inheritDoc}
22
	 */
23
@Override
23
	@Override
24
    public SoftLock lockRegion() throws CacheException {
24
    public SoftLock lockRegion() throws CacheException {
25
        throw new UnsupportedOperationException("Illegal attempt to edit read only region");
25
        throw new UnsupportedOperationException("Illegal attempt to edit read only region");
26
    }
26
    }
27

28
    
27
    /**
28
	 * {@inheritDoc}
29
	 */
29
@Override
30
	@Override
30
    public void unlockItem(Object key, SoftLock lock) throws CacheException {
31
    public void unlockItem(Object key, SoftLock lock) throws CacheException {
31
        log.error("Illegal attempt to edit read only item");
32
        log.error("Illegal attempt to edit read only item");
32
    }
33
    }
33

34
    
34
    /**
35
	 * {@inheritDoc}
36
	 */
35
@Override
37
	@Override
36
    public void unlockRegion(SoftLock lock) throws CacheException {
38
    public void unlockRegion(SoftLock lock) throws CacheException {
37
        log.error("Illegal attempt to edit read only region")
39
        log.error("Illegal attempt to edit read only region")
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