/** * Carry out any initialization tasks that might be necessary */ @Override public void initialize() { cacheManager = new DefaultCacheManager(globalConfiguration, defaultConfiguration, true); if(entryCache == null) { cacheManager.defineConfiguration(LDCACHE_ENTRY_CACHE, defaultConfiguration); entryCache = cacheManager.<String,CacheEntry>getCache(LDCACHE_ENTRY_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP); } log.info("initialised cache manager ({})", globalConfiguration.isClustered() ? "cluster name: "+globalConfiguration.transport().clusterName() : "single host"); }
@CacheStarted public void logCacheManagerStart(final CacheStartedEvent event) { Logger log = LogManager.getLogger("MAIN"); EmbeddedCacheManager cacheManager = event.getCacheManager(); if (!cacheManager.getCacheManagerConfiguration().isClustered()) { // Local Infinispan (no cluster) log.info("[CM8008] Infinispan clustering: not configured"); } else if (clusterInfoLogged.compareAndSet(false, true)) { // Clustered Infinispan, log cluster conf for the first start cache event only // to prevent duplicate log lines with same cluster info log.info("[CM8007] Infinispan status: {}", cacheManager.getStatus()); log.info("[CM8009] Infinispan cluster name: {}", cacheManager.getCacheManagerConfiguration().transport().clusterName()); log.info("[CM8010] Infinispan cluster local node logical address: {}", cacheManager.getAddress()); log.info("[CM8019] Infinispan cluster local node physical address(es): {}", cacheManager.getCacheManagerConfiguration().transport().transport().getPhysicalAddresses()); log.info("[CM8011] Infinispan cluster coordinator logical address: {}", cacheManager.getCoordinator()); log.info("[CM8016] Infinispan cluster local node is coordinator: {}", cacheManager.isCoordinator()); log.info("[CM8012] Infinispan cluster members: {}", cacheManager.getMembers()); log.info("[CM8013] Infinispan cluster distributed sync timeout: {}", cacheManager.getCacheManagerConfiguration().transport().distributedSyncTimeout()); log.info("[CM8014] Infinispan cluster JGroups configuration file: {}", cacheManager.getCacheManagerConfiguration().transport().properties().getProperty("configurationFile")); } final Date now = new Date(); log.info("[CM8006] Started Infinispan {} cache {} in {} ms", cacheManager.getCacheConfiguration(event.getCacheName()).clustering().cacheModeString(), event.getCacheName(), now.getTime() - initiationTimestamp.getTime()); } }
private void defineDataTypeCacheConfigurations(ServiceRegistry serviceRegistry) { String defaultResource = manager.getCacheManagerConfiguration().isClustered() ? DEF_INFINISPAN_CONFIG_RESOURCE : INFINISPAN_CONFIG_LOCAL_RESOURCE; ConfigurationBuilderHolder defaultConfiguration = DefaultCacheManagerProvider.loadConfiguration(serviceRegistry, defaultResource); for ( DataType type : DataType.values() ) {
/** * Creates the global transaction internal cache. */ private void registerGlobalTxTable(GlobalComponentRegistry globalComponentRegistry) { InternalCacheRegistry registry = globalComponentRegistry.getComponent(InternalCacheRegistry.class); ConfigurationBuilder builder = new ConfigurationBuilder(); //we can't lose transactions. distributed cache can lose data is num_owner nodes crash at the same time builder.clustering().cacheMode(globalComponentRegistry.getGlobalConfiguration().isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL); builder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); //persistent? should we keep the transaction after restart? registry.registerInternalCache(GLOBAL_TX_TABLE_CACHE_NAME, builder.build(), EnumSet.noneOf(InternalCacheRegistry.Flag.class)); }
private Configuration getInternalCacheConfig() { ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); // allow the registry to work for local caches as well as clustered caches CacheMode cacheMode = cacheManager.getGlobalComponentRegistry().getGlobalConfiguration().isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL; configurationBuilder.clustering().cacheMode(cacheMode); // use invocation batching (cache-only transactions) for high consistency as writes are expected to be rare in this cache configurationBuilder.transaction().transactionMode(TransactionMode.TRANSACTIONAL) .transactionManagerLookup(null).invocationBatching().enable(); configurationBuilder.security().authorization().disable(); return configurationBuilder.build(); }
/** * Create the configuration for the internal cache. */ private Configuration getInternalCacheConfig() { ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); // allow the registry to work for local caches as well as clustered caches CacheMode cacheMode = cacheManager.getGlobalComponentRegistry().getGlobalConfiguration().isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL; configurationBuilder.clustering().cacheMode(cacheMode); // use invocation batching (cache-only transactions) for high consistency as writes are expected to be rare in this cache configurationBuilder.transaction().transactionMode(TransactionMode.TRANSACTIONAL) .transactionManagerLookup(null).invocationBatching().enable(); configurationBuilder.security().authorization().disable(); return configurationBuilder.build(); }
log.missingIndexCacheConfiguration(metadataCacheName); ConfigurationBuilder builder = new ConfigurationBuilder(); if (cacheManager.getCacheManagerConfiguration().isClustered()) { log.missingIndexCacheConfiguration(dataCacheName); ConfigurationBuilder builder = new ConfigurationBuilder(); if (cacheManager.getCacheManagerConfiguration().isClustered()) { log.missingIndexCacheConfiguration(lockingCacheName); ConfigurationBuilder builder = new ConfigurationBuilder(); if (cacheManager.getCacheManagerConfiguration().isClustered()) {