Groups
Sign in
Groups
Twitter4J J
Conversations
About
Send feedback
Help
スレッドセーフについて
11 views
Skip to first unread message
山中大輔
unread,
Jun 18, 2022, 1:51:10 AM
6/18/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Twitter4J J
マルチスレッド環境(Webアプリ)でtwitter4jを使用した際、ListやMapオブジェクトで想定外の例外(マルチスレッドによる同時処理による例外)が発生しました。
原因を調査すると、twitter4jのソースコードの中に、スレードセーフではない箇所がいくつか見受けられます。
(1) staticなArrayListオブジェクト
「static final List」でGrep検索すると、数か所見つかります。
(2) staticなHashMapオブジェクト
「static final Map」でGrep検索すると、数か所見つかります。
(1)については、Collections#synchronizedListを使用したり、(2)についてはConcurrentHashMapに置き換えるなどして、スレッドセーフにしていただけると助かります。
ご検討よろしくお願い致します。
Reply all
Reply to author
Forward
0 new messages