[ 
https://issues.apache.org/jira/browse/CAMEL-6365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13894308#comment-13894308
 ] 

Babak Vahdat commented on CAMEL-6365:
-------------------------------------

There's 2 advantages of {{org.apache.camel.util.IOHelper}} utility reusage here:

Mostly you don't want to propagate any potential exceptions back while closing 
{{org.springframework.context.support.AbstractApplicationContext}} which 
implements {{java.io.Closable}} since spring 3.2.x. This is exactly the same 
intention when you close e.g. a {{java.io.FileOutputStream}} after you're done 
with writing into the file etc.

The coding effort becomes less, so that the following 6 lines of code:

{code}
if (springContext1 != null) {
    springContext1.close();
}

if (springContext2 != null) {
    springContext2.close();
}
{code}

becomes a one liner:

{code}
IOHelper.close(springContext1, springContext2);
{code}

> After the Spring 3.1.x support has been dropped then better make use of 
> IOHelper utility to close the Spring contexts in our code base. 
> ----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-6365
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6365
>             Project: Camel
>          Issue Type: Improvement
>    Affects Versions: 2.11.0
>            Reporter: Babak Vahdat
>            Assignee: Babak Vahdat
>            Priority: Minor
>             Fix For: 2.13.0
>
>
> See 
> http://camel.465427.n5.nabble.com/Upgrade-Spring-3-1-4-RELEASE-3-2-2-RELEASE-tp5732377p5732649.html



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to