hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Fwd: svn commit: r1615885 - in /httpcomponents/httpcore/trunk/httpcore/src: main/java/org/apache/http/message/TokenParser.java test/java/org/apache/http/message/TestTokenParser.java
Date Thu, 07 Aug 2014 18:17:57 GMT
On 07/08/14 17:26 , sebb wrote:
> On 5 August 2014 09:15,  <olegk@apache.org> wrote:
>> Author: olegk
>> Date: Tue Aug  5 08:15:47 2014
>> New Revision: 1615885
>>
>> URL: http://svn.apache.org/r1615885
>> Log:
>> New token parser implementation partially based on Mime4J code (written by me)
>>
>> Added:
>>      httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/message/TokenParser.java
  (with props)
>
> Looks generally OK, though I question whether the input buffer needs
> to be resizeable - do we need to use CharArrayBuffer?
>
> Why not use String / CharSequence?
> Or even char[], but it might be best to use immutable input.
>

Usually the content that we need to parse comes from the wire and 
therefore the underlying content buffer must be able to grow as more 
data comes in. For consistency sake we should continue using 
CharArrayBuffer in 4.x but we can well consider using CharSequence in 5.0.


> There are a few code/doc tweaks it might be useful to make (see below).

Done.

>> +
>> +/**
>> + * Low level parser for header field elements. The parsing routines of this class
are designed
>> + * to produce near zero intermediate garbage and make no intermediate copies of
input data.
>> + * <p>
>> + * This class is immutable and thread safe.
>
> Are we sure about that?
> e.g it uses CharArrayBuffer and ParserCursor which are not.
>

I am reasonably sure. The class maintains no internal state and 
therefore is perfectly thread safe. CharArrayBuffer and ParserCursor 
though mutable should be provided as input by individual threads.

Oleg

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


Mime
View raw message