Be happy with Java

          這就不行了?

          for ?( int ?i? = ? 1 ;?i? <= ? 10 ;?i ++ )? {
          // ????????????????int?i?=?7;
          ????????????MNPClientThread?mnpct? = ? new ?MNPClientThread(i);

          ????????????mnpct.start();
          ????????????System.out.println(i);
          ????????}

          public ?MNPClientThread( int ?i)? {
          ????????
          this .count? = ?i;
          ????}


          ????
          public ? void ?run()? {
          ????????
          try ? {
          ????????????
          for ( int ?i = 1 ;i <= 800000 ;i ++ ) {
          ????????????????StringBuffer?phoneNumber?
          = ? new ?StringBuffer( " 88600 " );
          ????????????????phoneNumber.append(count);
          ????????????????phoneNumber.append(
          " 0000 " );
          ????????????????phoneNumber.append(i);
          ????????????????Thread.sleep(
          800 );
          // ????????????????System.out.println("****************"+phoneNumber.toString());
          ????????????????MNPClientTest?client? = ? new ?MNPClientTest();
          ????????????????client.runTest(phoneNumber.toString());
          // ????????????java.util.Date?d2?=?new?java.util.Date();
          ????????????????System.out.println( " Thread? " ? + ?count? + ? " ?Runs " );
          // ????????????????System.out.println(new?java.util.Date());
          // ????????????????System.out.println(i);
          ????????????}

          ????????}
          ? catch ?(Exception?ex)? {
          ????????????ex.printStackTrace();
          ????????}

          ????}

          運行3小時左右,發了不到10Wquery就掛了???
          報這個:
          Exception in thread "Thread-1" java.lang.OutOfMemoryError: Java heap space

          我加了-Xms128m -Xmx800m 還是不行?是內存泄露嗎??

          posted on 2007-02-02 15:54 SYBIL@BLOGJAVA 閱讀(589) 評論(2)  編輯  收藏

          評論

          # re: 這就不行了? 2007-02-03 18:52 BeanSoft

          用線程池吧...這樣有點懸. 找個 Profiler 工具看看哪些東西的內存占用最多. 參考: http://www.aygfsteel.com/beansoft/archive/2006/11/27/83767.html 用 JProfiler4 調優 Weblogic 和 Tomcat 的視頻(原創)  回復  更多評論   

          # re: 這就不行了? 2007-02-17 02:07 喜來了

          向請教一下這是要做什么?  回復  更多評論   


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


          網站導航:
           
          主站蜘蛛池模板: 兴宁市| 日喀则市| 林口县| 嘉善县| 泰兴市| 册亨县| 双桥区| 卫辉市| 邵东县| 正阳县| 甘南县| 安徽省| 白沙| 确山县| 中牟县| 如皋市| 怀宁县| 革吉县| 上饶市| 德令哈市| 旬邑县| 东至县| 蓝田县| 牙克石市| 永州市| 怀集县| 墨脱县| 大埔区| 衢州市| 宝丰县| 三台县| 堆龙德庆县| 祁连县| 西和县| 辽源市| 棋牌| 曲水县| 天全县| 禹城市| 福安市| 淮安市|