煩惱歲月

          付出總是有回報的 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 不需要解釋 閱讀(353) 評論(0)  編輯  收藏 所屬分類: java

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

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

          這個問題在jdk1.6已經不存在

          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.

          我實話告訴你們,我可是身經百戰了.bbs我見的多了,哪個版我沒灌過?你們要知道, 一塌糊 涂的triangle,PIC,SEX版,那比你們不知道厲害到哪里去了,我在那談笑風聲.你 們有一好就是無論在哪個版,什么話題都灌,但是灌來灌去的問題,都too simple, sometimes naive!你 們懂不懂呀?啊?所以說灌水啊,關鍵是要提高自己的知識水平.你 們啊,不要總想著弄個大坑,然后灌上十大,再把我羞辱一番……你們啊,naive!你們這 樣灌是不行地!~那你問我支持 不支持灌水,我說支持,我常來這裡灌,你說支持不支持?
          主站蜘蛛池模板: 诸暨市| 彭泽县| 孝义市| 东丰县| 社会| 五指山市| 库车县| 庄浪县| 沈阳市| 广东省| 永德县| 曲周县| 板桥市| 鹿泉市| 天峻县| 扎囊县| 盐源县| 夏邑县| 兰考县| 通河县| 北安市| 三河市| 潼关县| 新津县| 台州市| 车致| 稻城县| 黑河市| 文山县| 通辽市| 揭阳市| 喀喇| 沂南县| 吉首市| 德格县| 尚志市| 德安县| 广饶县| 肥城市| 古丈县| 渑池县|