煩惱歲月

          付出總是有回報(bào)的 take action follow your heart , or follow your head
          posts - 40, comments - 5, trackbacks - 0, articles - 4

          ResourecBundled cache的討論

          Posted on 2009-10-17 17:23 不需要解釋 閱讀(347) 評(píng)論(0)  編輯  收藏 所屬分類: java

          有個(gè)大師說過一句話,有人的地方就有江湖,有江湖的地方就有斗爭(zhēng)。今天在java eys就看到了一場(chǎng)Resourcebundle引起的口角,集體見:

          http://www.javaeye.com/topic/6417?page=1.

          這個(gè)問題在jdk1.6已經(jīng)不存在

          clearCache
          public static final void clearCache()
          Removes all resource bundles from the cache that have been loaded using the caller's class loader.
          Since:
          1.6
          See Also:
          ResourceBundle.Control.getTimeToLive(String,Locale)

          clearCache
          public static final void clearCache(ClassLoader loader)
          Removes all resource bundles from the cache that have been loaded using the given class loader.
          Parameters:
          loader - the class loader
          Throws:
          NullPointerException - if loader is null
          Since:
          1.6
          See Also:
          ResourceBundle.Control.getTimeToLive(String,Locale)

           

          在1.5,1.4怎么辦呢:

             Class klass = ResourceBundle.getBundle("your.Bundle").getClass().getSuperclass();
             Field field = klass.getDeclaredField("cacheList");
             field.setAccessible(true);
             sun.misc.SoftCache cache = (sun.misc.SoftCache)field.get(null);
             cache.clear();
             field.setAccessible(false);

          這樣就可以清楚cache.

          我實(shí)話告訴你們,我可是身經(jīng)百戰(zhàn)了.bbs我見的多了,哪個(gè)版我沒灌過?你們要知道, 一塌糊 涂的triangle,PIC,SEX版,那比你們不知道厲害到哪里去了,我在那談笑風(fēng)聲.你 們有一好就是無論在哪個(gè)版,什么話題都灌,但是灌來灌去的問題,都too simple, sometimes naive!你 們懂不懂呀?啊?所以說灌水啊,關(guān)鍵是要提高自己的知識(shí)水平.你 們啊,不要總想著弄個(gè)大坑,然后灌上十大,再把我羞辱一番……你們啊,naive!你們這 樣灌是不行地!~那你問我支持 不支持灌水,我說支持,我常來這裡灌,你說支持不支持?
          主站蜘蛛池模板: 阳高县| 遵义市| 错那县| 衡南县| 景宁| 南投县| 文安县| 房产| 芷江| 青川县| 邵武市| 繁峙县| 南充市| 金湖县| 轮台县| 桦南县| 万源市| 文成县| 宽城| 德庆县| 镇原县| 平谷区| 桃源县| 隆德县| 平陆县| 缙云县| 宜都市| 横山县| 行唐县| 肃宁县| 丹东市| 穆棱市| 富阳市| 霸州市| 陵水| 隆安县| 云和县| 叶城县| 双牌县| 城步| 忻城县|