@Override public String getCacheWriter() { Object o = this.ra.getCacheWriter(); if (o == null) { return ""; } else { return o.toString(); } }
@Override public boolean isMappingSynchronous(String regionName, Cache cache) { Region<?, ?> region = cache.getRegion(regionName); if (region == null) { throw new IllegalStateException("Region for mapping could not be found."); } // If our region has a Jdbc Writer set as the cache writer then we know it is syncronous return region.getAttributes().getCacheWriter() != null && region.getAttributes().getCacheWriter() instanceof JdbcWriter; }
@Test public void executeFunctionGivenARegionWithNonJdbcWriterDoesNotRemoveTheWriter() { when(regionAttributes.getCacheWriter()).thenReturn(mock(CacheWriter.class)); when(service.getMappingForRegion(eq(regionName))).thenReturn(mapping); function.executeFunction(context); verify(regionMutator, never()).setCacheWriter(null); }
@Test public void executeFunctionGivenARegionWithJdbcWriterRemovesTheWriter() { when(regionAttributes.getCacheWriter()).thenReturn(mock(JdbcWriter.class)); when(service.getMappingForRegion(eq(regionName))).thenReturn(mapping); function.executeFunction(context); verify(regionMutator, times(1)).setCacheWriter(null); }
new Object[] {this.pr.getName()})); if (n.isCacheWriterAttached() && pr.getAttributes().getCacheWriter() == null) { throw new IllegalStateException( String.format( new Object[] {this.pr.getName()})); if (!n.isCacheWriterAttached() && pr.getAttributes().getCacheWriter() != null) { throw new IllegalStateException( String.format(
CacheWriter writer = ra.getCacheWriter(); if (writer != null) { allCacheWriters.add(writer.toString());
(ExportLogsCacheWriter) region.getAttributes().getCacheWriter();
throw new RuntimeException("CacheLoader are not the same"); if (!equal(this.cacheWriter, other.getCacheWriter())) { throw new RuntimeException("CacheWriter is not the same");
if (regAttrs.getCacheWriter() != null) { cacheWriteClassName = regAttrs.getCacheWriter().getClass().getCanonicalName();
CacheWriter<?, ?> cacheWriter = ra.getCacheWriter();
generate(CACHE_WRITER, attrs.getCacheWriter());
private void cleanupRegionAndQueue(Cache cache, String regionName) { String queueName = CreateMappingCommand.createAsyncEventQueueName(regionName); Region<?, ?> region = cache.getRegion(regionName); if (region != null) { CacheLoader<?, ?> loader = region.getAttributes().getCacheLoader(); if (loader instanceof JdbcLoader) { region.getAttributesMutator().setCacheLoader(null); } CacheWriter<?, ?> writer = region.getAttributes().getCacheWriter(); if (writer instanceof JdbcWriter) { region.getAttributesMutator().setCacheWriter(null); } Set<String> queueIds = region.getAttributes().getAsyncEventQueueIds(); if (queueIds.contains(queueName)) { region.getAttributesMutator().removeAsyncEventQueueId(queueName); } } InternalAsyncEventQueue queue = (InternalAsyncEventQueue) cache.getAsyncEventQueue(queueName); if (queue != null) { queue.stop(); queue.destroy(); } } }
byte writerByte = (byte) (getAttributes().getCacheWriter() != null ? 0x02 : 0x00); this.node.setLoaderWriterByte((byte) (loaderByte + writerByte)); } else {
this.asyncEventQueueIds = new HashSet<String>(attrs.getAsyncEventQueueIds()); this.cacheLoader = attrs.getCacheLoader(); this.cacheWriter = attrs.getCacheWriter(); this.entryIdleTimeout = attrs.getEntryIdleTimeout(); this.customEntryIdleTimeout = attrs.getCustomEntryIdleTimeout();
assignCacheWriter(attrs.getCacheWriter()); this.regionTimeToLive = attrs.getRegionTimeToLive().getTimeout(); this.regionTimeToLiveExpirationAction = attrs.getRegionTimeToLive().getAction();
this.regionAttributes.cacheWriter = regionAttributes.getCacheWriter(); this.regionAttributes.regionTimeToLive = regionAttributes.getRegionTimeToLive().getTimeout(); this.regionAttributes.regionTimeToLiveExpirationAction =
this.cacheWriterDesc = getDesc(attr.getCacheWriter()); this.cacheListenerDescs = getDescs(attr.getCacheListeners()); this.keyConstraint = attr.getKeyConstraint();
RegionAttributes attrs = factory.create(); assertNull(attrs.getCacheLoader()); assertNull(attrs.getCacheWriter()); assertNull(attrs.getCacheListener()); assertEquals(Arrays.asList(new CacheListener[0]), Arrays.asList(attrs.getCacheListeners()));
if (parentIsUserSpecified) { if (parentWithHas.hasCacheWriter()) { setCacheWriter(parent.getCacheWriter()); setCacheWriter(parent.getCacheWriter());
AtomicReference<CacheWriter<K, V>> cacheWriter = new AtomicReference<>(baseRegionAttributes.getCacheWriter()); .when(mockAttributesMutator).setCacheLoader(any(CacheLoader.class)); doAnswer(newSetter(cacheWriter, baseRegionAttributes.getCacheWriter())) .when(mockAttributesMutator).setCacheWriter(any(CacheWriter.class)); when(mockRegionAttributes.getCacheWriter()).thenAnswer(newGetter(cacheWriter::get)); when(mockRegionAttributes.getCloningEnabled()).thenAnswer(newGetter(cloningEnabled::get)); when(mockRegionAttributes.getCompressor()).thenAnswer(newGetter(baseRegionAttributes::getCompressor));