Feeling

              三人行,必有我師焉

             ::  :: 新隨筆 :: 聯系 ::  :: 管理 ::
            185 隨筆 :: 0 文章 :: 392 評論 :: 0 Trackbacks
          JDK1.6的File.createTempFile方法有bug,在我的機器上第一次調用該方法需要耗時5秒時間,換了好幾個1.6的版本均有該問題。JDK1.4,1.5則無此問題。

          不一定所有的機器都有此問題,不過這兒肯定是有問題的,起碼在我的機器上有問題。
          posted on 2012-01-13 15:51 三人行,必有我師焉 閱讀(1639) 評論(2)  編輯  收藏

          評論

          # re: JDK1.6的File.createTempFile方法有bug 2012-01-13 15:57 小明
          stackoverflow有類似的問題:
          http://stackoverflow.com/questions/2608763/why-does-first-call-to-java-io-file-createtempfilestring-string-file-take-5-se

          有人提到是因為用戶屬于guest group的原因:
          As noted as a comment on one of the answers below, I noticed this time is actually spent in the first invocation of SecureRandom.nextLong(). Also, I found that this behavior only occurs when a user has the "Guest" group associated with them. I can execute this test with a user and have it run in less than 100ms and then re-execute the same test with the same user account after just adding that user to the "Guests" group (without removing any other group associations from the user had in the previous run).

          你可以驗證一下  回復  更多評論
            

          # re: JDK1.6的File.createTempFile方法有bug 2012-01-13 17:13 三人行,必有我師焉
          @小明
          Thanks.   回復  更多評論
            


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          GitHub |  開源中國社區 |  maven倉庫 |  文件格式轉換 
          主站蜘蛛池模板: 体育| 如东县| 新民市| 乐业县| 荣成市| 固镇县| 镇雄县| 沅江市| 吉木萨尔县| 龙游县| 榆社县| 乳山市| 楚雄市| 左权县| 嘉鱼县| 湘潭市| 冷水江市| 枣阳市| 博白县| 郯城县| 郓城县| 永福县| 崇左市| 青浦区| 兴隆县| 维西| 南阳市| 尚义县| 高要市| 梨树县| 隆化县| 吴旗县| 宝山区| 东方市| 翁牛特旗| 临邑县| 玉树县| 乳源| 霞浦县| 遂溪县| 乐业县|