Examples of CacheMode


Examples of org.infinispan.configuration.cache.CacheMode

    * If no ConsistentHashFactory was explicitly configured we choose a suitable one based on cache mode.
    */
   private ConsistentHashFactory pickConsistentHashFactory() {
      ConsistentHashFactory factory = configuration.clustering().hash().consistentHashFactory();
      if (factory == null) {
         CacheMode cacheMode = configuration.clustering().cacheMode();
         if (cacheMode.isClustered()) {
            if (cacheMode.isDistributed()) {
               if (globalConfiguration.transport().hasTopologyInfo()) {
                  factory = new TopologyAwareConsistentHashFactory();
               } else {
                  factory = new DefaultConsistentHashFactory();
               }
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

    */
   public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter,
                                           CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) {
      Listener l = testListenerClassValidity(listener.getClass());
      UUID generatedId = UUID.randomUUID();
      CacheMode cacheMode = config.clustering().cacheMode();
      CacheInvocationBuilder builder = new CacheInvocationBuilder();
      builder
            .setIncludeCurrentState(l.includeCurrentState())
            .setClustered(l.clustered())
            .setOnlyPrimary(l.clustered() ? (cacheMode.isDistributed() ? true : false) : l.primaryOnly())
            .setFilter(filter)
            .setConverter(converter)
            .setIdentifier(generatedId)
            .setClassLoader(classLoader);
      boolean foundMethods = validateAndAddListenerInvocation(listener, builder);

      if (foundMethods && l.clustered()) {
         if (cacheMode.isInvalidation()) {
            throw new UnsupportedOperationException("Cluster listeners cannot be used with Invalidation Caches!");
         } else if (cacheMode.isDistributed()) {
            clusterListenerIDs.put(listener, generatedId);
            EmbeddedCacheManager manager = cache.getCacheManager();
            Address ourAddress = manager.getAddress();

            List<Address> members = manager.getMembers();
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

   @Override
   @SuppressWarnings("unchecked")
   public <T> T construct(Class<T> componentType) {
      Class<?> componentImpl;
      if (componentType.equals(ClusteringDependentLogic.class)) {
         CacheMode cacheMode = configuration.clustering().cacheMode();
         if (!cacheMode.isClustered()) {
            return componentType.cast(new ClusteringDependentLogic.LocalLogic());
         } else if (cacheMode.isInvalidation()) {
            return componentType.cast(new ClusteringDependentLogic.InvalidationLogic());
         } else if (cacheMode.isReplicated()) {
            return componentType.cast(new ClusteringDependentLogic.ReplicationLogic());
         } else {
            return componentType.cast(new ClusteringDependentLogic.DistributionLogic());
         }
      } else {
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

    * If no ConsistentHashFactory was explicitly configured we choose a suitable one based on cache mode.
    */
   private ConsistentHashFactory pickConsistentHashFactory() {
      ConsistentHashFactory factory = configuration.clustering().hash().consistentHashFactory();
      if (factory == null) {
         CacheMode cacheMode = configuration.clustering().cacheMode();
         if (cacheMode.isClustered()) {
            if (cacheMode.isDistributed()) {
               if (globalConfiguration.transport().hasTopologyInfo()) {
                  factory = new TopologyAwareConsistentHashFactory();
               } else {
                  factory = new DefaultConsistentHashFactory();
               }
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

   private Configuration getRegistryCacheConfig() {
      ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

      //allow the registry to work for local caches as well as clustered caches
      CacheMode cacheMode = 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();
View Full Code Here

Examples of org.jboss.cache.config.Configuration.CacheMode

      if (caches.get(cacheID) != null)
      {
         throw new IllegalStateException(cacheID + " already created");
      }

      CacheMode mode = sync ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
      Configuration c = UnitTestConfigurationFactory.createConfiguration(mode);

      if (sync)
      {
         c.setSyncRollbackPhase(true);
View Full Code Here

Examples of org.jboss.cache.config.Configuration.CacheMode

   private void internalSetClusteredCache(Cache<Serializable, Serializable> cache)
   {
      this.cache = cache;
      if (this.cache != null)
      {       
        CacheMode cm = cache.getConfiguration().getCacheMode();
        if (CacheMode.REPL_ASYNC == cm)
        {
           this.replAsync = true;
        }
        else if (CacheMode.REPL_SYNC == cm)
View Full Code Here

Examples of org.jboss.cache.config.Configuration.CacheMode

   public void setClusteredCache(Cache<Serializable, Serializable> cache)
   {
      this.cache = cache;
      if (this.cache != null)
      {       
        CacheMode cm = cache.getConfiguration().getCacheMode();
        if (CacheMode.REPL_ASYNC == cm)
        {
           this.replAsync = true;
        }
        else if (CacheMode.REPL_SYNC == cm)
View Full Code Here

Examples of org.jboss.cache.config.Configuration.CacheMode

      if (caches.get(cacheID) != null)
      {
         throw new IllegalStateException(cacheID + " already created");
      }

      CacheMode mode = sync ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
      Configuration c = UnitTestCacheConfigurationFactory.createConfiguration(mode);

      CacheSPI<?, ?> cache = (CacheSPI<?, ?>) new UnitTestCacheFactory<Object, Object>().createCache(c, false);

      //cache.getConfiguration().setClusterName("TestCluster");
View Full Code Here

Examples of org.jboss.cache.config.Configuration.CacheMode

   }

   @Inject
   void init()
   {
      CacheMode mode = configuration.getCacheMode();
      useTombstones = (mode == CacheMode.INVALIDATION_ASYNC) || (mode == CacheMode.INVALIDATION_SYNC);
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.