You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Daan Hoogland <da...@gmail.com> on 2014/06/06 22:22:34 UTC
[DISCUSS] try-with-resouce use
H,
I have commited a patch to Upgrade430to440.java that removes all
close() calls on PreparedStament en ResultSet objects, replacing it
with the try(<resouce>) construct in java 7. I was tempted for a short
moment to back-port it to older Upgrade classes. As those upgrade
paths are to be supported by lower versions of java. In master (and
branch 4.4) however these are only to be run with java 7. So should we
fix the upgrades by try-with-resources or not?
--
Daan
RE: [DISCUSS] try-with-resouce use
Posted by Rajani Karuturi <Ra...@citrix.com>.
I think in the branches 4.4 and above we should use try-resource-construct for all the upgrade paths.
Otherwise we will continue to see resource leaks due to copy-paste-modified code.
~Rajani
Sent from my Windows Phone
________________________________
From: Daan Hoogland<ma...@gmail.com>
Sent: 07-06-2014 01:53
To: dev<ma...@cloudstack.apache.org>
Subject: [DISCUSS] try-with-resouce use
H,
I have commited a patch to Upgrade430to440.java that removes all
close() calls on PreparedStament en ResultSet objects, replacing it
with the try(<resouce>) construct in java 7. I was tempted for a short
moment to back-port it to older Upgrade classes. As those upgrade
paths are to be supported by lower versions of java. In master (and
branch 4.4) however these are only to be run with java 7. So should we
fix the upgrades by try-with-resources or not?
--
Daan
Re: [DISCUSS] try-with-resouce use
Posted by Daan Hoogland <da...@gmail.com>.
I don't want to fix resource leaks in master in a way we can not
backport. That's my point. And no I am not going to do a lot of it
but want to set a policy.
On Fri, Jun 6, 2014 at 10:46 PM, Alex Huang <Al...@citrix.com> wrote:
> In general, as long as it works in the new jvm, I don't see us changing the code. However, if you have the time to do it. The upgrade classes are meant to be immutable as far as data goes. So the idea is we can do upgrades from any version to the current version. Because of that, then all upgrade classes could be run in the new jvm.
>
> I don't see why older upgrade classes in master branch be run in older jvms.
>
> --Alex
>
>> -----Original Message-----
>> From: Daan Hoogland [mailto:daan.hoogland@gmail.com]
>> Sent: Friday, June 6, 2014 1:23 PM
>> To: dev
>> Subject: [DISCUSS] try-with-resouce use
>>
>> H,
>>
>> I have commited a patch to Upgrade430to440.java that removes all
>> close() calls on PreparedStament en ResultSet objects, replacing it with the
>> try(<resouce>) construct in java 7. I was tempted for a short moment to
>> back-port it to older Upgrade classes. As those upgrade paths are to be
>> supported by lower versions of java. In master (and branch 4.4) however
>> these are only to be run with java 7. So should we fix the upgrades by try-
>> with-resources or not?
>>
>> --
>> Daan
--
Daan
RE: [DISCUSS] try-with-resouce use
Posted by Alex Huang <Al...@citrix.com>.
In general, as long as it works in the new jvm, I don't see us changing the code. However, if you have the time to do it. The upgrade classes are meant to be immutable as far as data goes. So the idea is we can do upgrades from any version to the current version. Because of that, then all upgrade classes could be run in the new jvm.
I don't see why older upgrade classes in master branch be run in older jvms.
--Alex
> -----Original Message-----
> From: Daan Hoogland [mailto:daan.hoogland@gmail.com]
> Sent: Friday, June 6, 2014 1:23 PM
> To: dev
> Subject: [DISCUSS] try-with-resouce use
>
> H,
>
> I have commited a patch to Upgrade430to440.java that removes all
> close() calls on PreparedStament en ResultSet objects, replacing it with the
> try(<resouce>) construct in java 7. I was tempted for a short moment to
> back-port it to older Upgrade classes. As those upgrade paths are to be
> supported by lower versions of java. In master (and branch 4.4) however
> these are only to be run with java 7. So should we fix the upgrades by try-
> with-resources or not?
>
> --
> Daan