/** * Return a cache loader if this region has one. * Note if region's loader is used to implement bridge then null is returned. * @since 5.7 */ public CacheLoader<?, ?> basicGetLoader() { final CacheLoader<?, ?> result = this.cacheLoader; if (result == null) { return null; } if (isBridgeLoader(result)) { return null; } return result; }
/** * Sets the cache loader for the next <code>RegionAttributes</code> created. * * @param cacheLoader * the cache loader or null if no loader * @throws IllegalStateException if this region has a {@link #setPoolName pool name set} */ public void setCacheLoader(CacheLoader<K,V> cacheLoader) { if (cacheLoader != null) { if (AbstractRegion.isBridgeLoader(cacheLoader) && this.regionAttributes.getPoolName() != null) { throw new IllegalStateException("A region with a pool name can not have a BridgeLoader or BridgeClient. Please use pools OR BridgeClient."); } } this.regionAttributes.cacheLoader = cacheLoader; this.regionAttributes.setHasCacheLoader(true); }
public synchronized CacheLoader setCacheLoader(CacheLoader cl) { checkReadiness(); if (cl != null && isBridgeLoader(cl)) { if (getPoolName() != null) { throw new IllegalStateException("A region with a connection pool can not have a BridgeLoader."); } } CacheLoader oldLoader = this.cacheLoader; assignCacheLoader(cl); cacheLoaderChanged(oldLoader); return oldLoader; }
/** * @param region * @return true if the method is called on a region has a {@link Pool}. * @since 6.0 */ private static boolean isClientRegion(Region region) { LocalRegion localRegion = (LocalRegion)region; return (localRegion.hasServerProxy() || AbstractRegion.isBridgeLoader(localRegion.getCacheLoader()) || AbstractRegion .isBridgeWriter(localRegion.getCacheWriter())); }
/** * @param region * @return true if the method is called on a region has a {@link Pool}. * @since 6.0 */ private final boolean isClientRegion(Region region) { LocalRegion localRegion = (LocalRegion) region; return (localRegion.hasServerProxy() || AbstractRegion.isBridgeLoader(localRegion.getCacheLoader()) || AbstractRegion .isBridgeWriter(localRegion.getCacheWriter())); }
&& AbstractRegion.isBridgeLoader(this.regionAttributes.getCacheLoader())) { throw new IllegalStateException("A region with a bridge loader can not have a pool name.");
final CacheLoader cl = r.getAttributes().getCacheLoader(); final CacheWriter cw = r.getAttributes().getCacheWriter(); if (AbstractRegion.isBridgeLoader(cl) || AbstractRegion.isBridgeWriter(cw)) { Object loaderPool = null; Object writerPool = null; if (AbstractRegion.isBridgeLoader(cl)) { if (cl instanceof BridgeLoader) { loaderPool = ((BridgeLoader)cl).getConnectionProxy();
if (attrs.getCacheLoader() != null && AbstractRegion.isBridgeLoader(attrs.getCacheLoader())) { throw new IllegalStateException("A region with a pool name can not have a BridgeLoader or BridgeClient. Please use pools OR BridgeClient.");