Package org.infinispan.configuration.cache

Examples of org.infinispan.configuration.cache.CacheMode


      return protobufSchemaCache;
   }

   private ConfigurationBuilder getProtobufMetadataCacheConfig() {
      GlobalConfiguration globalConfiguration = cacheManager.getGlobalComponentRegistry().getGlobalConfiguration();
      CacheMode cacheMode = globalConfiguration.isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL;

      ConfigurationBuilder cfg = new ConfigurationBuilder();
      cfg.transaction()
            .transactionMode(TransactionMode.TRANSACTIONAL).invocationBatching().enable()
            .transaction().lockingMode(LockingMode.PESSIMISTIC).syncCommitPhase(true).syncRollbackPhase(true)
View Full Code Here


        final Mode mode = Mode.valueOf(ClusteredCacheResourceDefinition.MODE.resolveModelAttribute(context, cache).asString());

        final int queueSize = ClusteredCacheResourceDefinition.QUEUE_SIZE.resolveModelAttribute(context, cache).asInt();

        // adjust the cache mode used based on the value of clustered attribute MODE
        CacheMode cacheMode = mode.apply(this.mode);
        builder.clustering().cacheMode(cacheMode);

        // process clustered cache attributes and elements
        if (cacheMode.isSynchronous()) {
            builder.clustering().sync().replTimeout(ClusteredCacheResourceDefinition.REMOTE_TIMEOUT.resolveModelAttribute(context, cache).asLong());
        } else {
            builder.clustering().async()
                    .useReplQueue(queueSize > 0)
                    .replQueueMaxElements(queueSize)
View Full Code Here

    @Override
    public void start(StartContext context) throws StartException {
        this.config = this.getConfigurationBuilder().build();

        EmbeddedCacheManager container = this.getCacheContainer();
        CacheMode mode = this.config.clustering().cacheMode();
        if (mode.isClustered() && (container.getTransport() == null)) {
            throw InfinispanLogger.ROOT_LOGGER.transportRequired(mode, this.name, container.getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName());
        }

        container.defineConfiguration(this.name, this.config);
View Full Code Here

    @Override
    public void start(StartContext context) throws StartException {
        this.config = this.getConfigurationBuilder().build();

        EmbeddedCacheManager container = this.getCacheContainer();
        CacheMode mode = this.config.clustering().cacheMode();
        if (mode.isClustered() && (container.getTransport() == null)) {
            throw InfinispanMessages.MESSAGES.transportRequired(mode, this.name, container.getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName());
        }

        container.defineConfiguration(this.name, this.config);
View Full Code Here

    public static CacheMode getCacheMode(ModelNode operation) {

        PathAddress cacheAddress = PathAddress.pathAddress(operation.get(OP_ADDR));
        String cacheType = cacheAddress.getLastElement().getKey();

        CacheMode mode = null;
        if (cacheType.equals(ModelKeys.LOCAL_CACHE)) {
            mode = CacheMode.LOCAL;
        } else if (cacheType.equals(ModelKeys.INVALIDATION_CACHE)) {
            mode = CacheMode.INVALIDATION_SYNC;
        }
View Full Code Here

        final int queueSize = CommonAttributes.QUEUE_SIZE.resolveModelAttribute(context, cache).asInt();
        final long queueFlushInterval = CommonAttributes.QUEUE_FLUSH_INTERVAL.resolveModelAttribute(context, cache).asLong();
        final boolean asyncMarshalling = CommonAttributes.ASYNC_MARSHALLING.resolveModelAttribute(context, cache).asBoolean();

        // adjust the cache mode used based on the value of clustered attribute MODE
        CacheMode cacheMode = mode.apply(this.mode);
        builder.clustering().cacheMode(cacheMode);

        // process clustered cache attributes and elements
        if (cacheMode.isSynchronous()) {
            builder.clustering().sync().replTimeout(remoteTimeout);
        } else {
            builder.clustering().async().useReplQueue(queueSize > 0);
            builder.clustering().async().replQueueMaxElements(queueSize);
            builder.clustering().async().replQueueInterval(queueFlushInterval);
View Full Code Here

   public static final int DEFAULT_SCOPE = 0;
  public static final int GLOBAL_SCOPE = 1;
  public static final int LOCAL_SCOPE = 2;

  public static <K> Set<K> getAllKeys(Cache<K, ?> cache, int scope) {
    CacheMode cacheMode = cache.getAdvancedCache().getCacheConfiguration().clustering().cacheMode();
    boolean keysAreLocal = !cacheMode.isClustered() || cacheMode.isReplicated();
    if (keysAreLocal || scope == LOCAL_SCOPE) {
      return cache.keySet();
    } else {
         MapReduceTask<K, Object, K, Object> task =
               new MapReduceTask<K, Object, K, Object>((Cache<K, Object>) cache)
View Full Code Here

  public static final int DEFAULT_SCOPE = 0;
  public static final int GLOBAL_SCOPE = 1;
  public static final int LOCAL_SCOPE = 2;
 
  public static final Set<byte[]> getAllKeys(Cache<byte[], byte[]> cache, int scope) {
    CacheMode cacheMode = cache.getAdvancedCache().getCacheConfiguration().clustering().cacheMode();
    boolean keysAreLocal = !cacheMode.isClustered() || cacheMode.isReplicated();
    if (keysAreLocal || scope == LOCAL_SCOPE) {
      return cache.keySet();
    } else {
      MapReduceTask<byte[], byte[], byte[], Object> task =
               new MapReduceTask<byte[], byte[], byte[], Object>(cache)
View Full Code Here

    * 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

    * 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

TOP

Related Classes of org.infinispan.configuration.cache.CacheMode

Copyright © 2018 www.massapicom. 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.