@Override public void init(InitializationContext ctx) { this.ctx = ctx; HotRodStoreConfiguration configuration = ctx.getConfiguration(); RemoteCacheContainer remoteCacheContainer = configuration.attributes().attribute(HotRodStoreConfiguration.REMOTE_CACHE_CONTAINER).get(); String cacheConfiguration = configuration.attributes().attribute(HotRodStoreConfiguration.CACHE_CONFIGURATION).get(); String cacheName = ctx.getCache().getName(); try { ProtocolVersion protocolVersion = remoteCacheContainer.getConfiguration().version(); // Administration support was introduced in protocol version 2.7 if (protocolVersion.compareTo(ProtocolVersion.PROTOCOL_VERSION_27) < 0) { this.remoteCache = remoteCacheContainer.getCache(cacheName, false); if (this.remoteCache == null) { throw InfinispanLogger.ROOT_LOGGER.remoteCacheMustBeDefined(protocolVersion.toString(), cacheName); } } else { InfinispanLogger.ROOT_LOGGER.remoteCacheCreated(cacheName, cacheConfiguration); this.remoteCache = remoteCacheContainer.administration().getOrCreateCache(cacheName, cacheConfiguration); } } catch (HotRodClientException ex) { throw new PersistenceException(ex); } }
private String sanitizedCacheName() { return ctx.getCache().getName().replaceAll("[^a-zA-Z0-9-_\\.]", "_"); }
@Override public void init(final InitializationContext ctx) { // This method will be invoked by the PersistenceManager during initialization. The InitializationContext // contains: // - this CacheLoader's configuration // - the cache to which this loader is applied. Your loader might want to use the cache's name to construct // cache-specific identifiers // - the StreamingMarshaller that needs to be used to marshall/unmarshall the entries // - a TimeService which the loader can use to determine expired entries // - a ByteBufferFactory which needs to be used to construct ByteBuffers // - a MarshalledEntryFactory which needs to be used to construct entries from the data retrieved by the loader this.ctx = ctx; // Store cache name cacheName = ctx.getCache().getName(); // Register store InfinispanStore.instances.put(cacheName, this); }
@Override public void init(InitializationContext ctx) { this.configuration = ctx.getConfiguration(); this.cacheName = ctx.getCache().getName(); this.globalConfiguration = ctx.getCache().getCacheManager().getCacheManagerConfiguration(); this.marshalledEntryFactory = ctx.getMarshalledEntryFactory(); this.marshaller = ctx.getMarshaller(); this.timeService = ctx.getTimeService(); this.keyPartitioner = configuration.segmented() ? ctx.getKeyPartitioner() : null; this.isDistributedCache = ctx.getCache().getCacheConfiguration() != null && ctx.getCache().getCacheConfiguration().clustering().cacheMode().isDistributed(); }
expiryEntryQueue = new LinkedBlockingQueue<>(configuration.expiryQueueSize()); AdvancedCache cache = ctx.getCache().getAdvancedCache(); ComponentRegistry registry = cache.getComponentRegistry(); KeyPartitioner keyPartitioner = registry.getComponent(KeyPartitioner.class);
@Override public void start() { if (iceFactory == null) { iceFactory = ctx.getCache().getAdvancedCache().getComponentRegistry().getComponent(InternalEntryFactory.class); maxContentLength = configuration.maxContentLength(); this.key2StringMapper = Util.getInstance(configuration.key2StringMapper(), ctx.getCache().getAdvancedCache().getClassLoader()); this.key2StringMapper.setMarshaller(ctx.getMarshaller()); this.path = configuration.path(); try { if (configuration.appendCacheNameToPath()) { path = path + urlCodec.encode(ctx.getCache().getName()) + "/"; this.metadataHelper = Util.getInstance(configuration.metadataHelper(), ctx.getCache().getAdvancedCache().getClassLoader());
@Override public void init(InitializationContext ctx) { this.ctx = ctx; this.configuration = ctx.getConfiguration(); this.cache = ctx.getCache(); this.marshaller = ctx.getMarshaller(); this.storeName = makeStoreName(configuration, cache); this.initCount.incrementAndGet(); this.timeService = ctx.getTimeService(); }
@Override public void init(InitializationContext ctx) { this.configuration = ctx.getConfiguration(); this.emfRegistry = ctx.getCache().getAdvancedCache().getComponentRegistry().getGlobalComponentRegistry().getComponent(EntityManagerFactoryRegistry.class); this.marshallerEntryFactory = ctx.getMarshalledEntryFactory(); this.marshaller = ctx.getMarshaller(); this.timeService = ctx.getTimeService(); this.executorService = ctx.getExecutor(); }
ctx.getCache().getCacheConfiguration().expiration().wakeUpInterval());
@Override public void init(InitializationContext ctx) { this.ctx = ctx; HotRodStoreConfiguration configuration = ctx.getConfiguration(); RemoteCacheContainer remoteCacheContainer = configuration.attributes().attribute(HotRodStoreConfiguration.REMOTE_CACHE_CONTAINER).get(); String cacheConfiguration = configuration.attributes().attribute(HotRodStoreConfiguration.CACHE_CONFIGURATION).get(); String cacheName = ctx.getCache().getName(); try { ProtocolVersion protocolVersion = remoteCacheContainer.getConfiguration().version(); // Administration support was introduced in protocol version 2.7 if (protocolVersion.compareTo(ProtocolVersion.PROTOCOL_VERSION_27) < 0) { this.remoteCache = remoteCacheContainer.getCache(cacheName, false); if (this.remoteCache == null) { throw InfinispanLogger.ROOT_LOGGER.remoteCacheMustBeDefined(protocolVersion.toString(), cacheName); } } else { InfinispanLogger.ROOT_LOGGER.remoteCacheCreated(cacheName, cacheConfiguration); this.remoteCache = remoteCacheContainer.administration().getOrCreateCache(cacheName, cacheConfiguration); } } catch (HotRodClientException ex) { throw new PersistenceException(ex); } }