Hi Craig,

Continue with the thread safe issue:

how about Log class? I understand that log4j itself is
thread safe (unlike DateFormat) - but I see a lot
examples that log4j logs are used as instance varibale

public final class MyAction
{
    private Log log = 
LogFactory.getLog(this.getClass().getName());
    public ActionForward execute(.....)
    {.....}
}

Is this thread safe?

If yes, then even we use instance variable, as long as
we access it thread-safe way (ie. sync it), it will be
ok, right? (performance is another issue)

Thanks a lot!

Warren

--- "Craig R. McClanahan" <[EMAIL PROTECTED]> wrote:
> Quoting Nifty Music <[EMAIL PROTECTED]>:
> 
> > Thanks Craig!  You certainly confirmed my
> suspicions, although I would have
> > guessed that I could've gotten away with sharing
> the SimpleDateFormat
> > variable since it wouldn't depend on any values
> coming in from request
> > objects.  Could you perhaps shed some light on why
> it wouldn't make sense to
> > share it?
> > 
> 
> Because the internal implementation of
> SimpleDateFormat uses instance variables
> during parsing and formatting, so it's not thread
> safe :-).
> 
> Craig
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to