Refine search
@Override public ModelNode execute(OperationContext context, Metric<RpcManagerImpl> metric) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); String containerName = address.getParent().getLastElement().getValue(); String cacheName = address.getLastElement().getValue(); Cache<?, ?> cache = new PassiveServiceSupplier<Cache<?, ?>>(context.getServiceRegistry(true), InfinispanCacheRequirement.CACHE.getServiceName(context, containerName, cacheName)).get(); return (cache != null) ? metric.execute((RpcManagerImpl) cache.getAdvancedCache().getRpcManager()) : null; } }
/** * {@inheritDoc} * @see org.jboss.ha.core.framework.server.ChannelSource#getChannel() */ @Override public Channel getChannel() { if (this.cache == null) return null; JGroupsTransport transport = (JGroupsTransport) this.cache.getAdvancedCache().getRpcManager().getTransport(); return transport.getChannel(); }
private RpcManager spyOnTransport(Cache<?, ?> cache) { RpcManager rpcManager = spy(cache.getAdvancedCache().getRpcManager()); replaceComponent(cache, RpcManager.class, rpcManager, false); return rpcManager; }
protected Address address(Cache<?, ?> c) { return c.getAdvancedCache().getRpcManager().getAddress(); }
ClusteredQueryInvoker(Cache<?, ?> localCacheInstance, ExecutorService asyncExecutor) { this.asyncExecutor = asyncExecutor; this.rpcManager = localCacheInstance.getAdvancedCache().getComponentRegistry().getLocalComponent(RpcManager.class); this.localCacheInstance = localCacheInstance; this.myAddress = localCacheInstance.getAdvancedCache().getRpcManager().getAddress(); this.rpcOptions = rpcManager.getRpcOptionsBuilder(ResponseMode.SYNCHRONOUS).timeout(10000, TimeUnit.MILLISECONDS).build(); }
Cache<?, ?> cache(Address addr) { for (Cache<?, ?> c : caches()) { if (c.getAdvancedCache().getRpcManager().getAddress().equals(addr)) return c; } throw new RuntimeException("Address: " + addr); }
private AdvancedCache advancedCache(Address address) { for (Cache c : caches()) { if (c.getAdvancedCache().getRpcManager().getAddress().equals(address)) return c.getAdvancedCache(); } throw new IllegalStateException("Couldn't find cache for address : " + address); }
protected void assertKeyAvailableForRead(Cache<?, ?> c, Object k, Object expectedValue) { log.tracef("Checking key %s is available on %s", k, c); assertEquals(c.get(k), expectedValue, "Cache " + c.getAdvancedCache().getRpcManager().getAddress() + " doesn't see the right value: "); // While we keep the null values in the map inside interceptor stack, these are removed in CacheImpl.getAll Map<Object, Object> expectedMap = expectedValue == null ? Collections.emptyMap() : Collections.singletonMap(k, expectedValue); assertEquals(c.getAdvancedCache().getAll(Collections.singleton(k)), expectedMap, "Cache " + c.getAdvancedCache().getRpcManager().getAddress() + " doesn't see the right value: "); }
private <K, V> Cache<K, V> getCacheForAddress(Address a) { for (Cache<K, V> c: this.<K, V>caches()) if (c.getAdvancedCache().getRpcManager().getAddress().equals(a)) return c; return null; }
@SuppressWarnings("unchecked") private Cache<MagicKey, String> getCacheForAddress(Address a) { for (Cache<?, ?> c: caches()) if (c.getAdvancedCache().getRpcManager().getAddress().equals(a)) return (Cache<MagicKey, String>) c; return null; }
@SuppressWarnings("unchecked") private Cache<MagicKey, String> getNonOwner(List<Address> a) { for (Cache<?, ?> c: caches()) if (!a.contains(c.getAdvancedCache().getRpcManager().getAddress())) return (Cache<MagicKey, String>) c; return null; }
public static int getServerTopologyId(EmbeddedCacheManager cm, String cacheName) { return cm.getCache(cacheName).getAdvancedCache().getRpcManager().getTopologyId(); }
public static CountingRpcManager replaceRpcManager(Cache c) { AdvancedCache advancedCache = c.getAdvancedCache(); CountingRpcManager crm = new CountingRpcManager(advancedCache.getRpcManager()); BasicComponentRegistry bcr = advancedCache.getComponentRegistry().getComponent(BasicComponentRegistry.class); bcr.replaceComponent(RpcManager.class.getName(), crm, false); bcr.rewire(); assert advancedCache.getRpcManager().equals(crm); return crm; }
private void printCacheStats(PrintWriter pw, Cache<?, ?> cache) throws StatementException { if (!cache.getCacheConfiguration().jmxStatistics().enabled()) { throw log.statisticsNotEnabled(cache.getName()); } for (CommandInterceptor interceptor : cache.getAdvancedCache().getInterceptorChain()) { printComponentStats(pw, cache, interceptor); } printComponentStats(pw, cache, cache.getAdvancedCache().getLockManager()); printComponentStats(pw, cache, cache.getAdvancedCache().getRpcManager()); }
public void assertActualMembers() { Set<org.infinispan.remoting.transport.Address> expected = cachesInThisPartition().stream() .map(c -> c.getAdvancedCache().getRpcManager().getAddress()) .collect(Collectors.toSet()); for (Cache c : cachesInThisPartition()) { eventuallyEquals(expected, () -> new HashSet<>(c.getAdvancedCache().getDistributionManager().getCacheTopology().getActualMembers())); } }
@Override protected void createService() { filter = new ArrayList<Address>(); filter.add(caches.get(0).getAdvancedCache().getRpcManager().getTransport().getAddress()); filter.add(caches.get(1).getAdvancedCache().getRpcManager().getTransport().getAddress()); cacheManager = caches.get(0).getCacheManager(); keyAffinityService = (KeyAffinityServiceImpl<Object>) KeyAffinityServiceFactory. newKeyAffinityService(cacheManager.getCache(cacheName), filter, new RndKeyGenerator(), executor, 100); }
private void printCacheStats(PrintWriter pw, Cache<?, ?> cache) throws StatementException { if (!cache.getCacheConfiguration().jmxStatistics().enabled()) { throw log.statisticsNotEnabled(cache.getName()); } for (AsyncInterceptor interceptor : cache.getAdvancedCache().getAsyncInterceptorChain().getInterceptors()) { printComponentStats(pw, cache, interceptor); } printComponentStats(pw, cache, cache.getAdvancedCache().getLockManager()); printComponentStats(pw, cache, cache.getAdvancedCache().getRpcManager()); }
protected List<Address> topology(CacheContainer cm) { return cm.getCache(cacheName).getAdvancedCache().getRpcManager().getTransport().getMembers(); }
private void replaceRpcManager(Cache<?, ?> cache, RpcCollector rpcCollector) { RpcManager current = cache.getAdvancedCache().getRpcManager(); RpcManager replacement = new TrackingRpcManager(current, rpcCollector, cache.getName()); TestingUtil.replaceComponent(cache, RpcManager.class, replacement, true); }
protected JChannel channel(Cache<?, ?> cache) { return extractJGroupsTransport(cache.getAdvancedCache().getRpcManager().getTransport()).getChannel(); }