@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; }
private void writePersistence(XMLExtendedStreamWriter writer, Configuration configuration) throws XMLStreamException { PersistenceConfiguration persistence = configuration.persistence(); AttributeSet attributes = persistence.attributes(); if (attributes.isModified() || persistence.stores().size() > 0) { writer.writeStartElement(Element.PERSISTENCE); attributes.write(writer, PersistenceConfiguration.PASSIVATION, Attribute.PASSIVATION); for (StoreConfiguration store : persistence.stores()) { writeStore(writer, store); } writer.writeEndElement(); } }