public static void restartCache() { try { if (!cache.isClosed()) { cache.close(); } cache = (InternalCache) new CacheFactory(props).create(); ds = cache.getDistributedSystem(); qs = cache.getQueryService(); } catch (Exception e) { throw new AssertionError(e); } }
@Override public <K, V> Region<K, V> getRegion(String path) { Region<K, V> result = delegate.getRegion(path); checkForInternalRegion(result); return result; }
private boolean checkCancelled() { if (shutdown) { return true; } if (cache.getCancelCriterion().isCancelInProgress()) { return true; } return false; }
public static QueryService getQueryService() { if (cache.isClosed()) startCache(); return cache.getQueryService(); }
/** * Check to see if the current member is a loner and we can't tell if the user wants a peer or a * client type registry. * * @return true if this member is a loner and we can't determine what type of registry they want. */ static boolean isIndeterminateLoner(InternalCache cache) { boolean isLoner = cache.getInternalDistributedSystem().isLoner(); boolean pdxConfigured = cache.getPdxPersistent(); return isLoner && !pdxConfigured/* && !hasGateways */; }
public static void startCache() { try { if (cache.isClosed()) { cache = (InternalCache) new CacheFactory(props).create(); ds = cache.getDistributedSystem(); qs = cache.getQueryService(); } } catch (Exception e) { throw new AssertionError(e); } }
@Before public void setUp() { cache = mock(InternalCache.class); region = mock(Region.class); when(region.getName()).thenReturn(regionName); regionAttributes = mock(RegionAttributes.class); regionMutator = mock(AttributesMutator.class); when(region.getAttributes()).thenReturn(regionAttributes); when(region.getAttributesMutator()).thenReturn(regionMutator); when(cache.getRegion(regionName)).thenReturn(region); context = mock(FunctionContext.class); when(context.getMemberName()).thenReturn("myMemberName"); DistributedMember member = mock(DistributedMember.class); resultSender = mock(ResultSender.class); service = mock(JdbcConnectorService.class); DistributedSystem system = mock(DistributedSystem.class); when(context.getResultSender()).thenReturn(resultSender); when(context.getCache()).thenReturn(cache); when(cache.getDistributedSystem()).thenReturn(system); when(system.getDistributedMember()).thenReturn(member); when(context.getArguments()).thenReturn(regionName); when(cache.getService(eq(JdbcConnectorService.class))).thenReturn(service); mapping = new RegionMapping(); function = new DestroyMappingFunction(); }
/** * Returns the underlying{@code InternalDistributedSystem} connection. * * @return the underlying{@code InternalDistributedSystem} */ @Override public InternalDistributedSystem getSystem() { return (InternalDistributedSystem) this.cache.getDistributedSystem(); }
@Before public void setUp() { context = mock(FunctionContext.class); resultSender = mock(ResultSender.class); InternalCache cache = mock(InternalCache.class); DistributedSystem system = mock(DistributedSystem.class); distributedMember = mock(DistributedMember.class); service = mock(JdbcConnectorService.class); when(context.getResultSender()).thenReturn(resultSender); when(context.getCache()).thenReturn(cache); when(cache.getDistributedSystem()).thenReturn(system); when(system.getDistributedMember()).thenReturn(distributedMember); when(cache.getService(eq(JdbcConnectorService.class))).thenReturn(service); jdbcCommandFunctionContext = new FunctionContextArgumentProvider(); }
private static void init() throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException { if (GemFireCacheImpl.getInstance() == null) { props.setProperty(MCAST_PORT, "0"); cache = (InternalCache) new CacheFactory(props).create(); } else { cache = GemFireCacheImpl.getInstance(); } ds = cache.getDistributedSystem(); qs = cache.getQueryService(); }
public LuceneIndexForPartitionedRegion(String indexName, String regionPath, InternalCache cache) { super(indexName, regionPath, cache); this.waitingThreadPoolFromDM = cache.getDistributionManager().getWaitingThreadPool(); final String statsName = indexName + "-" + regionPath; this.fileSystemStats = new FileSystemStats(cache.getDistributedSystem(), statsName); }
/** * Returns a set of all the members of the distributed system excluding locators. */ @SuppressWarnings("unchecked") public static Set<DistributedMember> getAllNormalMembers(InternalCache cache) { return new HashSet<DistributedMember>( cache.getDistributionManager().getNormalDistributionManagerIds()); }
/** * Returns a set of all the members of the distributed system including locators. */ @SuppressWarnings("unchecked") public static Set<DistributedMember> getAllMembers(InternalCache cache) { return getAllMembers(cache.getInternalDistributedSystem()); }
private boolean isClosing() { if (getCache().isClosed()) { return true; } CancelCriterion stopper = getCache().getCancelCriterion(); return stopper.isCancelInProgress(); }
public CacheServerBridge(final InternalCache cache, final CacheServer cacheServer) { super(cacheServer); this.cacheServer = cacheServer; this.cache = cache; this.qs = cache.getQueryService(); initializeCacheServerStats(); }
@Override public Object call() throws RegionNotFoundException, CqExistsException, IndexExistsException, IndexNameConflictException { Region region = getCache().getRegion("/" + regionName); CompactRangeIndex index = (CompactRangeIndex) getCache().getQueryService().getIndex(region, indexName); System.out.println(index.dump()); return true; } });
/** returns the cache's OldClientSupportService */ public static OldClientSupportService getService(Cache cache) { return (OldClientSupportService) ((InternalCache) cache) .getService(OldClientSupportService.class); }
private TombstoneService(InternalCache cache) { this.replicatedTombstoneSweeper = new ReplicateTombstoneSweeper(cache, cache.getCachePerfStats(), cache.getCancelCriterion(), cache.getDistributionManager().getWaitingThreadPool()); this.nonReplicatedTombstoneSweeper = new NonReplicateTombstoneSweeper(cache, cache.getCachePerfStats(), cache.getCancelCriterion()); this.replicatedTombstoneSweeper.start(); this.nonReplicatedTombstoneSweeper.start(); }
@Override public void processEvents(CacheEvent event, Profile localProfile, Profile[] profiles, FilterRoutingInfo frInfo) throws CqException { // Is this a region event or an entry event if (event instanceof RegionEvent) { processRegionEvent(event, localProfile, profiles, frInfo); } else { // Use the PDX types in serialized form. Boolean initialPdxReadSerialized = this.cache.getPdxReadSerializedOverride(); this.cache.setPdxReadSerializedOverride(true); try { processEntryEvent(event, localProfile, profiles, frInfo); } finally { this.cache.setPdxReadSerializedOverride(initialPdxReadSerialized); } } }
public boolean areSecondariesPingable() { Set<InternalDistributedMember> hostingservers = this.partitionedRegion.getRegionAdvisor().getBucketOwners(this.getId()); hostingservers.remove(cache.getDistributedSystem().getDistributedMember()); if (cache.getLogger().fineEnabled()) cache.getLogger() .fine("Pinging secondaries of bucket " + this.getId() + " on servers " + hostingservers); if (hostingservers.size() == 0) return true; return ServerPingMessage.send(cache, hostingservers); }