Skip to content

Commit

Permalink
ISPN-7278 Cache-Container and Cache modules are not serialized
Browse files Browse the repository at this point in the history
  • Loading branch information
pruivo authored and tristantarrant committed Dec 5, 2016
1 parent daf9da9 commit c3e25c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Expand Up @@ -186,6 +186,7 @@ private void writeCacheContainer(XMLExtendedStreamWriter writer, ConfigurationHo
writeSerialization(writer, globalConfiguration);
writeJMX(writer, globalConfiguration);
writeGlobalState(writer, globalConfiguration);
writeExtraConfiguration(writer, globalConfiguration.modules());
for (Entry<String, Configuration> configuration : holder.getConfigurations().entrySet()) {
Configuration config = configuration.getValue();
switch (config.clustering().cacheMode()) {
Expand All @@ -207,9 +208,27 @@ private void writeCacheContainer(XMLExtendedStreamWriter writer, ConfigurationHo
default:
break;
}
writeExtraConfiguration(writer, config.modules());
}
}

private void writeExtraConfiguration(XMLExtendedStreamWriter writer, Map<Class<?>, ?> modules)
throws XMLStreamException {
for (Entry<Class<?>, ?> entry : modules.entrySet()) {
SerializedWith serializedWith = entry.getKey().getAnnotation(SerializedWith.class);
if (serializedWith == null) {
continue;
}
try {
ConfigurationSerializer<Object> serializer = Util.getInstanceStrict(serializedWith.value());
serializer.serialize(writer, entry.getValue());
} catch (InstantiationException | IllegalAccessException e) {
log.unableToInstantiateSerializer(serializedWith.value());
}
}

}

private void writeGlobalState(XMLExtendedStreamWriter writer, GlobalConfiguration globalConfiguration)
throws XMLStreamException {
GlobalStateConfiguration configuration = globalConfiguration.globalState();
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/infinispan/util/logging/Log.java
Expand Up @@ -1422,7 +1422,7 @@ TimeoutException timeoutWaitingForView(int expectedViewId, int currentViewId,
@Message(value = "Cannot determine a synthetic transaction configuration from mode=%s, xaEnabled=%s, recoveryEnabled=%s, batchingEnabled=%s", id = 412)
CacheConfigurationException unknownTransactionConfiguration(org.infinispan.transaction.TransactionMode mode, boolean xaEnabled, boolean recoveryEnabled, boolean batchingEnabled);

@Message(value = "Unable to instantiate serializer for StoreConfiguration %s", id = 413)
@Message(value = "Unable to instantiate serializer for %s", id = 413)
CacheConfigurationException unableToInstantiateSerializer(Class<?> storeConfigurationClass);

@Message(value = "Global security authorization should be enabled if cache authorization enabled.", id = 414)
Expand Down

0 comments on commit c3e25c5

Please sign in to comment.