I have many spring contexts, one parent and this has many child contexts. I use the outbound-gateway in the child contexts.
The HttpRequestExecutingMessageHandler creates and adds two converters to the conversionService in the doInit method:
protectedvoiddoInit() {
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory());
ConversionServiceconversionService = this.getConversionService();
if (conversionService == null){
conversionService = newGenericConversionService();
}
if (conversionServiceinstanceofConverterRegistry){
ConverterRegistryconverterRegistry =
(ConverterRegistry) conversionService;
converterRegistry.addConverter(newClassToStringConverter());
converterRegistry.addConverter(newObjectToStringConverter());
this.evaluationContext.setTypeConverter(newStandardTypeConverter(conversionService));
}
else {
logger.warn("ConversionService is not an instance of ConverterRegistry therefore" +
"ClassToStringConverter and ObjectToStringConverter will not be registered");
}
}
These two classes is are inner classes, not statics.
If I have an integration bean in any of my parent processes, the getConversionService method returns the same conversionService for all of my child contexts from that parent context. This results if I close my child context, the instance of HttpRequestExecutingMessageHandler remains in the heap because the converter classes are not statics but inner classes.
It would be good if these two classes be statics, not inner classes. In this case after the context close, the HttpRequestExecutingMessageHandler would release from the memory.
The other idea that it would be good in the doInit method if the converter registration placed after a condition:
if (!conversionService.canConvert(Class.class, String.class)) {
converterRegistry.addConverter(newClassToStringConverter());
}
if (!conversionService.canConvert(Object.class, String.class)) {
converterRegistry.addConverter(newObjectToStringConverter());
}
Roland Csupor opened INT-3698 and commented
I have many spring contexts, one parent and this has many child contexts. I use the outbound-gateway in the child contexts.
The HttpRequestExecutingMessageHandler creates and adds two converters to the conversionService in the doInit method:
These two classes is are inner classes, not statics.
If I have an integration bean in any of my parent processes, the getConversionService method returns the same conversionService for all of my child contexts from that parent context. This results if I close my child context, the instance of HttpRequestExecutingMessageHandler remains in the heap because the converter classes are not statics but inner classes.
It would be good if these two classes be statics, not inner classes. In this case after the context close, the HttpRequestExecutingMessageHandler would release from the memory.
The other idea that it would be good in the doInit method if the converter registration placed after a condition:
Affects: 4.1.3
Referenced from: pull request #1420
Backported to: 4.0.8
The text was updated successfully, but these errors were encountered: