public void setPersistBackup(boolean persistBackup) { if (persistBackup) { setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); } else { // It is less clear what we should do here for backwards compat. // If the current data policy is persist then we need to change it // otherwise just leave it alone if (getDataPolicy().isPersistentReplicate()) { setDataPolicy(DataPolicy.REPLICATE); } } }
public void setPersistBackup(boolean persistBackup) { if (persistBackup) { if (!getDataPolicy().withPersistence()) { if (getDataPolicy().withPartitioning()) { setDataPolicy(DataPolicy.PERSISTENT_PARTITION); } else { setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); } } } else { // It is less clear what we should do here for backwards compat. // If the current data policy is persist then we need to change it // otherwise just leave it alone if (getDataPolicy().withReplication()) { setDataPolicy(DataPolicy.REPLICATE); } else if (getDataPolicy().withPartitioning()) { setDataPolicy(DataPolicy.PARTITION); } } }
public void setPartitionAttributes(PartitionAttributes pa) { if (pa != null) { if (!hasDataPolicy()) { this.setDataPolicy(PartitionedRegionHelper.DEFAULT_DATA_POLICY); setHasDataPolicy(false); } this.partitionAttributes = pa; setHasPartitionAttributes(true); } }
public void setPartitionAttributes(PartitionAttributes pa) { if (pa != null) { if (!hasDataPolicy()) { this.setDataPolicy(PartitionedRegionHelper.DEFAULT_DATA_POLICY); setHasDataPolicy(false); } this.partitionAttributes = pa; setHasPartitionAttributes(true); } }
public void setMirrorType(MirrorType mirrorType) { DataPolicy dp = mirrorType.getDataPolicy(); if (dp.withReplication()) { // requested a mirror type that has replication // if current data policy is not replicated change it if (!getDataPolicy().withReplication()) { setDataPolicy(dp); } } else { // requested a mirror type none; // if current data policy is replicated change it if (getDataPolicy().withReplication()) { setDataPolicy(dp); } } }
public void setMirrorType(MirrorType mirrorType) { DataPolicy dp = mirrorType.getDataPolicy(); if (dp.withReplication()) { // requested a mirror type that has replication // if current data policy is not replicated change it if (!getDataPolicy().withReplication()) { setDataPolicy(dp); } } else { // requested a mirror type none; // if current data policy is replicated change it if (getDataPolicy().withReplication()) { setDataPolicy(dp); } } }
/** * When a <code>partition-attributes</code> element is finished, the * {@link PartitionAttributes} are on top of the stack followed by the * {@link RegionAttributesCreation} to which the partition attributes are * assigned. */ private void endPartitionAttributes() { PartitionAttributesImpl paf = (PartitionAttributesImpl) stack.pop(); paf.validateAttributes(); RegionAttributesCreation rattrs = peekRegionAttributesContext(PARTITION_ATTRIBUTES); // change the 5.0 default data policy (EMPTY) to the current default if (rattrs.hasDataPolicy() && rattrs.getDataPolicy() == DataPolicy.EMPTY && (this.version.compareTo(VERSION_5_0) == 0)) { rattrs.setDataPolicy(PartitionedRegionHelper.DEFAULT_DATA_POLICY); } rattrs.setPartitionAttributes(paf); }
public void testCacheServerDisableTcpNoDelay() throws CacheException { CacheCreation cache = new CacheCreation(); CacheServer cs = cache.addCacheServer(); cs.setTcpNoDelay(false); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.NORMAL); cache.createVMRegion("rootNORMAL", attrs); testXml(cache); }
public void testCacheServerEnableTcpNoDelay() throws CacheException { CacheCreation cache = new CacheCreation(); CacheServer cs = cache.addCacheServer(); cs.setTcpNoDelay(true); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.NORMAL); cache.createVMRegion("rootNORMAL", attrs); testXml(cache); }
/** * When a <code>partition-attributes</code> element is finished, the * {@link PartitionAttributes} are on top of the stack followed by the * {@link RegionAttributesCreation} to which the partition attributes are * assigned. */ private void endPartitionAttributes() { PartitionAttributesImpl paf = (PartitionAttributesImpl) stack.pop(); paf.validateAttributes(); RegionAttributesCreation rattrs = peekRegionAttributesContext(PARTITION_ATTRIBUTES); // change the 5.0 default data policy (EMPTY) to the current default if (rattrs.hasDataPolicy() && rattrs.getDataPolicy().isEmpty() && (this.version.compareTo(CacheXmlVersion.VERSION_5_0) == 0)) { rattrs.setDataPolicy(PartitionedRegionHelper.DEFAULT_DATA_POLICY); } rattrs.setPartitionAttributes(paf); }
attrs.setDataPolicy(DataPolicy.NORMAL); cache.createRegion("rootNORMAL", attrs); attrs.setDataPolicy(DataPolicy.NORMAL); attrs.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); cache.createRegion("rootNORMAL_ALL", attrs); attrs.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); cache.createRegion("rootPERSISTENT_REPLICATE", attrs); attrs.setDataPolicy(DataPolicy.EMPTY); cache.createRegion("rootEMPTY", attrs); attrs.setDataPolicy(DataPolicy.EMPTY); attrs.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); cache.createRegion("rootEMPTY_ALL", attrs);
attrs.setDataPolicy(DataPolicy.NORMAL); cache.createRegion("rootNORMAL", attrs); attrs.setDataPolicy(DataPolicy.NORMAL); attrs.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); cache.createRegion("rootNORMAL_ALL", attrs); attrs.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); cache.createRegion("rootPERSISTENT_REPLICATE", attrs); attrs.setDataPolicy(DataPolicy.EMPTY); cache.createRegion("rootEMPTY", attrs); attrs.setDataPolicy(DataPolicy.EMPTY); attrs.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); cache.createRegion("rootEMPTY_ALL", attrs); attrs.setDataPolicy(DataPolicy.PRELOADED); attrs.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); cache.createRegion("rootPRELOADED_ALL", attrs);
/** * Tests the bridge-server attributes (<code>max-threads</code> * * @throws CacheException */ public void testBridgeMaxThreads() throws CacheException { CacheCreation cache = new CacheCreation(); BridgeServer bs = cache.addBridgeServer(); bs.setMaxThreads(37); bs.setMaxConnections(999); bs.setPort(AvailablePortHelper.getRandomAvailableTCPPort()); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.NORMAL); cache.createVMRegion("rootNORMAL", attrs); testXml(cache); }
/** * Tests the <code>message-sync-interval</code> attribute of * attribute is related to HA of client-queues in gemfire ca * framework. This attribute is the frequency at which a messent * by the primary cache-server node to all the secondary cache-server nodes to * remove the events which have already been dispatched from * the queue * * @throws CacheException */ public void testMessageSyncInterval() throws CacheException { CacheCreation cache = new CacheCreation(); cache.setMessageSyncInterval(123); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.NORMAL); cache.createVMRegion("rootNORMAL", attrs); testXml(cache); Cache c = getCache(); assertNotNull(c); assertEquals(123, c.getMessageSyncInterval()); }
bs.setPort(AvailablePortHelper.getRandomAvailableTCPPort()); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.NORMAL); cache.createVMRegion("rootNORMAL", attrs); testXml(cache);
/** * Tests the bridge-server attributes (<code>maximum-message-count</code> * and <code>message-time-to-live</code>) related to HA of client-queues in * gemfire cache-server framework * * @throws CacheException */ public void testBridgeAttributesRelatedToClientQueuesHA() throws CacheException { CacheCreation cache = new CacheCreation(); cache.setMessageSyncInterval(3445); BridgeServer bs = cache.addBridgeServer(); bs.setMaximumMessageCount(12345); bs.setMessageTimeToLive(56789); bs.setPort(AvailablePortHelper.getRandomAvailableTCPPort()); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.NORMAL); cache.createVMRegion("rootNORMAL", attrs); testXml(cache); Cache c = getCache(); assertNotNull(c); BridgeServer server = (BridgeServer)cache.getBridgeServers().iterator().next(); assertNotNull(server); assertEquals(12345,server.getMaximumMessageCount()); assertEquals(56789,server.getMessageTimeToLive()); }
/** * Make sure you can create a persistent partitioned region from xml. */ public void testPersistentPartition() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.PERSISTENT_PARTITION); cache.createRegion("parRoot", attrs); Region r = cache.getRegion("parRoot"); assertEquals(DataPolicy.PERSISTENT_PARTITION, r.getAttributes().getDataPolicy()); testXml(cache); Cache c = getCache(); assertNotNull(c); Region region = c.getRegion("parRoot"); assertNotNull(region); assertEquals(DataPolicy.PERSISTENT_PARTITION, region.getAttributes().getDataPolicy()); // since CacheTestCase remoteTearDown does not destroy PartitionedRegion region.localDestroyRegion(); }
public void testRedefineOfDefaultDiskStore() throws CacheException { CacheCreation cache = new CacheCreation(); DiskStoreFactory dsf = cache.createDiskStoreFactory(); dsf.setAutoCompact(!DiskStoreFactory.DEFAULT_AUTO_COMPACT); DiskStore ds1 = dsf.create(DiskStoreFactory.DEFAULT_DISK_STORE_NAME); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); AttributesFactory factory = new AttributesFactory(attrs); RegionAttributes ra = factory.create(); RegionCreation root; try { root = (RegionCreation)cache.createRegion("root", ra); } catch (Exception ex) { fail("Unexpected exception", ex); } testXml(cache); Cache c = getCache(); assertNotNull(c); DiskStore ds2 = c.findDiskStore(DiskStoreFactory.DEFAULT_DISK_STORE_NAME); assertNotNull(ds2); assertEquals(ds1.getAutoCompact(), ds2.getAutoCompact()); }
bs.setPort(AvailablePortHelper.getRandomAvailableTCPPort()); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setDataPolicy(DataPolicy.NORMAL); cache.createVMRegion("rootNORMAL", attrs); testXml(cache);
|| getRegionTimeToLive().getAction().isLocalInvalidate()) { setDataPolicy(DataPolicy.PRELOADED); setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL));