/** * Return a cache writer if this region has one. * Note if region's writer is used to implement bridge then null is returned. * @since 5.7 */ public CacheWriter<?, ?> basicGetWriter() { final CacheWriter<?, ?> result = this.cacheWriter; if (result == null) { return null; } if (isBridgeWriter(result)) { return null; } return result; }
/** * Sets the cache writer for the next <code>RegionAttributes</code> created. * * @param cacheWriter * the cache writer or null if no cache writer * @throws IllegalStateException if this region has a {@link #setPoolName pool name set} */ public void setCacheWriter(CacheWriter<K,V> cacheWriter) { if (cacheWriter != null) { if (AbstractRegion.isBridgeWriter(cacheWriter) && this.regionAttributes.getPoolName() != null) { throw new IllegalStateException("A region with a pool name can not have a BridgeWriter or BridgeClient. Please use pools OR BridgeClient."); } } this.regionAttributes.cacheWriter = cacheWriter; this.regionAttributes.setHasCacheWriter(true); }
public synchronized CacheWriter setCacheWriter(CacheWriter cacheWriter) { checkReadiness(); if (cacheWriter != null && isBridgeWriter(cacheWriter)) { if (getPoolName() != null) { throw new IllegalStateException("A region with a connection pool can not have a BridgeWriter."); } } CacheWriter oldWriter = this.cacheWriter; assignCacheWriter(cacheWriter); cacheWriterChanged(oldWriter); return oldWriter; }
/** * @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())); }
/** * @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())); }
&& AbstractRegion.isBridgeWriter(this.regionAttributes.getCacheWriter())) { throw new IllegalStateException("A region with a bridge writer 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.isBridgeWriter(cw)) { writerPool = ((BridgeWriter)cw).getConnectionProxy();
throw new IllegalStateException("A region with a pool name can not have a BridgeLoader or BridgeClient. Please use pools OR BridgeClient."); if (attrs.getCacheWriter() != null && AbstractRegion.isBridgeWriter(attrs.getCacheWriter())) { throw new IllegalStateException("A region with a pool name can not have a BridgeWriter or BridgeClient. Please use pools OR BridgeClient.");