You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Colebourne <sc...@btopenworld.com> on 2003/09/10 23:15:02 UTC

Re: [collections] MapUtils.debug/verbosePrint thread safety

The methods that call this one are synchronized to protect them, so it
should be thread-safe.

However, I would prefer them not to need to be synchronized. If you want to
submit a patch that reworks the methods that would be great.

Incompatable change?
The protected method should remain and be deprecated, as it may be used by a
MapUtils subclass (feasible but unlikely). However, I would prefer just to
go incompatable change on this one. Other committers may differ, but if they
don't I'll just commit the incompatable change.

Stephen

----- Original Message -----
From: "Arun Thomas" <Ar...@solidusnetworks.com>
> I recently noticed that the current implementation of the debugPrint and
verbosePrint methods in MapUtils is not thread safe - in fact, these are the
only items that are not thread safe because the indentation state for the
output is preserved in a static variable.
>
> I think it would be fairly simple to make this thread safe, but it would
require a change to the signature of a protected member function
printIndent(PrintStream out) -> printIndent(PrintStream out, int
indentDepth).  I'm not really clear as to why this method is protected
rather than private (can anyone clarify?).  Does it need to be protected?
>
> Looking forward to input from others.
> -AMT
>


----------------------------------------------------------------------------
----


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