You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Karthik K <os...@gmail.com> on 2012/01/18 20:56:10 UTC

Resource Release Helper methods - HTTPCLIENT-1159

As part of httpclient development, I find myself writing these helper
utilities to release resources ( HttpClient / HttpEntity ) etc , very
similar to IOUtils , from commons.io to release resources , that closes
'quietly' .


o.a.h.utils.HttpClientUtils
  closeQuietly(HttpClient)
and closeQuietly(HttpResponse response)

https://issues.apache.org/jira/browse/HTTPCLIENT-1159 .

+ some test cases as well.

Let me know your thoughts on the same.

--
  Karthik.

Re: Resource Release Helper methods - HTTPCLIENT-1159

Posted by Karthik K <os...@gmail.com>.
As part of the discussion in the jira, Oleg suggested about adding a
similar method to EntityUtils # consumeQuietly as well. HTTPCORE-290
 available with patch for the same.


On Wed, Jan 18, 2012 at 2:42 PM, Karthik K <os...@gmail.com> wrote:

>
>
> On Wed, Jan 18, 2012 at 2:23 PM, Oleg Kalnichevski <ol...@apache.org>wrote:
>
>> On Wed, 2012-01-18 at 13:34 -0800, Karthik K wrote:
>> > On Wed, Jan 18, 2012 at 12:30 PM, Oleg Kalnichevski <olegk@apache.org
>> >wrote:
>> >
>> > > On Wed, 2012-01-18 at 11:56 -0800, Karthik K wrote:
>> > > > As part of httpclient development, I find myself writing these
>> helper
>> > > > utilities to release resources ( HttpClient / HttpEntity ) etc ,
>> very
>> > > > similar to IOUtils , from commons.io to release resources , that
>> closes
>> > > > 'quietly' .
>> > > >
>> > > >
>> > > > o.a.h.utils.HttpClientUtils
>> > > >   closeQuietly(HttpClient)
>> > > > and closeQuietly(HttpResponse response)
>> > > >
>> > > > https://issues.apache.org/jira/browse/HTTPCLIENT-1159 .
>> > > >
>> > > > + some test cases as well.
>> > > >
>> > > > Let me know your thoughts on the same.
>> > > >
>> > > > --
>> > > >   Karthik.
>> > >
>> > > I'll happily commit the patch to SVN trunk if no objections are raised
>> > > within a day or two. One minor issue is that the proposed patch makes
>> > > use of static Log instances that generally are to be avoided.
>> Otherwise
>> > > the patch looks good to me.
>> > >
>> > > Cheers
>> > >
>> > > Oleg
>> > >
>> > >
>> > Thanks, Oleg.
>> >
>> > I have attached a version that has no logging at all altogether.
>> >
>> > My $0.02 -  given that this is independent with backward compatibility
>> > still, would it be possible to backport this to 4.1.x releases , to help
>> > incorporate this in our codebases , sooner than later.
>>
>> The evil side of me wants you to upgrade to 4.2 sooner ;-)
>
>
> The hacker side of me would happily do that or at least test-build the
> same :) , but the practical side of me, when we work on a bunch of projects
> , closed and in the open source world, is still conservative and
> not-upgrade-to-a-major-release, unless broken kind of thing.  We can live
> with a patched version internally, given the nature of the patch and catch
> the release train hopefully soon !!
>
>
>
>
>> Besides, we
>> should try to keep patch releases what they are meant to be - fully
>> backward and forward compatible drop-in replacements.
>>
>> Oleg
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
>> For additional commands, e-mail: dev-help@hc.apache.org
>>
>>
>

Re: Resource Release Helper methods - HTTPCLIENT-1159

Posted by Karthik K <os...@gmail.com>.
On Wed, Jan 18, 2012 at 2:23 PM, Oleg Kalnichevski <ol...@apache.org> wrote:

> On Wed, 2012-01-18 at 13:34 -0800, Karthik K wrote:
> > On Wed, Jan 18, 2012 at 12:30 PM, Oleg Kalnichevski <olegk@apache.org
> >wrote:
> >
> > > On Wed, 2012-01-18 at 11:56 -0800, Karthik K wrote:
> > > > As part of httpclient development, I find myself writing these helper
> > > > utilities to release resources ( HttpClient / HttpEntity ) etc , very
> > > > similar to IOUtils , from commons.io to release resources , that
> closes
> > > > 'quietly' .
> > > >
> > > >
> > > > o.a.h.utils.HttpClientUtils
> > > >   closeQuietly(HttpClient)
> > > > and closeQuietly(HttpResponse response)
> > > >
> > > > https://issues.apache.org/jira/browse/HTTPCLIENT-1159 .
> > > >
> > > > + some test cases as well.
> > > >
> > > > Let me know your thoughts on the same.
> > > >
> > > > --
> > > >   Karthik.
> > >
> > > I'll happily commit the patch to SVN trunk if no objections are raised
> > > within a day or two. One minor issue is that the proposed patch makes
> > > use of static Log instances that generally are to be avoided. Otherwise
> > > the patch looks good to me.
> > >
> > > Cheers
> > >
> > > Oleg
> > >
> > >
> > Thanks, Oleg.
> >
> > I have attached a version that has no logging at all altogether.
> >
> > My $0.02 -  given that this is independent with backward compatibility
> > still, would it be possible to backport this to 4.1.x releases , to help
> > incorporate this in our codebases , sooner than later.
>
> The evil side of me wants you to upgrade to 4.2 sooner ;-)


