[jira] [Commented] (CLI-209) OptionBuilder is not thread-safe

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Commented] (CLI-209) OptionBuilder is not thread-safe

David Costanzo (Jira)

    [ https://issues.apache.org/jira/browse/CLI-209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13437793#comment-13437793 ]

Karel Vervaeke commented on CLI-209:

I would mark this 'wont fix', since OptionBuilder still is not, by any definition threadsafe.
CLI-224 seems to be a duplicate. Perhaps you could keep this one closed (won't fix in 1.x line) and keep the other one open for 2.0.

Two hypothetical use cases for making CLI thread safe:
* A container where multiple users enter commands simultaneously, and where the parsing of the command happens in the container).
* A program designed to execute multiple commands in parallel: The commands are read from configuration files, and for each line a parallel process is started to parse and execute the command.

> OptionBuilder is not thread-safe
> --------------------------------
>                 Key: CLI-209
>                 URL: https://issues.apache.org/jira/browse/CLI-209
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: CLI-1.x
>    Affects Versions: 1.0, 1.1, 1.2
>            Reporter: Thomas Herre
>            Priority: Minor
>             Fix For: 1.3
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira