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

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

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

Cache.getCacheConfiguration介绍

暂无

代码示例

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

public RetryingInvoker(Cache<?, ?> cache) {
  super(calculateRetryIntervals(cache.getCacheConfiguration()));
}

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

private void unregister(GroupListener listener) {
  ExecutorService executor = this.listeners.remove(listener);
  if (executor != null) {
    PrivilegedAction<List<Runnable>> action = () -> executor.shutdownNow();
    WildFlySecurityManager.doUnchecked(action);
    try {
      executor.awaitTermination(this.cache.getCacheConfiguration().transaction().cacheStopTimeout(), TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
}

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

private void shutdown(ExecutorService executor) {
    PrivilegedAction<List<Runnable>> action = () -> executor.shutdownNow();
    WildFlySecurityManager.doUnchecked(action);
    try {
      executor.awaitTermination(this.cache.getCacheConfiguration().transaction().cacheStopTimeout(), TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    }
  }
}

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

@Override
public Duration getStopTimeout() {
  return Duration.ofMillis(this.cache.getCacheConfiguration().transaction().cacheStopTimeout());
}

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

public CacheEntryMutator(Cache<K, V> cache, K id, V value) {
  this.cache = cache;
  this.id = id;
  this.value = value;
  this.mutated = cache.getCacheConfiguration().transaction().transactionMode().isTransactional() ? new AtomicBoolean(false) : null;
}

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

@Override
public void close() {
  this.cache.removeListener(this);
  PrivilegedAction<List<Runnable>> action = () -> this.executor.shutdownNow();
  WildFlySecurityManager.doUnchecked(action);
  try {
    this.executor.awaitTermination(this.cache.getCacheConfiguration().transaction().cacheStopTimeout(), TimeUnit.MILLISECONDS);
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
  }
  this.dispatcher.close();
  this.scheduler.close();
}

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

public ConsistentHashLocality(Cache<?, ?> cache, ConsistentHash hash) {
  this.topology = new LocalizedCacheTopology(cache.getCacheConfiguration().clustering().cacheMode(), new CacheTopology(0, 0, hash, null, CacheTopology.Phase.NO_REBALANCE, Collections.emptyList(), Collections.emptyList()), cache.getCacheConfiguration().clustering().hash().keyPartitioner(), cache.getCacheManager().getAddress(), true);
}

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

@Override
public Affinity getWeakAffinity(I id) {
  if (this.cache.getCacheConfiguration().clustering().cacheMode().isClustered()) {
    Node node = this.locatePrimaryOwner(id);
    Map.Entry<String, ?> entry = this.registry.getEntry(node);
    if (entry != null) {
      return new NodeAffinity(entry.getKey());
    }
  }
  return Affinity.NONE;
}

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

@Override
public void stop() {
  this.groupFactory.close();
  this.cache.removeListener(this);
  PrivilegedAction<List<Runnable>> action = () -> this.executor.shutdownNow();
  WildFlySecurityManager.doUnchecked(action);
  try {
    this.executor.awaitTermination(this.cache.getCacheConfiguration().transaction().cacheStopTimeout(), TimeUnit.MILLISECONDS);
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
  } finally {
    if (this.dispatcher != null) {
      this.dispatcher.close();
    }
    this.scheduler.close();
    this.affinity.stop();
  }
}

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

WildFlySecurityManager.doUnchecked(action);
try {
  executor.awaitTermination(this.cache.getCacheConfiguration().transaction().cacheStopTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
  Thread.currentThread().interrupt();

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

@Override
  public <K> KeyAffinityService<K> createService(Cache<K, ?> cache, KeyGenerator<K> generator) {
    CacheMode mode = cache.getCacheConfiguration().clustering().cacheMode();
    return mode.isDistributed() || mode.isReplicated() ? new KeyAffinityServiceImpl<>(executor, cache, generator, bufferSize, Collections.singleton(cache.getCacheManager().getAddress()), false) : new SimpleKeyAffinityService<>(generator);
  }
};

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

@Override
public void accept(XAResourceRecovery recovery) {
  if (this.cache.get().getCacheConfiguration().transaction().recovery().enabled()) {
    this.registry.get().removeXAResourceRecovery(recovery);
  }
}

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

@Override
public Affinity getStrictAffinity() {
  Group group = this.registry.getGroup();
  return this.cache.getCacheConfiguration().clustering().cacheMode().isClustered() ? new ClusterAffinity(group.getName()) : new NodeAffinity(this.registry.getEntry(group.getLocalMember()).getKey());
}

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

public CacheServiceProviderRegistry(CacheServiceProviderRegistryConfiguration<T> config) {
  this.group = config.getGroup();
  this.cache = config.getCache();
  this.batcher = config.getBatcher();
  this.dispatcher = config.getCommandDispatcherFactory().createCommandDispatcher(config.getId(), this.listeners.keySet());
  this.cache.addListener(this);
  this.groupRegistration = this.group.register(this);
  this.invoker = new RetryingInvoker(this.cache);
  this.properties = new InfinispanCacheProperties(this.cache.getCacheConfiguration());
}

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

@Override
public XAResourceRecovery get() {
  Cache<?, ?> cache = this.cache.get();
  XAResourceRecovery recovery = new InfinispanXAResourceRecovery(cache);
  if (cache.getCacheConfiguration().transaction().recovery().enabled()) {
    this.registry.get().addXAResourceRecovery(recovery);
  }
  return recovery;
}

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

@Override
  public String locate(String sessionId) {
    DistributionManager dist = this.cache.getAdvancedCache().getDistributionManager();
    Address address = (dist != null) && !this.cache.getCacheConfiguration().clustering().cacheMode().isScattered() ? dist.getCacheTopology().getDistribution(new Key<>(sessionId)).primary() : this.cache.getCacheManager().getAddress();
    Node node = (address != null) ? this.factory.createNode(address) : null;
    Map.Entry<String, Void> entry = (node != null) ? this.registry.getEntry(node) : null;
    if (entry == null) {
      entry = this.registry.getEntry(this.registry.getGroup().getLocalMember());
    }
    return (entry != null) ? entry.getKey() : null;
  }
}

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

Node locatePrimaryOwner(I id) {
  DistributionManager dist = this.cache.getAdvancedCache().getDistributionManager();
  Address address = (dist != null) && !this.cache.getCacheConfiguration().clustering().cacheMode().isScattered() ? dist.getCacheTopology().getDistribution(new Key<>(id)).primary() : null;
  Node member = (address != null) ? this.nodeFactory.createNode(address) : null;
  return (member != null) ? member : this.registry.getGroup().getLocalMember();
}

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

@Override
  public <L, C extends Marshallability> SSOManager<A, D, S, L, TransactionBatch> createSSOManager(SSOManagerConfiguration<L, C> configuration) {
    Cache<Key<String>, ?> cache = this.configuration.getCache();
    CacheProperties properties = new InfinispanCacheProperties(cache.getCacheConfiguration());
    SessionsFactory<Map<D, S>, D, S> sessionsFactory = new CoarseSessionsFactory<>(this.configuration.getCache(), properties);
    SSOFactory<Map.Entry<A, AtomicReference<L>>, Map<D, S>, A, D, S, L> factory = new InfinispanSSOFactory<>(this.configuration.getCache(), properties, new MarshalledValueMarshaller<>(configuration.getMarshalledValueFactory(), configuration.getMarshallingContext()), configuration.getLocalContextFactory(), sessionsFactory);
    IdentifierFactory<String> idFactory = new AffinityIdentifierFactory<>(configuration.getIdentifierFactory(), cache, this.configuration.getKeyAffinityServiceFactory());
    Batcher<TransactionBatch> batcher = new InfinispanBatcher(cache);
    return new InfinispanSSOManager<>(factory, idFactory, batcher);
  }
}

代码示例来源: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: wildfly/wildfly

Cache<BeanKey<I>, BeanEntry<I>> beanCache = this.configuration.getCache();
Cache<BeanGroupKey<I>, BeanGroupEntry<I, T>> groupCache = this.configuration.getCache();
CacheProperties properties = new InfinispanCacheProperties(groupCache.getCacheConfiguration());
String beanName = this.configuration.getBeanContext().getBeanName();
BeanPassivationConfiguration passivationConfig = this.configuration.getPassivationConfiguration();

相关文章