commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] Commented: (CLI-209) OptionBuilder is not thread-safe
Date Tue, 28 Sep 2010 09:56:33 GMT


Sebb commented on CLI-209:

Another way to fix the class would be to turn all the static variables into instance variables,
and add parallel instance methods. The static methods would then use a static singleton instance.
That would allow use from multiple threads without the overhead of ThreadLocal.

The library would still not be thread-safe, but at least it could be used by multiple threads
in parallel so long as each thread had its own instances.

> OptionBuilder is not thread-safe
> --------------------------------
>                 Key: CLI-209
>                 URL:
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: CLI-1.x
>    Affects Versions: 1.0, 1.1, 1.2
>         Environment: Windows XP, Java 6
>            Reporter: Thomas Herre
> Class OptionBuilder is not thread-safe.
> It uses one OptionBuilder instance without synchronizing access to it.
> If more than one thread uses OptionBuilder, that can result in invalid Options (suppose
a scheduler component).
> Don't know if this should be fixed. At least the Javadoc should mention the fact that
the class is not thread-safe.
> As a workaround, use constructor of class Option.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message