Пример #1
0
  @Override
  public ConfigurationBuilder createConfigurationBuilder() {
    ConfigurationBuilder builder = super.createConfigurationBuilder();
    builder.clustering().cacheMode(CacheMode.LOCAL);

    TransactionConfiguration transaction = this.transaction.getValue();
    LockingConfiguration locking = this.locking.getValue();
    PersistenceConfiguration persistence = this.persistence.getValue();

    // Auto-enable simple cache optimization if cache is non-transactional and non-persistent
    builder.simpleCache(
        !transaction.transactionMode().isTransactional() && !persistence.usingStores());
    if (InfinispanLogger.ROOT_LOGGER.isTraceEnabled() && builder.simpleCache()) {
      InfinispanLogger.ROOT_LOGGER.tracef(
          "Configuration for container '%s', cache '%s' will use simple cache optimization",
          this.containerName, this.cacheName);
    }
    if ((transaction.lockingMode() == LockingMode.OPTIMISTIC)
        && (locking.isolationLevel() == IsolationLevel.REPEATABLE_READ)) {
      builder.locking().writeSkewCheck(true);
      builder.versioning().enable().scheme(VersioningScheme.SIMPLE);
    }

    return builder;
  }
 public void testEnableVersioning() {
   ConfigurationBuilder builder = new ConfigurationBuilder();
   builder.versioning().enable();
   assert builder.build().versioning().enabled();
 }