/** * Sets the granularity of session data replicated across the cluster. * Valid values are: * <ul> * <li>SESSION</li> * <li>ATTRIBUTE</li> * <li>FIELD</li> * </ul> */ public void setReplicationGranularityString(String granularity) { setReplicationGranularity(granularity == null ? null : ReplicationGranularity.fromString(granularity.toUpperCase())); }
/** * Returns the replication granularity. * * @see JBossWebMetaData#REPLICATION_GRANULARITY_ATTRIBUTE * @see JBossWebMetaData#REPLICATION_GRANULARITY_FIELD * @see JBossWebMetaData#REPLICATION_GRANULARITY_SESSION */ public String getReplicationGranularityString() { return replicationGranularity_ == null ? null : replicationGranularity_.toString(); }
/** * {@inheritDoc} * * @see org.jboss.as.clustering.web.infinispan.SessionAttributeStorageFactory#createStorage(org.jboss.metadata.web.jboss.ReplicationGranularity, org.jboss.as.clustering.web.SessionAttributeMarshaller) */ @SuppressWarnings("unchecked") @Override public <T extends OutgoingDistributableSessionData> SessionAttributeStorage<T> createStorage(ReplicationGranularity granularity, SessionAttributeMarshaller marshaller) { switch ((granularity != null) ? granularity : ReplicationGranularity.SESSION) { case SESSION: { return (SessionAttributeStorage<T>) new CoarseSessionAttributeStorage(marshaller); } case ATTRIBUTE: { return (SessionAttributeStorage<T>) new FineSessionAttributeStorage(marshaller); } case FIELD: { ROOT_LOGGER.deprecatedGranularity(ReplicationGranularity.FIELD.name(), ReplicationGranularity.SESSION.name()); return this.createStorage(ReplicationGranularity.SESSION, marshaller); } default: { throw MESSAGES.unknownReplicationGranularity(granularity); } } } }
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; } }