On 27/10/2009, scolebou...@apache.org <scolebou...@apache.org> wrote:
> Author: scolebourne
>  Date: Tue Oct 27 00:59:15 2009
>  New Revision: 830040
>
>  URL: http://svn.apache.org/viewvc?rev=830040&view=rev
>  Log:
>  LANG-487 - Make default style thread-safe (better Javadoc)
>
>  Modified:
>     
> commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
>
>  Modified: 
> commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
>  URL: 
> http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java?rev=830040&r1=830039&r2=830040&view=diff
>  
> ==============================================================================
>  --- 
> commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
>  (original)
>  +++ 
> commons/proper/lang/trunk/src/java/org/apache/commons/lang/builder/ToStringBuilder.java
>  Tue Oct 27 00:59:15 2009
>  @@ -106,7 +106,9 @@
>       * It is recommended to pass a <code>ToStringStyle</code> to the 
> constructor instead
>       * of using this global default.</p>
>       *
>  -     * <p>This method is thread-safe, as a <code>volatile</code variable is 
> used internally.</p>
>  +     * <p>This method is not intended for use from multiple threads.

Surely the *get* method is intended to be called by multiple threads?
Otherwise why bother with volatile?

>  +     * Internally, a <code>volatile</code> variable is used to provide the 
> guarantee
>  +     * that the latest value set using {...@link #setDefaultStyle} is the 
> value returned.</p>
>       *
>       * <p>One reason for changing the default could be to have a verbose 
> style during
>       * development and a compact style in production.</p>
>  @@ -125,7 +127,9 @@
>       * It is recommended to pass a <code>ToStringStyle</code> to the 
> constructor instead
>       * of changing this global default.</p>
>       *
>  -     * <p>This method is thread-safe, as a <code>volatile</code variable is 
> used internally.</p>
>  +     * <p>This method is not intended for use from multiple threads.
>  +     * Internally, a <code>volatile</code> variable is used to provide the 
> guarantee
>  +     * that the latest value set is the value returned from {...@link 
> #getDefaultStyle}.</p>

+1

>       *
>       * @param style  the default <code>ToStringStyle</code>
>       * @throws IllegalArgumentException if the style is <code>null</code>
>
>
>

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

Reply via email to