org.infinispan.Cache.getName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中org.infinispan.Cache.getName()方法的一些代码示例,展示了Cache.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.getName()方法的具体详情如下:
包路径:org.infinispan.Cache
类名称:Cache
方法名:getName

Cache.getName介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
public int hashCode() {
  return this.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName().hashCode() ^ this.cache.getName().hashCode();
}

代码示例来源:origin: wildfly/wildfly

@Override
public boolean equals(Object object) {
  if ((object == null) || !(object instanceof InfinispanXAResourceRecovery)) return false;
  InfinispanXAResourceRecovery recovery = (InfinispanXAResourceRecovery) object;
  return this.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName().equals(recovery.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName()) && this.cache.getName().equals(recovery.cache.getName());
}

代码示例来源:origin: wildfly/wildfly

@Override
  public String toString() {
    return this.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName() + "." + this.cache.getName();
  }
}

代码示例来源:origin: wildfly/wildfly

@Override
public void start() {
  this.executor = Executors.newSingleThreadExecutor(createThreadFactory());
  this.affinity.start();
  List<Scheduler<I>> schedulers = new ArrayList<>(1);
  Duration timeout = this.expiration.getTimeout();
  if ((timeout != null) && !timeout.isNegative()) {
    schedulers.add(new BeanExpirationScheduler<>(this.batcher, new ExpiredBeanRemover<>(this.beanFactory), this.expiration));
  }
  this.scheduler = new CompositeScheduler<>(schedulers);
  this.dispatcher = !schedulers.isEmpty() ? this.dispatcherFactory.createCommandDispatcher(String.join("/", this.cache.getName(), this.filter.toString()), this.scheduler) : null;
  this.cache.addListener(this, new PredicateCacheEventFilter<>(this.filter), null);
  this.schedule(new SimpleLocality(false), new CacheLocality(this.cache));
}

代码示例来源:origin: wildfly/wildfly

ClusteringServerLogger.ROOT_LOGGER.registryListenerFailed(e, this.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName(), this.cache.getName(), type, entries);

代码示例来源:origin: wildfly/wildfly

@CacheEntryCreated
  @CacheEntryModified
  public void modified(CacheEntryEvent<T, Set<Address>> event) {
    if (event.isPre()) return;
    Map.Entry<Listener, ExecutorService> entry = this.listeners.get(event.getKey());
    if (entry != null) {
      Listener listener = entry.getKey();
      if (listener != null) {
        ExecutorService executor = entry.getValue();
        Set<Node> members = new TreeSet<>();
        for (Address address : event.getValue()) {
          members.add(this.group.createNode(address));
        }
        try {
          executor.submit(() -> {
            try {
              listener.providersChanged(members);
            } catch (Throwable e) {
              ClusteringServerLogger.ROOT_LOGGER.serviceProviderRegistrationListenerFailed(e, this.cache.getCacheManager().getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName(), this.cache.getName(), members);
            }
          });
        } catch (RejectedExecutionException e) {
          // Executor was shutdown
        }
      }
    }
  }
}

代码示例来源:origin: wildfly/wildfly

ClusteringServerLogger.ROOT_LOGGER.registryPurgeFailed(e, this.cache.getCacheManager().toString(), this.cache.getName(), leftMembers);
ClusteringServerLogger.ROOT_LOGGER.failedToRestoreLocalRegistryEntry(e, this.cache.getCacheManager().toString(), this.cache.getName());

代码示例来源:origin: wildfly/wildfly

@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);
  }
}

代码示例来源:origin: wildfly/wildfly

public InfinispanSessionManagerFactory(InfinispanSessionManagerFactoryConfiguration<C, L> config) {
  this.affinityFactory = config.getKeyAffinityServiceFactory();
  this.cache = config.getCache();
  this.memberFactory = config.getMemberFactory();
  this.batcher = new InfinispanBatcher(this.cache);
  this.properties = new InfinispanCacheProperties(this.cache.getCacheConfiguration());
  SessionMetaDataFactory<InfinispanSessionMetaData<L>, L> metaDataFactory = new InfinispanSessionMetaDataFactory<>(config.getCache(), this.properties);
  this.factory = new InfinispanSessionFactory<>(metaDataFactory, this.createSessionAttributesFactory(config), config.getSessionManagerFactoryConfiguration().getLocalContextFactory());
  CommandDispatcherFactory dispatcherFactory = config.getCommandDispatcherFactory();
  ExpiredSessionRemover<?, ?, L> remover = new ExpiredSessionRemover<>(this.factory);
  this.expirationRegistrar = remover;
  this.scheduler = new SessionExpirationScheduler(this.batcher, remover);
  this.dispatcher = dispatcherFactory.createCommandDispatcher(this.cache.getName(), this.scheduler);
  this.group = dispatcherFactory.getGroup();
  this.cache.addListener(this);
  this.schedule(new SimpleLocality(false), new CacheLocality(this.cache));
}

代码示例来源:origin: org.keycloak/keycloak-model-infinispan

private static <K, V> Object getTaskKey(Cache<K, V> cache, K key) {
  if (key instanceof String) {
    return new StringBuilder(cache.getName())
        .append("::")
        .append(key).toString();
  } else {
    return key;
  }
}

代码示例来源:origin: org.infinispan/infinispan-tasks

public TaskExecutionImpl(String name, String where, Optional<String> who, TaskContext context) {
 this.uuid = Util.threadLocalRandomUUID();
 this.name = name;
 this.what = context.getCache().map(cache -> cache.getName());
 this.where = where;
 this.who = who;
}

代码示例来源:origin: org.keycloak/keycloak-saml-as7-adapter

private static void warnIfRemoteStoreIsUsed(Cache<String, String[]> ssoCache) {
  final List<RemoteCacheStore> stores = getRemoteStores(ssoCache);
  if (stores == null || stores.isEmpty()) {
    return;
  }
  LOG.warnv("Unable to listen for events on remote stores configured for cache {0} (unsupported in this Infinispan limitations), logouts will not be propagated.", ssoCache.getName());
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private static void validateIndexCaches(String indexName, Cache<?, ?>... caches) {
 Arrays.stream(caches).filter(Objects::nonNull).forEach(cache -> {
   ClusteringConfiguration clusteringConfiguration = cache.getCacheConfiguration().clustering();
   CacheMode cacheMode = clusteringConfiguration.cacheMode();
   if (cacheMode.isClustered() && !cacheMode.isSynchronous()) {
    throw log.cannotStoreIndexOnAsyncCaches(indexName, cache.getName(), cacheMode);
   }
 });
}

代码示例来源:origin: org.keycloak/keycloak-model-infinispan

protected void init(KeycloakSession session, Cache<K, SessionEntityWrapper<V>> cache, RemoteCache<K, SessionEntityWrapper<V>> remoteCache) {
  this.cache = cache;
  this.remoteCache = remoteCache;
  this.topologyInfo = InfinispanUtil.getTopologyInfo(session);
  ExecutorService executor = session.getProvider(ExecutorsProvider.class).getExecutor("client-listener-" + cache.getName());
  this.executor = new ClientListenerExecutorDecorator<>(executor);
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

private static void validateMetadataCache(Cache<?, ?> cache, String indexName) {
 Configuration configuration = cache.getCacheConfiguration();
 if (configuration.memory().isEvictionEnabled()) {
   throw log.evictionNotAllowedInMetadataCache(indexName, cache.getName());
 }
 if (configuration.persistence().usingStores() && !configuration.persistence().preload()) {
   throw log.preloadNeededIfPersistenceIsEnabledForMetadataCache(indexName, cache.getName());
 }
}

代码示例来源:origin: org.infinispan/infinispan-query

private void verifyUsesInfinispanDirectory(NRTIndexManager nrti, int expectedChunkSize, EmbeddedCacheManager embeddedCacheManager) throws IllegalArgumentException, IllegalAccessException, SecurityException, NoSuchFieldException {
 DirectoryProvider directoryProvider = nrti.getDirectoryProvider();
 Assert.assertTrue(directoryProvider instanceof InfinispanDirectoryProvider);
 InfinispanDirectoryProvider ispn = (InfinispanDirectoryProvider)directoryProvider;
 Directory infinispanDirectory = ispn.getDirectory();
 DirectoryExtensions extended = (DirectoryExtensions)infinispanDirectory;
 Assert.assertEquals(expectedChunkSize, extended.getChunkSize());
 Assert.assertEquals(extended.getMetadataCache().getName(), "LuceneIndexesMetadataOWR");
 Assert.assertEquals(extended.getDataCache().getName(), "LuceneIndexesDataOWR");
 //And finally check we're running it in the same CacheManager:
 Assert.assertTrue(extended.getDataCache().getCacheManager() == embeddedCacheManager);
}

代码示例来源:origin: org.infinispan/infinispan-hibernate-cache-commons

@Start
private void start() {
  this.cacheName = ByteString.fromString(cache.getName());
  this.setStatisticsEnabled(cacheConfiguration.jmxStatistics().enabled());
  syncRpcOptions = rpcManager.getRpcOptionsBuilder(ResponseMode.SYNCHRONOUS_IGNORE_LEAVERS, DeliverOrder.NONE).build();
}

代码示例来源:origin: org.infinispan/infinispan-core

public void testRecoveryWithDefaultCache() {
 Configuration recoveryDefaultCache = cacheManager.getCache("withRecoveryDefaultCache").getCacheConfiguration();
 assertTrue(recoveryDefaultCache.transaction().recovery().enabled(), "Recovery is supposed to be enabled.");
 assertEquals(recoveryDefaultCache.transaction().recovery().recoveryInfoCacheName(), DEFAULT_RECOVERY_INFO_CACHE, "Wrong recovery cache name.");
 RecoveryManagerImpl recoveryManager = rm(cacheManager.getCache("withRecoveryDefaultCache"));
 assertNotNull(recoveryManager, "RecoveryManager should be *not* null when recovery is enabled.");
 Cache<RecoveryInfoKey, RecoveryAwareRemoteTransaction> preparedTransactions = (Cache<RecoveryInfoKey, RecoveryAwareRemoteTransaction>) recoveryManager.getInDoubtTransactionsMap();
 assertEquals(preparedTransactions.getName(), DEFAULT_RECOVERY_INFO_CACHE, "Wrong recovery cache name.");
}

代码示例来源:origin: org.infinispan/infinispan-cli-interpreter

public void testSiteStatus() throws Exception {
 Interpreter lonInterpreter = interpreter("LON", 0);
 String lonCache = cache("LON", 0).getName();
 String lonSessionId = lonInterpreter.createSessionId(lonCache);
 Interpreter nycInterpreter = interpreter("NYC", 0);
 String nycCache = cache("NYC", 0).getName();
 String nycSessionId = nycInterpreter.createSessionId(nycCache);
 assertInterpreterOutput(lonInterpreter, lonSessionId, "site --status NYC;", "online");
 assertInterpreterOutput(nycInterpreter, nycSessionId, format("site --status %s.LON;", lonCache), "online");
 assertInterpreterOutput(lonInterpreter, lonSessionId, "site --offline NYC;", "ok");
 assertInterpreterOutput(lonInterpreter, lonSessionId, "site --online NYC;", "ok");
}

代码示例来源:origin: org.infinispan/infinispan-cachestore-jdbc

@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();
}

相关文章