@Override public RemoteCacheManager getRemoteCacheManager() { return delegate.getRemoteCacheManager(); }
public RemoteCacheWithSyncListeners(RemoteCache<K, V> delegate, AbstractJCacheNotifier<K, V> notifier, Cache<K, V> cache) { super(delegate); this.notifier = notifier; this.cache = cache; this.timeout = delegate.getRemoteCacheManager().getConfiguration().socketTimeout(); }
public static void main(String[] args) { // Execute and data manipulation caches require different configuration // This won't be necessary in the future: https://issues.jboss.org/browse/ISPN-8814 final RemoteCache<String, String> dataCache = getDataCache(); final RemoteCache<String, String> execCache = getExecCache(); // Create task parameters Map<String, String> parameters = new HashMap<>(); parameters.put("name", "developer"); // Execute hello task String greet = execCache.execute("hello-task", parameters); System.out.printf("Greeting = %s\n", greet); // Store some values and compute the sum int range = 10; IntStream.range(0, range).boxed().forEach( i -> dataCache.put(i + "-key", i + "-value") ); int result = execCache.execute("sum-values-task", Collections.emptyMap()); System.out.printf("Sum of values = %d\n", result); // Stop the cache manager and release all resources dataCache.getRemoteCacheManager().stop(); execCache.getRemoteCacheManager().stop(); }
public static void testGetRemoteCacheManager(RemoteCache<String, String> remoteCache) { RemoteCacheManager rcm = remoteCache.getRemoteCacheManager(); assertNotNull(rcm); }
public String getStoredKey(RemoteCache cache, String key) throws IOException, InterruptedException { // 1. marshall the key // 2. encode it with base64 (that's what DefaultTwoWayKey2StringMapper does) // 3. prefix it with 8 (again, done by DefaultTwoWayKey2StringMapper to mark the key as wrapped byte array type) // 4. prefix it with UTF-16 BOM (that is what DefaultTwoWayKey2StringMapper does for non string values) return '\uFEFF' + "8" + Base64.getEncoder().encodeToString(cache.getRemoteCacheManager().getMarshaller().objectToByteBuffer(key)); }
private boolean isNearCacheEnabled() { return cache.getRemoteCacheManager().getConfiguration().nearCache().mode().enabled(); }
public String fromStoredKey(RemoteCache cache, String key) throws IOException, InterruptedException, ClassNotFoundException { Object o = cache.getRemoteCacheManager().getMarshaller().objectFromByteBuffer(Base64.getDecoder().decode(key.substring(2))); log.tracef("Key in DB=%s > %s", key, o); return (String)o; }
@Test public void testGetRemoteCacheManager() { RemoteCacheManager manager = null; manager = remoteCache.getRemoteCacheManager(); assertEquals("getRemoteCachemanager() returned incorrect value", manager, remoteCacheManager); }
@AfterClass protected void teardown() { defaultRemoteCache.getRemoteCacheManager().stop(); defaultMarshalledRemoteCache.getRemoteCacheManager().stop(); stringRemoteCache.getRemoteCacheManager().stop(); if (restServer != null) { try { restServer.stop(); } catch (Exception ignored) { } } killCacheManagers(cacheManager); killServers(hotRodServer); }
protected synchronized RemoteCache loadRemoteCache(String cacheName) { RemoteCache remoteCache = InfinispanUtil.getRemoteCache(cacheManager.getCache(cacheName)); Boolean remoteStoreSecurity = config.getBoolean("remoteStoreSecurityEnabled"); if (remoteStoreSecurity == null) { try { logger.debugf("Detecting remote security settings of HotRod server, cache %s. Disable by explicitly setting \"remoteStoreSecurityEnabled\" property in spi=connectionsInfinispan/provider=default", cacheName); remoteStoreSecurity = false; final RemoteCache<Object, Object> scriptCache = remoteCache.getRemoteCacheManager().getCache(SCRIPT_CACHE_NAME); if (scriptCache == null) { logger.debug("Cannot detect remote security settings of HotRod server, disabling."); } else { scriptCache.containsKey(""); } } catch (HotRodClientException ex) { logger.debug("Seems that HotRod server requires authentication, enabling."); remoteStoreSecurity = true; } } if (remoteStoreSecurity) { logger.infof("Remote store security for cache %s is enabled. Disable by setting \"remoteStoreSecurityEnabled\" property to \"false\" in spi=connectionsInfinispan/provider=default", cacheName); RemoteCacheManager securedMgr = getOrCreateSecuredRemoteCacheManager(config, cacheName, remoteCache.getRemoteCacheManager()); return securedMgr.getCache(remoteCache.getName()); } else { logger.infof("Remote store security for cache %s is disabled. If server fails to connect to remote JDG server, enable it.", cacheName); return remoteCache; } }
@After public void tearDown() { if (remoteCache != null) { remoteCache.clear(); remoteCache.getRemoteCacheManager().stop(); } }
@Override public byte[] getEventData() { RemoteCache cache = remoteCacheManager.getCache(); int keySizeEstimate = cache.getRemoteCacheManager().getConfiguration().keySizeEstimate(); int valueSizeEstimate = cache.getRemoteCacheManager().getConfiguration().valueSizeEstimate(); byte[] key = cache.getDataFormat().keyToBytes(sessionId, keySizeEstimate, valueSizeEstimate); int capacity = UnsignedNumeric.sizeUnsignedInt(key.length) + key.length; byte[] out = new byte[capacity]; int offset = UnsignedNumeric.writeUnsignedInt(out, 0, key.length); System.arraycopy(key, 0, out, offset, key.length); return out; }
rc.getRemoteCacheManager().getConfiguration().asyncExecutorFactory().factoryClass().getName());
killRemoteCacheManager(targetRemoteCache != null ? targetRemoteCache.getRemoteCacheManager() : null); killRemoteCacheManager(sourceRemoteCache != null ? sourceRemoteCache.getRemoteCacheManager() : null); killCacheManagers(targetCacheManager, sourceCacheManager); killServers(targetServer, sourceServer);
assertEquals(3, remoteCache.size()); SerializationContext serCtx = ProtoStreamMarshaller.getSerializationContext(remoteCache.getRemoteCacheManager()); QueryFactory qf = Search.getQueryFactory(remoteCache);