https://issues.apache.org/bugzilla/show_bug.cgi?id=57420

--- Comment #6 from Violeta Georgieva <violet...@apache.org> ---
(In reply to Konstantin Kolinko from comment #4)
> 1) As far as I see, UDecoder does not have any fields and thus is
> thread-safe.
> 
> The thread safety is not documented, though.
> 
> As such, I do not mind creating an instance of UDecoder, as that feels safer.
> 
> A possible way to solve documentation issue is to add getInstance() factory
> methods to UEncoder, UDecoder. For decoder the method would return a
> singleton (thus "documenting" the thread safety), while for encoder it will
> always return a new instance.
> 
> 2) Both encoder and decoder are usually used only once per connection.
> 
> Thus I think it would be better to use local variables, creating the objects
> just before use, instead of caching them in class fields.
> 
> UDecoder is used in connect(). That call happens once.

+1 for creating it as a local variable

> UEncoder is used in list(). While it is possible to call list() multiple
> times, I think that in practice it is called only once.

list() is called many times by
org.apache.catalina.startup.ContextConfig.processAnnotationsJndi(URL, WebXml,
boolean)

As we add a save char to UEncoder I do not think that it will be OK to do this
every time when list() is called.

Wdyt?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to