afunms

          My Software,My Dream—Forge a more perfect NMS product.

          #

          Tomcat連接池的當(dāng)前連接數(shù)

                  關(guān)于如何配置Tomcat數(shù)據(jù)庫連接池,網(wǎng)上已有太多文章了。可是找不到一篇文章能
          告訴我,怎么能得到Tomcat連接池的當(dāng)前連接數(shù)。如果想要監(jiān)視Tomcat的運(yùn)行狀況,這
          是一個(gè)重要參數(shù)。所以我花了半天的時(shí)間,專門來研究這個(gè)問題。
             
                 先是看了Tomcat的相關(guān)源碼,得到它用了jakarta commons-dbcp這個(gè)包,又下載了
          commons-dbcp這個(gè)包的源嗎。終于在BasicDataSource找到getNumActive方法,這就是我想
          要的。

              Context initCtx = new InitialContext();
              BasicDataSource bds = (BasicDataSource)initCtx.lookup("java:comp/env/jdbc/afunms");
              initCtx.close();    
              bds.getConnection();
              System.out.println("當(dāng)前連接數(shù)=" + bds.getNumActive());

              隨時(shí)getConnection()的增加,這個(gè)numActive也會(huì)增多(如果不關(guān)閉connection的話)。
          當(dāng)numActive>maxActive(這個(gè)maxActive在xml文件中)時(shí),程序就再不能連上DB了。這就
          是我以前的程序?yàn)槭裁磿?huì)出錯(cuò)的原因,哈哈。 

              注:在連接池配置文件.xml中要寫明
              <parameter>
                <name>factory</name>
                <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
              </parameter>

          posted @ 2007-09-21 21:37 afunms 閱讀(4092) | 評論 (0)編輯 收藏

          pl_table

           

          從《Port分配》里導(dǎo)出三個(gè)表:PL_UNITPL_ATMPL_ATM_PORT

          ATM交換機(jī)在每個(gè)單位都有一臺(tái),其實(shí)可以把PL_UNITPL_ATM兩表合一,但后來考慮到以后還有其他的設(shè)備比如路由和視頻都要加入,它們也得和單位相關(guān)聯(lián),所以把單位信息單獨(dú)拿出,放到一張表里。

              PL_UNIT

          字段

          屬性

          說明

          備注

          ID

          NUMBER(3)

          ID

          UNIT

          VARCHAR(30)

          單位信息

              PL_ATM

          字段

          屬性

          說明

          備注

          ID

          NUMBER(3)

          ID

          UNIT_ID

          NUMBER(3)

          單位ID

          PL_UNIT.ID

          ATM

          VARCHAR(30)

          ATM機(jī)器名

          IP

          VARCHAR(15)

          IP地址

              PL_ATM_PORT

          字段

          屬性

          說明

          備注

          ID

          NUMBER(3)

          ID

          ATM_ID

          NUMBER(3)

          ATM交換機(jī)ID

          PL_ATM.ID

          SLOT

          NUMBER(3)

          板卡

          PORT

          NUMBER(3)

          端口

          DESCRIPTION

          VARCHAR(30)

          端口描述

          TOPO_HOST_NODEPL_ATM有重復(fù)的數(shù)據(jù),但沒辦法,因?yàn)榍罢叩臄?shù)據(jù)為拓?fù)渥詣?dòng)發(fā)現(xiàn)的,而后者的數(shù)據(jù)是從Excel文件中導(dǎo)入的,二者數(shù)據(jù)不可能完全一致,所以只能保留兩個(gè)表。而PL_ATM表中的IP地址是從表TOPO_HOST_NODE查詢得到的。因?yàn)樵?/span>Excel文件,沒有任何ATMIP對應(yīng)的信息,我只能從發(fā)現(xiàn)的結(jié)果中查詢得到各機(jī)器的IP地址。

          從《PVC規(guī)劃和配置》中導(dǎo)入ATM PVC數(shù)據(jù),我覺得這些數(shù)據(jù)應(yīng)該與PL_UNIT關(guān)聯(lián),但由于《PVC規(guī)劃和配置》中單位名稱與《Port分配》中的單位名稱不一致,所以關(guān)聯(lián)起來有困難,就是要人為一個(gè)個(gè)去找。暈,暫時(shí)先這樣吧,給用戶看過后再說吧。

          posted @ 2007-09-20 19:57 afunms 閱讀(140) | 評論 (0)編輯 收藏

          cheer

          (1)CVS提交或更新的時(shí)候老是出現(xiàn)一個(gè)錯(cuò)誤:
               cvs server: C:\WINDOWS\TEMP\cvsC7.tmp: No such file or directory
               cvs [server aborted]: error diffing test.txt
              
              根據(jù)網(wǎng)上資料提示,覺得可能是以下原因:
              1.CVSROOT下的Reposity下的路徑設(shè)置不真確.
              2.可能該用戶沒有設(shè)置該權(quán)限.

              一一排查,最后才發(fā)現(xiàn)是因?yàn)镃VSNT服務(wù)器上運(yùn)行的賬號是USER用戶組的,沒有對C:\WINDOWS操作權(quán)限

          ,因此我更改CVSNET臨時(shí)目錄,從c:\windows\temp到d:\cvs_temp,再運(yùn)行提交,問題解決。


          (2)第一次用正則表達(dá)式。
              以前一直認(rèn)為正則表達(dá)式是很神秘的東西,今天努力試用一下,才知道其實(shí)很簡單。
              我要從“Switch code: GDFY1P45”找出ATM的機(jī)器名“GDFY1P45”,
              因?yàn)闄C(jī)器名總是xxxx1P(或G)dd,所以我寫一個(gè)正則表達(dá)式來匹配它
              Pattern aliasPattern = Pattern.compile("[1]{1}(P|G){1}[1-9]{1,2}");
              很容易就找出機(jī)器名了,呵呵。
           
              要從GDFY1P45_s5p7-GDFY_MON_SP找出_后的s5p7-GDFY_MON_SP
              Pattern  portPattern = Pattern.compile("[_]{1}[s][0-9]{1}[p][0-9]{1}[-]{1}");
              感覺很爽。

          posted @ 2007-09-19 19:48 afunms 閱讀(144) | 評論 (0)編輯 收藏

          Serious Bug

          **  Version 1.3.2.Alpha, Release Date 2007.09.18    
              * Serious Bug:add a new node dynamically at runtime,the polling thread
                doesn't query it.The involved classes are TopoResourcePool.java and 
                PollingEngine.java.

          posted @ 2007-09-18 22:51 afunms 閱讀(115) | 評論 (0)編輯 收藏

          解決從tomcat移植到weblogic的兩個(gè)問題

          1. 用XmlHttp獲取xml,responseXml為空。
            
             解決方法:
             在web.xml中加入
             <mime-mapping>
                <extension>xml</extension>
                <mime-type>text/xml</mime-type>
             </mime-mapping>
             <mime-mapping>
                <extension>xsl</extension>
                <mime-type>text/xml</mime-type>
             </mime-mapping>

          2. 用SmartUpload下載文件時(shí)出錯(cuò)   
             出錯(cuò)信息:
             java.io.IOException: 文件名、目錄名或卷標(biāo)語法不正確。
                  at java.io.WinNTFileSystem.canonicalize0(Native Method)
                  at java.io.Win32FileSystem.canonicalize(Win32FileSystem.java:395)
                  at java.io.File.getCanonicalPath(File.java:531)
                  at weblogic.servlet.internal.WebAppServletContext.getRealPath       

                  (WebAppServletContext.java:666)
                  at com.jspsmart.upload.SmartUpload.isVirtual(SmartUpload.java:1180)
                  Truncated. see log file for complete stacktrace
                  解決方法:自己寫了一個(gè)Servlet來下載文件,代碼如下:
            

           1public class DownLoad extends HttpServlet
           2{
           3    private static final long serialVersionUID = -84138329260803824L;
           4    public void init() throws ServletException
           5    {
           6    }

           7
           8    public void doGet(HttpServletRequest request, HttpServletResponse response) 
           9        throws ServletException, IOException
          10    {
          11        OutputStream os = null
          12        FileInputStream fis = null;
          13        try
          14        {            
          15            String fileName = request.getParameter("filename");  //要下載的文件,包括路徑
          16            String downFileName = fileName.substring(fileName.lastIndexOf("\\"+ 1); //去掉路徑
          17            
          18            os = response.getOutputStream();
          19            File f = new File(fileName);
          20            
          21            response.setHeader("Content-type:""application/octet-stream");
          22            response.setHeader("Accept-Ranges:""bytes");
          23            response.setHeader("Accept-Length:", Long.toString(f.length()));
          24            response.setHeader("Content-Disposition""attachment; filename=" + downFileName);
          25                
          26            fis = new FileInputStream(f);
          27            byte[] b = new byte[1024];    
          28            int i = 0;    
          29            while((i = fis.read(b)) > 0
          30              os.write(b, 0 ,i);
          31        }

          32        catch (Exception e)
          33        {
          34            e.printStackTrace();
          35        }

          36        finally
          37        {
          38            fis.close();
          39            os.flush();
          40            os.close();
          41        }

          42    }

          43
          44    public void doPost(HttpServletRequest request, HttpServletResponse response) 
          45       throws ServletException, IOException
          46    {
          47         doGet(request,response);
          48    }

          49}


           

          posted @ 2007-09-17 22:00 afunms 閱讀(2984) | 評論 (3)編輯 收藏

          recreation

          這周末全公司組織出去旅游,大家都玩得很開心。

          昨天去漂流,今早騎馬,然后泡溫泉。

          posted @ 2007-09-16 22:31 afunms 閱讀(83) | 評論 (0)編輯 收藏

          My Goal

          1.  December,2007: Add distributed feature to SourceView1.0
               with JMX.
          2.  February,2008: Refactor SourceView,update to version2.0.
               The new version must have three features:
               a. MVC 
               b. NMS 
               c. Distributed.
          3.  June,2008: A new product,NetFlow.

          posted @ 2007-09-15 05:59 afunms 閱讀(116) | 評論 (0)編輯 收藏

          weblogic + oracle

            1. Replaced Ping by SnmpPing.(ResponseTime.collectData())
            2. Started to remove GDPLN project from Tomcat to Weblogic.
            3. Massive data will be created in future,so we choose Oracle instead of MySQL.
               Combine Weblogic with Oracle,we can build a more powerful system.

          posted @ 2007-09-14 22:24 afunms 閱讀(84) | 評論 (0)編輯 收藏

          summary

                  昨日給用戶演示了我們的軟件,他們對我們的軟件表示認(rèn)可。至少是相信,
          我們能很好地完成這個(gè)項(xiàng)目。

                  工作近四年,回顧一下,自己的代碼在哪些單位的服務(wù)器上跑著:

                  1. 山東濟(jì)南將軍集團(tuán) (2004.06)
                  2. 遼寧遼寧電力         (2004.10)
                  3. 遼寧沈陽供電局     (2005.02)
                  4. 河北秦皇島港務(wù)局(2005.06)
                  5. 山東齊魯石化        (2006.11)
                  6. 河北衡水信用社    (2007.04)
                  7. 安徽恒源煤電        (2007.06)
                  8. 廣東PLN                (2007.09)

          posted @ 2007-09-13 20:51 afunms 閱讀(79) | 評論 (0)編輯 收藏

          階段性勝利

          昨天完成有關(guān)PVC的所有程序,今天上午調(diào)試通過,包括與ITSM的接口程序。
          今天讓XUE先看一下,他表示基本滿意,算是一個(gè)階段性的勝利吧。

          明天給用戶演示一下,根據(jù)他們的意見,再作進(jìn)一步的工作安排。

          至于物理鏈路,我想一定也能在mib中找到,只是,目前來說,我對atm還不夠了解。

          posted @ 2007-09-12 20:23 afunms 閱讀(100) | 評論 (0)編輯 收藏

          pvc

          1. Tested SourceView1.3.1.Alpha,that is ok.

              -------GDPLN---------
          2. Ignored ATM switches' interfaces,because they are insignificant.
              (DiscoverEngine.addHost())
          3. ATM switches' interfaces are ignored,so deleted those traffic monitors for them.
              (monitors.xml)
          4. Modified ip resource module,two factors contribute to this,
              added a new feature about PVC and deleted the feature about VLAN.
          5. Added a new class LucentTypeHelper to convert type digit to the description   
              accordingly.
          6. Fetchs PVC information through another SNMP table intfAtmPvcConnDisplayTable,
              instead of ipAtmAppPvcVccStatsTable,simplified the relative program consequently.
          7. Created a new db table NMS_ATM_PVC,which stores PVC data.
          8. Added two device categories,5=Lucent ATM switch,6=Keda video. 

          posted @ 2007-09-11 21:04 afunms 閱讀(111) | 評論 (0)編輯 收藏

          1.3.1

          --------SourceView-----------
          **  Version 1.3.1.Alpha, Release Date 2007.09.11   
              * Modifiy: Sometimes the bridgeAddress of switch(or router) can not be got,
                 thereby fetching again before this node is added to the nodes list.  
                  (DiscoverEngine.addHost())
              * Modifiy: SnmpWalk operation.(SnmpService.snmpWalk())
              * Modifiy: Vlan-interface mapping,affected by modification of SnmpWalk 
                 operation(ExtendSnmpUtil.getVlanIfMap()).
              * Add: Printing out the debug information when it is needed.
                (SysProperty.isLogDebug())


          --------GDPLN------------
          1.完成有關(guān)“板卡、接口和通道”的程序。
          2.找到完整的PVC信息,包括PVC兩端的設(shè)備、接口和通道。

          posted @ 2007-09-10 20:35 afunms 閱讀(114) | 評論 (0)編輯 收藏

          LucentATM

          今天寫一些Lucent ATM相關(guān)程序,明天拿到GDPLN去測試一下。

          現(xiàn)在我對這個(gè)項(xiàng)目越來越有信心了。

          posted @ 2007-09-09 22:16 afunms 閱讀(94) | 評論 (0)編輯 收藏

          jmx

          看了一天jmx的相關(guān)文檔,還是云里霧里。暈啊

          不過,我已經(jīng)決心要多研究開源代碼,然后,做一個(gè)更好的架構(gòu),以實(shí)現(xiàn)分布式網(wǎng)管。

          posted @ 2007-09-08 23:27 afunms 閱讀(127) | 評論 (0)編輯 收藏

          1.3.0.Alpha

          **  Version 1.3.0.Alpha, Release Date 2007.09.07   
              * Add: SQL-Server monitor.
              * Add: Algorithm for topology display.
              * Modifiy: loads the monitor class when it is needed,rather than loads all classes at the beginning.

          posted @ 2007-09-07 15:01 afunms 閱讀(114) | 評論 (0)編輯 收藏

          僅列出標(biāo)題
          共25頁: First 上一頁 14 15 16 17 18 19 20 21 22 下一頁 Last 

          My Links

          News

          留言簿(18)

          隨筆檔案

          相冊

          搜索

          最新評論

          閱讀排行榜

          主站蜘蛛池模板: 普兰店市| 黄陵县| 宁蒗| 盐城市| 石棉县| 新建县| 文山县| 杂多县| 泗洪县| 梁平县| 石渠县| 林芝县| 桃园县| 怀柔区| 宁蒗| 南充市| 潞西市| 吴堡县| 理塘县| 株洲县| 丰镇市| 宁城县| 呈贡县| 桂林市| 武川县| 宣汉县| 平度市| 勐海县| 青田县| 拉萨市| 四子王旗| 神农架林区| 泌阳县| 乌苏市| 新巴尔虎右旗| 金湖县| 嘉善县| 岳阳市| 琼海市| 博罗县| 巴塘县|