org.hibernate.cache.spi.access.CollectionRegionAccessStrategy Java Examples

The following examples show how to use org.hibernate.cache.spi.access.CollectionRegionAccessStrategy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: J2CacheAccessStrategyFactoryImpl.java    From J2Cache with Apache License 2.0 6 votes vote down vote up
public CollectionRegionAccessStrategy createCollectionRegionAccessStrategy(J2CacheCollectionRegion collectionRegion, AccessType accessType) {
    switch (accessType) {
        case READ_ONLY:
            if (collectionRegion.getCacheDataDescription().isMutable()) {
                LOG.readOnlyCacheConfiguredForMutableEntity(collectionRegion.getName());
            }
            return new ReadOnlyJ2CacheCollectionRegionAccessStrategy(collectionRegion, collectionRegion.getSettings());
        case READ_WRITE:
            return new ReadWriteJ2CacheCollectionRegionAccessStrategy(collectionRegion, collectionRegion.getSettings());
        case NONSTRICT_READ_WRITE:
            return new NonStrictReadWriteJ2CacheCollectionRegionAccessStrategy(collectionRegion, collectionRegion.getSettings());
        case TRANSACTIONAL:
            return new TransactionalJ2CacheCollectionRegionAccessStrategy(collectionRegion, collectionRegion.getJ2Cache(), collectionRegion.getSettings());
        default:
            throw new IllegalArgumentException("unrecognized access strategy type [" + accessType + "]");
    }
}
 
Example #2
Source File: CollectionRegionImpl.java    From hibernate4-memcached with Apache License 2.0 6 votes vote down vote up
@Override
	public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
		switch ( accessType ) {
			case READ_ONLY:
				if ( getCacheDataDescription().isMutable() ) {
					LOG.warnf( "read-only cache configured for mutable collection [ %s ]", getName() );
				}
				return new ReadOnlyCollectionRegionAccessStrategy( this );
			case READ_WRITE:
				 return new ReadWriteCollectionRegionAccessStrategy( this );
			case NONSTRICT_READ_WRITE:
				return new NonstrictReadWriteCollectionRegionAccessStrategy( this );
			case TRANSACTIONAL:
				return new TransactionalCollectionRegionAccessStrategy( this );
//				throw new UnsupportedOperationException( "doesn't support this access strategy" );
			default:
				throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );
		}
	}
 
Example #3
Source File: RedissonCollectionRegion.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    if (accessType == AccessType.READ_ONLY) {
        return new ReadOnlyCollectionRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.READ_WRITE) {
        return new ReadWriteCollectionRegionAccessStrategy(settings, this, mapCache);
    }
    if (accessType == AccessType.NONSTRICT_READ_WRITE) {
        return new NonStrictReadWriteCollectionRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.TRANSACTIONAL) {
        return new TransactionalCollectionRegionAccessStrategy(settings, this);
    }
    
    throw new CacheException("Unsupported access strategy: " + accessType);
}
 
Example #4
Source File: RedissonCollectionRegion.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    if (accessType == AccessType.READ_ONLY) {
        return new ReadOnlyCollectionRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.READ_WRITE) {
        return new ReadWriteCollectionRegionAccessStrategy(settings, this, mapCache);
    }
    if (accessType == AccessType.NONSTRICT_READ_WRITE) {
        return new NonStrictReadWriteCollectionRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.TRANSACTIONAL) {
        return new TransactionalCollectionRegionAccessStrategy(settings, this);
    }
    
    throw new CacheException("Unsupported access strategy: " + accessType);
}
 
Example #5
Source File: RedissonCollectionRegion.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    if (accessType == AccessType.READ_ONLY) {
        return new ReadOnlyCollectionRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.READ_WRITE) {
        return new ReadWriteCollectionRegionAccessStrategy(settings, this, mapCache);
    }
    if (accessType == AccessType.NONSTRICT_READ_WRITE) {
        return new NonStrictReadWriteCollectionRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.TRANSACTIONAL) {
        return new TransactionalCollectionRegionAccessStrategy(settings, this);
    }
    
    throw new CacheException("Unsupported access strategy: " + accessType);
}
 
Example #6
Source File: J2CacheAccessStrategyFactoryImpl.java    From J2Cache with Apache License 2.0 6 votes vote down vote up
public CollectionRegionAccessStrategy createCollectionRegionAccessStrategy(J2CacheCollectionRegion collectionRegion, AccessType accessType) {
    switch (accessType) {
        case READ_ONLY:
            if (collectionRegion.getCacheDataDescription().isMutable()) {
                LOG.readOnlyCacheConfiguredForMutableEntity(collectionRegion.getName());
            }
            return new ReadOnlyJ2CacheCollectionRegionAccessStrategy(collectionRegion, collectionRegion.getSettings());
        case READ_WRITE:
            return new ReadWriteJ2CacheCollectionRegionAccessStrategy(collectionRegion, collectionRegion.getSettings());
        case NONSTRICT_READ_WRITE:
            return new NonStrictReadWriteJ2CacheCollectionRegionAccessStrategy(collectionRegion, collectionRegion.getSettings());
        case TRANSACTIONAL:
            return new TransactionalJ2CacheCollectionRegionAccessStrategy(collectionRegion, collectionRegion.getJ2Cache(), collectionRegion.getSettings());
        default:
            throw new IllegalArgumentException("unrecognized access strategy type [" + accessType + "]");
    }
}
 
Example #7
Source File: CollectionMemcachedRegion.java    From hibernate4-memcached with Apache License 2.0 5 votes vote down vote up
@Override
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    switch (accessType) {
        case READ_ONLY:
            return new ReadOnlyCollectionRegionAccessStrategy(this);
        case NONSTRICT_READ_WRITE:
            return new NonstrictReadWriteCollectionRegionAccessStrategy(this);
        default:
            throw new CacheException("Unsupported access strategy : " + accessType + ".");
    }
}
 
Example #8
Source File: NonstopAccessStrategyFactory.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
@Override
public CollectionRegionAccessStrategy createCollectionRegionAccessStrategy(J2CacheCollectionRegion collectionRegion, AccessType accessType) {
    return new NonstopAwareCollectionRegionAccessStrategy(this.actualFactory.createCollectionRegionAccessStrategy(collectionRegion, accessType ), HibernateNonstopCacheExceptionHandler.getInstance());
}
 
Example #9
Source File: HibernateCollectionRegion.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    return new AccessStrategy(createAccessStrategy(accessType));
}
 
Example #10
Source File: HibernateCollectionRegion.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    return new AccessStrategy(createAccessStrategy(accessType));
}
 
Example #11
Source File: NonstopAwareCollectionRegionAccessStrategy.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public NonstopAwareCollectionRegionAccessStrategy(CollectionRegionAccessStrategy actualStrategy, HibernateNonstopCacheExceptionHandler hibernateNonstopExceptionHandler) {
    this.actualStrategy = actualStrategy;
    this.hibernateNonstopExceptionHandler = hibernateNonstopExceptionHandler;
}
 
Example #12
Source File: J2CacheCollectionRegion.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
@Override
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    return this.getAccessStrategyFactory().createCollectionRegionAccessStrategy(this, accessType);
}
 
Example #13
Source File: NonstopAwareCollectionRegionAccessStrategy.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public NonstopAwareCollectionRegionAccessStrategy(CollectionRegionAccessStrategy actualStrategy, HibernateNonstopCacheExceptionHandler hibernateNonstopExceptionHandler) {
    this.actualStrategy = actualStrategy;
    this.hibernateNonstopExceptionHandler = hibernateNonstopExceptionHandler;
}
 
Example #14
Source File: NonstopAccessStrategyFactory.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
@Override
public CollectionRegionAccessStrategy createCollectionRegionAccessStrategy(J2CacheCollectionRegion collectionRegion, AccessType accessType) {
    return new NonstopAwareCollectionRegionAccessStrategy(actualFactory.createCollectionRegionAccessStrategy(collectionRegion, accessType), HibernateNonstopCacheExceptionHandler.getInstance());
}
 
Example #15
Source File: J2CacheCollectionRegion.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
@Override
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    return getAccessStrategyFactory().createCollectionRegionAccessStrategy(this, accessType);
}
 
Example #16
Source File: J2CacheAccessStrategyFactory.java    From J2Cache with Apache License 2.0 votes vote down vote up
CollectionRegionAccessStrategy createCollectionRegionAccessStrategy(J2CacheCollectionRegion collectionRegion, AccessType accessType); 
Example #17
Source File: J2CacheAccessStrategyFactory.java    From J2Cache with Apache License 2.0 votes vote down vote up
CollectionRegionAccessStrategy createCollectionRegionAccessStrategy(J2CacheCollectionRegion collectionRegion, AccessType accessType);