this.subscriptionAttributes = new SubscriptionAttributes(InterestPolicy.ALL); } else { this.subscriptionAttributes = new SubscriptionAttributes(InterestPolicy.CACHE_CONTENT);
/** * When a <code>subscription-attributes</code> element is first encountered, we create an * SubscriptionAttibutes?? object from the element's attributes and stick it in the current region * attributes. */ private void startSubscriptionAttributes(Attributes atts) { String ip = atts.getValue(INTEREST_POLICY); SubscriptionAttributes sa; if (ip == null) { sa = new SubscriptionAttributes(); } else if (ip.equals(ALL)) { sa = new SubscriptionAttributes(InterestPolicy.ALL); } else if (ip.equals(CACHE_CONTENT)) { sa = new SubscriptionAttributes(InterestPolicy.CACHE_CONTENT); } else { throw new InternalGemFireException( String.format("Unknown interest-policy: %s", ip)); } RegionAttributesCreation rattrs = (RegionAttributesCreation) stack.peek(); rattrs.setSubscriptionAttributes(sa); }
private void initAttributeFactoryDefaults() { this.attrsFactory.setScope(Scope.LOCAL); this.attrsFactory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); }
/** * Assert that SubscriptionAttributes are serializable. */ @Test public void testSubscriptionAttributesAreSerializable() throws Exception { SubscriptionAttributes outSA = new SubscriptionAttributes(); ByteArrayOutputStream baos = new ByteArrayOutputStream(1000); try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(outSA); } byte[] data = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(data); try (ObjectInputStream ois = new ObjectInputStream(bais)) { SubscriptionAttributes inSA = (SubscriptionAttributes) ois.readObject(); assertEquals(outSA, inSA); } } }
private static RegionAttributes createClientDefaults() { AttributesFactory af = new AttributesFactory(); af.setScope(Scope.LOCAL); // af.setIgnoreJTA(true); In 6.6 and later releases client regions support JTA af.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); return af.create(); }
@SuppressWarnings("unchecked") private LocalRegion createOrRetrieveGatewayDeltaRegion() { Region region = this.cache.getRegion(GatewayDelta.GATEWAY_DELTA_REGION_NAME); if (region == null) { region = new RegionFactory().setScope(Scope.LOCAL).setDataPolicy(DataPolicy.EMPTY) .setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)) // TODO: Disabled for WAN // .setEnableGateway(true) .addCacheListener(new GatewayDeltaEventApplicationCacheListener()) .create(GatewayDelta.GATEWAY_DELTA_REGION_NAME); } if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("GatewayDeltaForwarderCacheListener: Created gateway delta region: ") .append(region); this.cache.getLogger().fine(builder.toString()); } return (LocalRegion) region; }
SubscriptionAttributes sa = attrs.getSubscriptionAttributes(); if (sa != null) { if (generateDefaults() || !sa.equals(new SubscriptionAttributes())) generate(sa);
setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL));
assertEquals(new SubscriptionAttributes(InterestPolicy.ALL), ra.getSubscriptionAttributes()); assertEquals(new SubscriptionAttributes(InterestPolicy.ALL), ra.getSubscriptionAttributes()); assertEquals(new SubscriptionAttributes(InterestPolicy.ALL), ra.getSubscriptionAttributes()); assertEquals(new SubscriptionAttributes(InterestPolicy.ALL), ra.getSubscriptionAttributes());
setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL));
@Override public void afterPropertiesSet() throws Exception { this.subscriptionAttributes = new SubscriptionAttributes(getInterestPolicy()); }
@Override public void afterPropertiesSet() throws Exception { this.subscriptionAttributes = new SubscriptionAttributes(getInterestPolicy()); }
@SuppressWarnings("unchecked") private LocalRegion createOrRetrieveGatewayDeltaRegion() { Region region = this.cache.getRegion(GatewayDelta.GATEWAY_DELTA_REGION_NAME); if (region == null) { region = new RegionFactory().setScope(Scope.LOCAL).setDataPolicy(DataPolicy.EMPTY) .setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)) // TODO: Disabled for WAN // .setEnableGateway(true) .addCacheListener(new GatewayDeltaEventApplicationCacheListener()) .create(GatewayDelta.GATEWAY_DELTA_REGION_NAME); } if (this.cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("GatewayDeltaForwarderCacheListener: Created gateway delta region: ") .append(region); this.cache.getLogger().fine(builder.toString()); } return (LocalRegion) region; }