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 )
|