@Override public String getCacheName() { return (this.replicationConfig != null) ? this.replicationConfig.getCacheName() : null; } }
@Override public ReplicationGranularity getGranularity() { return ((this.replicationConfig != null) && (this.replicationConfig.getReplicationGranularity() != null)) ? this.replicationConfig.getReplicationGranularity() : ReplicationGranularity.SESSION; }
if (repCfg == null) repCfg = new ReplicationConfig(); metaData.setReplicationConfig(repCfg); if (repCfg.getUseJK() == null && useJK != null) repCfg.setUseJK(this.useJK); if (repCfg.getSnapshotMode() == null) repCfg.setSnapshotMode(this.snapshotMode); if (repCfg.getSnapshotInterval() == null) repCfg.setSnapshotInterval(new Integer(this.snapshotInterval)); if (repCfg.getReplicationGranularity() == null) repCfg.setReplicationGranularity(this.replicationGranularity); if (repCfg.getReplicationTrigger() == null) repCfg.setReplicationTrigger(this.replicationTrigger); if (repCfg.getCacheName() == null) repCfg.setCacheName(cacheName); if (repCfg.getMaxUnreplicatedInterval() == null) repCfg.setMaxUnreplicatedInterval(new Integer(maxUnreplicatedInterval));
this.replicationTrigger_ = replicationConfig_.getReplicationTrigger(); setReplicationGranularity(replicationConfig_.getReplicationGranularity()); Boolean jk = replicationConfig_.getUseJK(); if (jk != null) Boolean batch = replicationConfig_.getReplicationFieldBatchMode(); this.replicationFieldBatchMode_ = (batch == null ? Boolean.TRUE : batch); setSnapshotMode(replicationConfig_.getSnapshotMode()); Integer snapshotInt = replicationConfig_.getSnapshotInterval(); setSnapshotInterval(snapshotInt == null ? 0 : snapshotInt.intValue()); Integer maxUnrep = replicationConfig_.getMaxUnreplicatedInterval(); if (maxUnrep != null) " and snapshotInterval is " + snapshotInterval_); this.cacheConfigName_ = replicationConfig_.getCacheName(); this.notificationPolicyClass_ = replicationConfig_.getSessionNotificationPolicy();
private void synthesizeReplicationConfig() { ReplicationConfig cfg = new ReplicationConfig(); cfg.setReplicationGranularity(replicationGranularity_); cfg.setReplicationTrigger(replicationTrigger_); cfg.setUseJK(useJK_); cfg.setCacheName(cacheConfigName_); cfg.setSnapshotMode(snapshotMode_); cfg.setSnapshotInterval(Integer.valueOf(snapshotInterval_)); cfg.setMaxUnreplicatedInterval(Integer.valueOf(maxUnreplicatedInterval_)); cfg.setSessionNotificationPolicy(notificationPolicyClass_); this.replicationConfig_ = cfg; }
public static ReplicationConfig parse(XMLStreamReader reader, PropertyReplacer propertyReplacer) throws XMLStreamException { ReplicationConfig config = new ReplicationConfig(); // Handle elements while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { String localName = reader.getLocalName(); final Element element = Element.forName(localName); switch (element) { case CACHE_NAME: { config.setCacheName(getElementText(reader, propertyReplacer)); break; } case REPLICATION_GRANULARITY: { config.setReplicationGranularity(ReplicationGranularity.valueOf(getElementText(reader, propertyReplacer))); break; } default: { if (DEPRECATED_ELEMENTS.contains(localName)) { log.warnf("<%s/> is no longer supported and will be ignored", localName); // Skip any content reader.getElementText(); } else { throw unexpectedElement(reader); } } } } return config; } }
@Override public String getCacheName() { return (this.replicationConfig != null) ? this.replicationConfig.getCacheName() : null; } }
@Override public ReplicationGranularity getGranularity() { return ((this.replicationConfig != null) && (this.replicationConfig.getReplicationGranularity() != null)) ? this.replicationConfig.getReplicationGranularity() : ReplicationGranularity.SESSION; }
@Override public String getCacheName() { return (this.replicationConfig != null) ? this.replicationConfig.getCacheName() : null; } }
@Override public ReplicationGranularity getGranularity() { return ((this.replicationConfig != null) && (this.replicationConfig.getReplicationGranularity() != null)) ? this.replicationConfig.getReplicationGranularity() : ReplicationGranularity.SESSION; }
private ServiceName getCacheServiceName(ReplicationConfig config) { ServiceName baseServiceName = EmbeddedCacheManagerService.getServiceName(null); String cacheName = (config != null) ? config.getCacheName() : null; ServiceName serviceName = ServiceName.parse((cacheName != null) ? cacheName : DEFAULT_CACHE_CONTAINER); if (!baseServiceName.isParentOf(serviceName)) { serviceName = baseServiceName.append(serviceName); } return (serviceName.length() < 4) ? serviceName.append(CacheContainer.DEFAULT_CACHE_NAME) : serviceName; }
@Override public <T extends OutgoingDistributableSessionData> org.jboss.web.tomcat.service.session.distributedcache.spi.DistributedCacheManager<T> getDistributedCacheManager(LocalDistributableSessionManager manager) { Cache<String, Map<Object, Object>> sessionCache = this.sessionCacheSource.getCache(manager); SharedLocalYieldingClusterLockManager lockManager = this.lockManagerSource.getLockManager(sessionCache); TransactionManager tm = sessionCache.getAdvancedCache().getTransactionManager(); if (!(tm instanceof BatchModeTransactionManager)) { throw new IllegalStateException("Unexpected transaction manager type: " + ((tm != null) ? tm.getClass().getName() : "null")); } BatchingManager batchingManager = new BatchingManagerImpl(tm); SessionAttributeMarshaller marshaller = this.marshallerFactory.createMarshaller(manager); SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), marshaller); return new DistributedCacheManager<T>(manager, new AtomicMapCache<String, Object, Object>(sessionCache), this.jvmRouteCacheSource, lockManager, storage, batchingManager, this.invoker); }
@Override public <K, V> Cache<K, V> getCache(LocalDistributableSessionManager manager) { ReplicationConfig config = manager.getReplicationConfig(); String containerName = config.getCacheName(); String templateCacheName = null; if ((containerName != null) && !containerName.isEmpty()) { String[] parts = containerName.split(DELIMITER); if (parts.length == 2) { containerName = parts[0]; templateCacheName = parts[1]; } } String cacheName = manager.getName(); EmbeddedCacheManager container = this.registry.getCacheContainer(containerName); this.applyOverrides(container.defineConfiguration(cacheName, templateCacheName, new Configuration()), config); return container.<K, V>getCache(cacheName); }
@Override public <T extends OutgoingDistributableSessionData> org.jboss.as.clustering.web.DistributedCacheManager<T> getDistributedCacheManager(LocalDistributableSessionManager manager) throws ClusteringNotSupportedException { @SuppressWarnings("unchecked") Registry<String, Void> jvmRouteRegistry = this.registry.getValue(); @SuppressWarnings("unchecked") AdvancedCache<String, Map<Object, Object>> cache = this.cache.getValue().getAdvancedCache(); if (!cache.getCacheConfiguration().invocationBatching().enabled()) { ServiceName cacheServiceName = this.getCacheServiceName(manager.getReplicationConfig()); throw new ClusteringNotSupportedException(MESSAGES.failedToConfigureWebApp(cacheServiceName.getParent().getSimpleName(), cacheServiceName.getSimpleName())); } BatchingManager batchingManager = new TransactionBatchingManager(cache.getTransactionManager()); SessionAttributeStorage<T> storage = this.storageFactory.createStorage(manager.getReplicationConfig().getReplicationGranularity(), this.marshallerFactory.createMarshaller(manager)); return new DistributedCacheManager<T>(manager, new AtomicMapCache<String, Object, Object>(cache), jvmRouteRegistry, this.lockManager.getOptionalValue(), storage, batchingManager, this.invoker, this.affinityFactory.getValue()); }
if (webMetaData.getReplicationConfig() != null && webMetaData.getReplicationConfig().getCacheName() != null) { ServiceName sn = ServiceName.parse(webMetaData.getReplicationConfig().getCacheName()); cacheContainer = sn.getParent().getSimpleName(); deploymentSessionCacheName = sn.getSimpleName();
if (webMetaData.getReplicationConfig() != null && webMetaData.getReplicationConfig().getCacheName() != null) { ServiceName sn = ServiceName.parse(webMetaData.getReplicationConfig().getCacheName()); cacheContainer = sn.getParent().getSimpleName(); deploymentSessionCacheName = sn.getSimpleName();