天道酬勤  
          日歷
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345
          統計
          • 隨筆 - 3
          • 文章 - 0
          • 評論 - 0
          • 引用 - 0

          導航

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

           

          2011年4月27日

          當沒有使用JIT或Hotspot虛擬機時,盡量使用0值作為終結條件的比較元素,以提高循環語句的性能。


          零值比較
          posted @ 2011-04-27 06:58 卜海清 閱讀(117) | 評論 (0)編輯 收藏

          2011年4月25日

          今天看了一博文介紹Java線程安全方面的,好像和之前看過的一本書Java Concurrency in Practice中的內容差不多。努力學習消化之。

          注意:

          那么大家肯定會想,在方法中加同步關鍵字和在方法里面分解出耗時且不影響類狀態的改變的同步代碼塊,這兩個解決方案如何選擇呢?

          那么必須要編程者清晰的知道類中的變量和競爭條件。所以編程者要切記在方法中添加關鍵字,雖然簡單但是會影響并發性能,特別是在方法里面含有耗時的操作,如:I/O,網絡連接、等等。



          posted @ 2011-04-25 07:31 卜海清 閱讀(138) | 評論 (0)編輯 收藏

          2011年4月23日

           Use the Apache Ant tool to create these files. Apache Ant is a Java-based build tool that enables you to generate XML-based configurations files as follows:

           <?xml version="1.0" encoding="ISO-8859-1"?>

           
          <project default="build">

            
          <dirname property="basedir" file="${ant.file}"/>

            
          <property name="beanname" value="SimpleBean"/>
            
          <property name="jarfile" value="${basedir}/${beanname}.jar"/>

            
          <target name="build" depends="compile">
                
          <jar destfile="${jarfile}" basedir="${basedir}" includes="*.class">
                    
          <manifest>
                        
          <section name="${beanname}.class">
                           
          <attribute name="Java-Bean" value="true"/>
                        
          </section>
                    
          </manifest>
                
          </jar>
            
          </target>

            
          <target name="compile">
                
          <javac destdir="${basedir}">
                    
          <src location="${basedir}"/>
                
          </javac>
            
          </target>

            
          <target name="clean">
                
          <delete file="${jarfile}">
                    
          <fileset dir="${basedir}" includes="*.class"/>
                
          </delete>
            
          </target>

          </project> 
          posted @ 2011-04-23 21:46 卜海清 閱讀(235) | 評論 (0)編輯 收藏
           
          Copyright © 卜海清 Powered by: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 苏尼特左旗| 灵武市| 朝阳县| 彭泽县| 岳阳县| 凤阳县| 沁源县| 临海市| 娱乐| 东阿县| 昭苏县| 池州市| 恩平市| 双桥区| 尼木县| 曲麻莱县| 平定县| 辛集市| 娱乐| 和田县| 旬阳县| 成都市| 新干县| 翁牛特旗| 涿州市| 海南省| 张北县| 纳雍县| 淮北市| 大姚县| 吉安县| 高陵县| 苏尼特右旗| 青神县| 恭城| 固安县| 恩施市| 德钦县| 府谷县| 伊吾县| 白银市|