private void loadForeignMarshallables(GlobalConfiguration globalCfg) {
if (log.isTraceEnabled())
log.trace("Loading user defined externalizers");
List<AdvancedExternalizerConfig> configs = globalCfg.getExternalizers();
for (AdvancedExternalizerConfig config : configs) {
AdvancedExternalizer ext = config.getAdvancedExternalizer() != null ? config.getAdvancedExternalizer()
: (AdvancedExternalizer) Util.getInstance(config.getExternalizerClass(), globalCfg.getClassLoader());
// If no XML or programmatic config, id in annotation is used
// as long as it's not default one (meaning, user did not set it).
// If XML or programmatic config in use ignore @Marshalls annotation and use value in config.
Integer id = ext.getId();
if (config.getId() == null && id == null)
throw new ConfigurationException(String.format(
"No advanced externalizer identifier set for externalizer %s",
ext.getClass().getName()));
else if (config.getId() != null)
id = config.getId();
id = checkForeignIdLimit(id, ext);
updateExtReadersWritersWithTypes(new ForeignExternalizerAdapter(id, ext), generateForeignReaderIndex(id));