The hacker side of me would happily do that or at least test-build the same
:) , but the practical side of me, when we work on a bunch of projects ,
closed and in the open source world, is still conservative and
not-upgrade-to-a-major-release, unless broken kind of thing.  We can live
with a patched version internally, given the nature of the patch and catch
the release train hopefully soon !!




> Besides, we
> should try to keep patch releases what they are meant to be - fully
> backward and forward compatible drop-in replacements.
>
> Oleg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

Re: Resource Release Helper methods - HTTPCLIENT-1159

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2012-01-18 at 13:34 -0800, Karthik K wrote:
> On Wed, Jan 18, 2012 at 12:30 PM, Oleg Kalnichevski <ol...@apache.org>wrote:
> 
> > On Wed, 2012-01-18 at 11:56 -0800, Karthik K wrote:
> > > As part of httpclient development, I find myself writing these helper
> > > utilities to release resources ( HttpClient / HttpEntity ) etc , very
> > > similar to IOUtils , from commons.io to release resources , that closes
> > > 'quietly' .
> > >
> > >
> > > o.a.h.utils.HttpClientUtils
> > >   closeQuietly(HttpClient)
> > > and closeQuietly(HttpResponse response)
> > >
> > > https://issues.apache.org/jira/browse/HTTPCLIENT-1159 .
> > >
> > > + some test cases as well.
> > >
> > > Let me know your thoughts on the same.
> > >
> > > --
> > >   Karthik.
> >
> > I'll happily commit the patch to SVN trunk if no objections are raised
> > within a day or two. One minor issue is that the proposed patch makes
> > use of static Log instances that generally are to be avoided. Otherwise
> > the patch looks good to me.
> >
> > Cheers
> >
> > Oleg
> >
> >
> Thanks, Oleg.
> 
> I have attached a version that has no logging at all altogether.
> 
> My $0.02 -  given that this is independent with backward compatibility
> still, would it be possible to backport this to 4.1.x releases , to help
> incorporate this in our codebases , sooner than later.

The evil side of me wants you to upgrade to 4.2 sooner ;-) Besides, we
should try to keep patch releases what they are meant to be - fully
backward and forward compatible drop-in replacements.

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Resource Release Helper methods - HTTPCLIENT-1159

Posted by Karthik K <os...@gmail.com>.
On Wed, Jan 18, 2012 at 12:30 PM, Oleg Kalnichevski <ol...@apache.org>wrote:

> On Wed, 2012-01-18 at 11:56 -0800, Karthik K wrote:
> > As part of httpclient development, I find myself writing these helper
> > utilities to release resources ( HttpClient / HttpEntity ) etc , very
> > similar to IOUtils , from commons.io to release resources , that closes
> > 'quietly' .
> >
> >
> > o.a.h.utils.HttpClientUtils
> >   closeQuietly(HttpClient)
> > and closeQuietly(HttpResponse response)
> >
> > https://issues.apache.org/jira/browse/HTTPCLIENT-1159 .
> >
> > + some test cases as well.
> >
> > Let me know your thoughts on the same.
> >
> > --
> >   Karthik.
>
> I'll happily commit the patch to SVN trunk if no objections are raised
> within a day or two. One minor issue is that the proposed patch makes
> use of static Log instances that generally are to be avoided. Otherwise
> the patch looks good to me.
>
> Cheers
>
> Oleg
>
>
Thanks, Oleg.

I have attached a version that has no logging at all altogether.

My $0.02 -  given that this is independent with backward compatibility
still, would it be possible to backport this to 4.1.x releases , to help
incorporate this in our codebases , sooner than later.

Re: Resource Release Helper methods - HTTPCLIENT-1159

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2012-01-18 at 11:56 -0800, Karthik K wrote:
> As part of httpclient development, I find myself writing these helper
> utilities to release resources ( HttpClient / HttpEntity ) etc , very
> similar to IOUtils , from commons.io to release resources , that closes
> 'quietly' .
> 
> 
> o.a.h.utils.HttpClientUtils
>   closeQuietly(HttpClient)
> and closeQuietly(HttpResponse response)
> 
> https://issues.apache.org/jira/browse/HTTPCLIENT-1159 .
> 
> + some test cases as well.
> 
> Let me know your thoughts on the same.
> 
> --
>   Karthik.

I'll happily commit the patch to SVN trunk if no objections are raised
within a day or two. One minor issue is that the proposed patch makes
use of static Log instances that generally are to be avoided. Otherwise
the patch looks good to me.

Cheers

Oleg 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org