The FindBugs Blog

Monday, October 15, 2007

Thread unsafe lazy initialization

I spent some time improving the detector for thread unsafe lazy initialization.

The following code is from JDK1.6.0, sun.security.provider.certpath.KeyChecker:


private static Set supportedExts;
public Set getSupportedExtensions() {
if (supportedExts == null) {
supportedExts = new HashSet();
supportedExts.add(PKIXExtensions.KeyUsage_Id.toString());
supportedExts.add(PKIXExtensions.ExtendedKeyUsage_Id.toString());
supportedExts.add(PKIXExtensions.SubjectAlternativeName_Id.toString());
supportedExts = Collections.unmodifiableSet(supportedExts);
}
return supportedExts;
}


So if two threads called getSupportedExtensions on two different KeyCheckers, not only could one thread see an incompletely initialized set, but one of the threads could also be handled a mutable reference to the set of supported extensions, which it could then use to add or remove supported extensions.

Oops...

Bill

47 Comments:

At 1:16 PM, Blogger barb michelen said...

Hello I just entered before I have to leave to the airport, it's been very nice to meet you, if you want here is the site I told you about where I type some stuff and make good money (I work from home): here it is

 
At 3:29 PM, Blogger bernard n. shull said...

hi mate, this is the canadin pharmacy you asked me about: the link

 
At 12:04 AM, Blogger pbsl said...

you have a nice site.thanks for sharing this site. various kinds of ebooks are available here

http://feboook.blogspot.com

 
At 2:14 AM, Blogger 真新 said...

視訊聊天室視訊聊天室視訊聊天室視訊聊天室視訊聊天室視訊聊天室視訊聊天室視訊聊天室視訊聊天視訊聊天室視訊聊天室玩美女人自拍貼圖影音視訊交友後官電影主入口a片下載後宮電影微風辣妹aa片免費看080情人同志交友網

 
At 3:18 AM, Blogger 雪糕 said...

cool blog,期待更新........................................

 
At 11:45 PM, Blogger 電腦 said...

Conversation makes one what he is.........................................

 
At 4:31 AM, Blogger bf12bf23 said...

Very good share ~ message support
...................................

 
At 5:48 AM, Blogger  said...

Lets cross the bridge when we come to it........................................

 
At 7:30 AM, Blogger 筱婷筱婷 said...

生活總是起起伏伏,心情要保持快樂才好哦!!..................................................

 
At 1:51 PM, Blogger 佩昭彥怡 said...

上來打聲招呼,祝你一切平安! ........................................

 
At 2:24 AM, Blogger 于毓于毓 said...

nice job! waiting for your new artical. ........................................

 
At 11:14 PM, Blogger 怡萱 said...

我們唯一需要恐懼的事,是恐懼本身........................................

 
At 8:29 AM, Blogger 彥鈺 said...

Thx ur share........................................

 
At 6:32 AM, Blogger 原秋 said...

人必須心懷希望,才會活的快樂,日子才過得充實,有意義,有朝氣,有信心。........................................

 
At 11:12 PM, Blogger SigridNolen1祐音 said...

想要推動天下,先要發動自己。 ....................................................

 
At 12:55 AM, Blogger AshleyRe凱倫 said...

弱者等待時機,強者製造時機..................................................

 
At 12:34 AM, Blogger 志文 said...

sex貼片,姦淫小說 高雄視訊34C援交妹AIO 成人視訊jeyn 美女交友豆豆情色視訊 情色文學成人小說,情趣 av博物館 網愛交友qk176 一葉晴語音聊天網av127 hi5 tv 免費影片 173視訊聊天 777成人 硬弟弟論壇 影音交友616 聊天室13060免費 104廖家儀自拍外流 24h免費成人頻道 0204movie免費影片 s18x色網 辣妹影片直播av無碼 aio交友愛情館視訊交友90739 台北聊天交友 援助交際聊天室 嗆辣妹影音視訊聊天室 做愛影片 洪爺影城 辣妹自拍哈尼視訊 台南援交友留言 情惑用品性易購 哈尼視訊,鹹濕視訊 0401遊戲線上 sex女優王國自拍 qq 視訊交友 美女交友影音視訊聊天室 辣妹視訊網 無碼卡通,無碼a片 104自拍 部落格 遊戲區 免費視訊-美女館 34c辣妹影片直播 豆豆情色風暴視訊 給我棒棒 sexy girl,mm視訊kk視訊 85cc辣妹視訊 台灣妹色網 dudu嘟嘟成人網 成人圖片 77p2p影片區 無碼 av影片 視訊聊天 影片 寫真 080台灣名模討論區 視訊網愛聊天室 正妹牆qk176

 
At 1:37 AM, Blogger 怡潔向霖 said...

