Download
Magazine
Develop
Account
Download
Magazine
Develop
Login
Forgot Account/Password
Create Account
Language
Help
Language
Help
×
Login
Login Name
Password
×
Forgot Account/Password
Category:
Software
People
PersonalForge
Magazine
Wiki
Search
OSDN
>
Find Software
>
System
>
TERASOLUNA Framework
>
Forums
>
Open Discussion
>
DatePropertyEditorRegistrarはスレッドセーフですか?
TERASOLUNA Framework
Description
Project Summary
Developer Dashboard
Web Page
Developers
Image Gallery
List of RSS Feeds
Activity
Statistics
History
Downloads
List of Releases
Stats
Source Code
Code Repository list
Subversion
View Repository
Ticket
Ticket List
Milestone List
Type List
Component List
List of frequently used tickets/RSS
Submit New Ticket
Documents
Wiki
FrontPage
Title index
Recent changes
Doc Mgr
List Docs
Communication
Forums
List of Forums
Open Discussion (1277)
Mailing Lists
list of ML
terasoluna-information
News
Forums:
Open Discussion
(Thread #18986)
Return to Thread list
RSS
DatePropertyEditorRegistrarはスレッドセーフですか? (2008-06-12 02:39 by
kidotaka
#37116)
Reply
Create ticket
jp.terasoluna.fw.beans.DatePropertyEditorRegistrarは、デフォルト値の保持を意図してstaticにSimpleDateFormatを持っています。
新たにsetterからDateFormatが渡されない限り、static変数の参照がインスタンス変数にセットされていて、それを用いるはずです。
これはマルチスレッド上で、同じSimpleDateFormatのインスタンスを見ることがあるということではないのでしょうか?
SimpleDateFormatは確実にスレッドセーフではないクラス(JavaDocで同期化してねと書いてある。)ですが、この実装って本当に大丈夫なのですか?
デフォルトを用いる場合に危険なコードに見えました。
Reply to #37116
×
Subject
Body
Reply To Message #37116 > jp.terasoluna.fw.beans.DatePropertyEditorRegistrarは、デフォルト値の保持を意図してstaticにSimpleDateFormatを持っています。 > 新たにsetterからDateFormatが渡されない限り、static変数の参照がインスタンス変数にセットされていて、それを用いるはずです。 > > これはマルチスレッド上で、同じSimpleDateFormatのインスタンスを見ることがあるということではないのでしょうか? > > SimpleDateFormatは確実にスレッドセーフではないクラス(JavaDocで同期化してねと書いてある。)ですが、この実装って本当に大丈夫なのですか? > デフォルトを用いる場合に危険なコードに見えました。
You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.)
Login
Nickname
Preview
Post
Cancel
RE: DatePropertyEditorRegistrarはスレッドセーフですか? (2008-06-27 16:52 by
matsumotoa
#37362)
Reply
Create ticket
ご指摘の通り、現在のコードでは、
「マルチスレッド上で、同じSimpleDateFormatのインスタンスを見ること」、そして、誤った日付が設定されてしまう事態が発生します。
現状では、
・DatePropertyEditorRegistrar内部で使用しているCustomDateEditorのgetAsTextとsetAsTextを同期化するように拡張して使う
・apache commonsのFastDateFormatをjava.text.DateFromatでラップして使う
などの対応が考えられます。
これは、Spring本家でも問題になっていますね。
TERASOLUNAとしては本家が落ち着くまで静観したほうがよいかもしれません。
http://jira.springframework.org/browse/SPR-4361
Reply to
#37116
Reply to #37362
×
Subject
Body
Reply To Message #37362 > ご指摘の通り、現在のコードでは、 > 「マルチスレッド上で、同じSimpleDateFormatのインスタンスを見ること」、そして、誤った日付が設定されてしまう事態が発生します。 > > 現状では、 > ・DatePropertyEditorRegistrar内部で使用しているCustomDateEditorのgetAsTextとsetAsTextを同期化するように拡張して使う > ・apache commonsのFastDateFormatをjava.text.DateFromatでラップして使う > などの対応が考えられます。 > > これは、Spring本家でも問題になっていますね。 > TERASOLUNAとしては本家が落ち着くまで静観したほうがよいかもしれません。 > http://jira.springframework.org/browse/SPR-4361
You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.)
Login
Nickname
Preview
Post
Cancel