/** * @see InitializingBean#afterPropertiesSet() */ @Override public void afterPropertiesSet() throws Exception { if (this.infinispanCacheContainer == null) { throw new IllegalStateException("No Infinispan CacheContainer has been set"); } this.logger.info("Initializing named Infinispan cache ..."); this.infinispanCache = this.infinispanCacheContainer.getCache(); this.logger.info("New Infinispan cache [" + this.infinispanCache + "] initialized"); }
/** * @see InitializingBean#afterPropertiesSet() */ @Override public void afterPropertiesSet() throws Exception { if (this.infinispanRemoteCacheManager == null) { throw new IllegalStateException("No Infinispan RemoteCacheManager has been set"); } this.logger.info("Initializing named Infinispan remote cache ..."); final String effectiveCacheName = obtainEffectiveCacheName(); this.infinispanCache = this.infinispanRemoteCacheManager.getCache(effectiveCacheName); this.logger.info("New Infinispan remote cache [" + this.infinispanCache + "] initialized"); }
public Schema retrieveSchema(String name) throws IOException, InterruptedException, ClassNotFoundException { if (!knownSchemas.containsKey(name)) { byte[] key = marshaller.objectToByteBuffer(name); byte[] value = (byte[]) cacheManager.getCache(Support.AVRO_METADATA_CACHE_NAME).get(key); if (value==null) throw new IOException(name+" not found in the metadata cache"); Schema schema = (Schema) marshaller.objectFromByteBuffer(value); knownSchemas.put(name, schema); log.info("adding schama "+name+" to metadata cache"); } return knownSchemas.get(name); }
/** * @see InitializingBean#afterPropertiesSet() */ @Override public void afterPropertiesSet() throws Exception { assertCorrectlyConfigured(); this.logger.info("Creating new instance of RemoteCacheManager ..."); final Properties configurationPropertiesToUse = configurationProperties(); org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder(); clientBuilder.withProperties(configurationPropertiesToUse); long readTimeout; if (configurationPropertiesToUse.containsKey(ConfigurationPropertiesOverrides.OPERATION_READ_TIMEOUT)) readTimeout = Long.parseLong(configurationPropertiesToUse.getProperty(ConfigurationPropertiesOverrides.OPERATION_READ_TIMEOUT)); else readTimeout = 0; long writeTimeout; if (configurationPropertiesToUse.containsKey(ConfigurationPropertiesOverrides.OPERATION_WRITE_TIMEOUT)) writeTimeout = Long.parseLong(configurationPropertiesToUse.getProperty(ConfigurationPropertiesOverrides.OPERATION_WRITE_TIMEOUT)); else writeTimeout = 0; final RemoteCacheManager nativeRemoteCacheManager = new RemoteCacheManager( clientBuilder.build(), this.startAutomatically); this.springRemoteCacheManager = new SpringRemoteCacheManager(nativeRemoteCacheManager, readTimeout, writeTimeout); this.logger.info("Finished creating new instance of RemoteCacheManager"); }
/** * @see InitializingBean#afterPropertiesSet() */ @Override public void afterPropertiesSet() throws Exception { assertCorrectlyConfigured(); this.logger.info("Creating new instance of RemoteCacheManager ..."); final Properties configurationPropertiesToUse = configurationProperties(); org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder(); clientBuilder.withProperties(configurationPropertiesToUse); this.nativeRemoteCacheManager = new RemoteCacheManager(clientBuilder.build(), this.startAutomatically); this.logger.info("Finished creating new instance of RemoteCacheManager"); }
public void testLuceneCacheLoaderWithNonReadableDir() throws IOException { boolean isReadOff = rootDir.setReadable(false); if(isReadOff) { final EmbeddedCacheManager cacheManager = initializeInfinispan(rootDir); TestingUtil.withCacheManager(new CacheManagerCallable(cacheManager) { @Override public void call() { try { Cache cache = cacheManager.getCache(); DirectoryBuilder.newDirectoryInstance(cache, cache, cache, indexName).create(); } catch(Exception ex) { assert ex instanceof CacheException; } finally { rootDir.setReadable(true); } } }); } else { log.info("Skipping test because it is not possible to make the directory non-readable, i.e. because the tests are run with the root user."); } }