Better be the head of a dog than the tail of a lion...................................................

 
At 12:49 PM, Blogger AshleyRemley12俊財 said...

沒有目標而生活,恰如沒有羅盤而航行 ............................................................

 
At 3:49 AM, Blogger hernande said...

黃金千金,不如季布一諾。 ............................................................

 
At 6:27 PM, Blogger 育淑 said...

人有兩眼一舌,是為了觀察倍於說話的緣故。..................................................................

 
At 10:14 AM, Blogger 馨裕 said...

Pay somebody back in his own coin.................................................................

 
At 7:07 PM, Blogger 貞合 said...

知識可以傳授,智慧卻不行。每個人必須成為他自己。......................................................................

 
At 8:53 AM, Blogger 韋志韋志 said...

與人相處不妨多用眼睛說話,多用嘴巴思考.................................................................

 
At 8:25 PM, Blogger 怡潔怡潔 said...

人不能像動物一樣活著,而應該追求知識和美德............................................................

 
At 3:47 AM, Blogger 張怡 said...

Hello~Nice meet you~~............................................................

 
At 3:48 AM, Blogger 吳婷婷 said...

欣賞你的內容是美德~~支持你是最大回應..................................................................

 
At 6:24 AM, Blogger 吳婷婷 said...

在你一無所有的時候 是誰在陪伴你 他便是你最重要的人............................................................

 
At 8:59 AM, Blogger 許紀廷 said...

人生的「三部曲」應該是無愧的昨天,充實的今天,與充滿希望的明天。..................................................

 
At 9:58 PM, Blogger 吳婷婷 said...

馬丁路德:「即使知道明天世界即將毀滅,我仍願在今天種下一棵小樹。」............................................................

 
At 11:14 AM, Blogger 姿柯瑩柯dgdd憶曾g智曾 said...

來替你打氣,加油A_A............................................................

 
At 10:53 PM, Blogger 吳婷婷 said...

快樂,是享受工作過程的結果............................................................

 
At 10:53 PM, Blogger 香昱信張君林 said...

「仁慈」二個字,就能讓冬天三個月都溫暖。..................................................

 
At 10:54 PM, Blogger KyungBivo中如 said...

與人相處不妨多用眼睛說話,多用嘴巴思考. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

 
At 2:56 PM, Blogger 姿柯瑩柯dgdd憶曾g智曾 said...

愛情是一種發明,需要不斷改良。只是,這種發明和其他發明不一樣,它沒有專利權,隨時會被人搶走。.................................................................

 
At 6:11 AM, Blogger 曹季恩曹季恩 said...

It is easier to get than to keep it.......................................................................

 
At 7:59 AM, Blogger 玟君張 said...

Thank you very much for such useful informaion ● 3●............................................................

 
At 9:38 AM, Blogger 謝翁穎翰毓珍 said...

Joy often comes after sorrow, like morning after night.. . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

 
At 12:31 PM, Blogger 文王廷 said...

the best as always thanks............................................................

 
At 3:21 AM, Blogger 孫邦柔 said...

一棵樹除非在春天開了花,否則難望在秋天結果。..................................................

 
At 6:06 AM, Blogger 信陳定 said...

河水永遠是相同的,可是每一剎那又都是新的。............................................................

 
At 2:50 PM, Blogger 峻胡邦慧v帆 said...

u are so kind to post so good artical! i like it!..................................................................

 
At 7:17 PM, Blogger 佳張張張張燕張張張張張 said...

說「吃虧就是便宜的人」,多半不是吃虧的人。......................................................................

 
At 12:20 AM, Blogger 佳張張張張燕張張張張張 said...

培養健全孩子最好的方法是父母先成為健全的人。......................................................................

 
At 12:39 PM, Blogger 孟湖聿軒 said...

來看你囉~加油~~!!.................................[/url]...............

 
At 5:04 PM, Blogger 黃英吳思潔吳思潔邦 said...

人生中最好的禮物就是屬於自己的一部份............................................................

 
At 4:18 PM, Blogger Spineless said...

cool blog :)

 

Post a Comment

<< Home