public Object call() throws Exception { AttributesFactory<Integer, String> af = new AttributesFactory<Integer, String>(); af.setScope(Scope.DISTRIBUTED_ACK); af.setDataPolicy(DataPolicy.EMPTY); af.setConcurrencyChecksEnabled(getConcurrencyChecksEnabled()); getCache().createRegionFactory(af.create()).create(EMPTY_REGION); af.setDataPolicy(DataPolicy.REPLICATE); getCache().createRegionFactory(af.create()).create(D_REFERENCE); return null; } });
public Object call() throws Exception { ClientCacheFactory ccf = new ClientCacheFactory(); ccf.addPoolServer("localhost"/*getServerHostName(Host.getHost(0))*/, port); ccf.setPoolSubscriptionEnabled(true); ccf.set("log-level", getDUnitLogLevel()); ClientCache cCache = getClientCache(ccf); ClientRegionFactory<Integer, String> crf = cCache .createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY); crf.addCacheListener(new ClientListener()); crf.setConcurrencyChecksEnabled(getConcurrencyChecksEnabled()); Region r = crf.create(D_REFERENCE); Region empty = crf.create(EMPTY_REGION); r.registerInterest("ALL_KEYS", InterestResultPolicy.KEYS_VALUES); empty.registerInterest("ALL_KEYS", InterestResultPolicy.KEYS_VALUES); return null; } });
void createRegion(boolean accessor, int redundantCopies, InterestPolicy interestPolicy) { AttributesFactory af = new AttributesFactory(); af.setScope(Scope.DISTRIBUTED_ACK); af.setDataPolicy(DataPolicy.REPLICATE); af.setConcurrencyChecksEnabled(getConcurrencyChecksEnabled()); getCache().createRegion(D_REFERENCE,af.create()); af = new AttributesFactory(); af.setConcurrencyChecksEnabled(getConcurrencyChecksEnabled()); if (interestPolicy != null) { af.setSubscriptionAttributes(new SubscriptionAttributes(interestPolicy)); } af.setPartitionAttributes(new PartitionAttributesFactory<CustId, Customer>() .setTotalNumBuckets(4).setLocalMaxMemory(accessor ? 0 : 1) .setPartitionResolver(new CustomerIDPartitionResolver("resolver1")) .setRedundantCopies(redundantCopies).create()); getCache().createRegion(CUSTOMER, af.create()); af.setPartitionAttributes(new PartitionAttributesFactory<OrderId, Order>() .setTotalNumBuckets(4).setLocalMaxMemory(accessor ? 0 : 1) .setPartitionResolver(new CustomerIDPartitionResolver("resolver2")) .setRedundantCopies(redundantCopies).setColocatedWith(CUSTOMER).create()); getCache().createRegion(ORDER, af.create()); }
public Object call() throws Exception { ClientCacheFactory ccf = new ClientCacheFactory(); ccf.addPoolServer("localhost"/*getServerHostName(Host.getHost(0))*/, port); ccf.setPoolSubscriptionEnabled(true); ccf.set("log-level", getDUnitLogLevel()); ClientCache cCache = getClientCache(ccf); ClientRegionFactory<Integer, String> crf = cCache .createClientRegionFactory(isEmpty ? ClientRegionShortcut.PROXY : ClientRegionShortcut.CACHING_PROXY); crf.setConcurrencyChecksEnabled(getConcurrencyChecksEnabled()); crf.addCacheListener(new ClientListener()); Region r = crf.create(D_REFERENCE); Region cust = crf.create(CUSTOMER); Region order = crf.create(ORDER); if (ri) { r.registerInterestRegex(".*"); cust.registerInterestRegex(".*"); order.registerInterestRegex(".*"); } if(CQ) { CqAttributesFactory cqf = new CqAttributesFactory(); cqf.addCqListener(new ClientCQListener()); CqAttributes ca = cqf.create(); cCache.getQueryService().newCq("SELECT * FROM "+cust.getFullPath(), ca).execute(); } return null; } });