private StoreConfigurationBuilder<?, ?> buildCacheLoader(PersistenceConfigurationBuilder persistenceBuilder, ModelNode loader, String loaderKey) throws OperationFailedException { if (loaderKey.equals(ModelKeys.CLUSTER_LOADER)) { final ClusterLoaderConfigurationBuilder builder = persistenceBuilder.addClusterLoader(); if (loader.hasDefined(ModelKeys.REMOTE_TIMEOUT)) { builder.remoteCallTimeout(loader.require(ModelKeys.REMOTE_TIMEOUT).asLong()); } return builder; } else if (loaderKey.equals(ModelKeys.LOADER)) { String className = loader.require(ModelKeys.CLASS).asString(); try { return handleStoreOrLoaderClass(className, persistenceBuilder); } catch (Exception e) { throw InfinispanMessages.MESSAGES.invalidCacheStore(e, className); } } else { throw new IllegalStateException(); } }
private void parseClusterLoader(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder) throws XMLStreamException { ConfigurationBuilder builder = holder.getCurrentConfigurationBuilder(); ClusterLoaderConfigurationBuilder cclb = builder.persistence().addClusterLoader(); for (int i = 0; i < reader.getAttributeCount(); i++) { ParseUtils.requireNoNamespaceAttribute(reader, i); String value = replaceProperties(reader.getAttributeValue(i)); String attrName = reader.getAttributeLocalName(i); Attribute attribute = Attribute.forName(attrName); switch (attribute) { case REMOTE_CALL_TIMEOUT: cclb.remoteCallTimeout(Long.parseLong(value)); break; default: parseCommonStoreAttributes(reader, cclb, attrName, value, i); break; } } parseLoaderChildren(reader, cclb); }
parseStoreChildren(reader, storeConfigurationBuilder); } else if (store instanceof ClusterLoader) { storeConfigurationBuilder = builder.persistence().addClusterLoader(); parseLoaderChildren(reader, storeConfigurationBuilder);
@Override protected void createCacheManagers() throws Throwable { EmbeddedCacheManager cacheManager1 = TestCacheManagerFactory.createClusteredCacheManager(); EmbeddedCacheManager cacheManager2 = TestCacheManagerFactory.createClusteredCacheManager(); registerCacheManager(cacheManager1, cacheManager2); ConfigurationBuilder config1 = getDefaultClusteredCacheConfig(cacheMode, false); config1.persistence().addClusterLoader(); ConfigurationBuilder config2 = getDefaultClusteredCacheConfig(cacheMode, false); config2.persistence().addClusterLoader(); config2.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class); cacheManager1.defineConfiguration("clusteredCl", config1.build()); cacheManager2.defineConfiguration("clusteredCl", config2.build()); waitForClusterToForm("clusteredCl"); }
protected ConfigurationBuilder createTopologyCacheConfig(long distSyncTimeout) { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().cacheMode(CacheMode.REPL_SYNC).remoteTimeout(configuration.topologyReplTimeout()) .locking().lockAcquisitionTimeout(configuration.topologyLockTimeout()) .clustering().partitionHandling().mergePolicy(null) .expiration().lifespan(-1).maxIdle(-1); if (configuration.topologyStateTransfer()) { builder .clustering() .stateTransfer() .awaitInitialTransfer(configuration.topologyAwaitInitialTransfer()) .fetchInMemoryState(true) .timeout(distSyncTimeout + configuration.topologyReplTimeout()); } else { builder.persistence().addClusterLoader().remoteCallTimeout(configuration.topologyReplTimeout()); } return builder; }