Re: SimpleDateFormat vs [Deprecated] NSTimestampFormatter
Re: SimpleDateFormat vs [Deprecated] NSTimestampFormatter
- Subject: Re: SimpleDateFormat vs [Deprecated] NSTimestampFormatter
- From: Chuck Hill <email@hidden>
- Date: Wed, 9 Jul 2008 09:43:39 -0700
On Jul 9, 2008, at 7:56 AM, Ken Anderson wrote:
umm... pretty much all of it.
If you're allocating all the objects you deal with inside your
components, you probably aren't faced with many issues, but any time
you start considering anything that is shared, you have to consider
the fact that java is natively multi-threaded, and there are always
other threads running, even if you're not concurrently handling
requests.
True that.
For instance, if you always instantiate a formatter inside your
component and that thread is the only one that know about it, you
should be fine. However, if you're sharing an instance (usually for
performance reasons), you need to be aware of the fact that it could
be called from multiple places at the same time.
Looking at them both, as long as you are not changing the format
pattern, time zone, etc. and _only_ using them for formatting, they
should be re-entrant. I would not swear to it thought. I have never
had a problem using NSTimestampFormatter like this (cached at app
level, shared across all threads).
Chuck
On Jul 9, 2008, at 10:18 AM, Gennady Kushnir wrote:
Hmm...
I'm not quite shure in what parts of WO programming it is vital to be
thread safe?
2008/7/9 Ken Anderson <email@hidden>:
I'm sure Pierre could answer this better than anyone else, but I
always lock
NSTimestampFormatter when used in multi-threaded situations...
On Jul 8, 2008, at 7:03 PM, Chuck Hill wrote:
Also note that unlike NSTimestampFormatter, SimpleDateFormat is
not thread
safe. At least NSTimestampFormatter is not documented to be non-
thread
safe.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden