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 三人行,必有我師焉 閱讀(1637) 評論(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倉庫 |  文件格式轉換 
          主站蜘蛛池模板: 江阴市| 进贤县| 海城市| 温泉县| 台东县| 辽中县| 夏河县| 东方市| 舟曲县| 公安县| 遵义县| 寿阳县| 临沂市| 资阳市| 原平市| 乌兰浩特市| 乌鲁木齐市| 北碚区| 温宿县| 科技| 皮山县| 云南省| 通许县| 哈巴河县| 班戈县| 天峨县| 嘉荫县| 贵阳市| 新宁县| 徐水县| 盐池县| 石台县| 隆尧县| 和硕县| 青浦区| 雅江县| 通州区| 德庆县| 龙陵县| 湟中县| 玉屏|