天道酬勤  
          日歷
          <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: 博客園 模板提供:滬江博客
          主站蜘蛛池模板: 龙山县| 剑河县| 页游| 方山县| 康保县| 封开县| 介休市| 崇文区| 衡东县| 淅川县| 德令哈市| 偏关县| 扬州市| 福建省| 青浦区| SHOW| 兴义市| 普格县| 铅山县| 淮安市| 乌什县| 溆浦县| 广饶县| 张掖市| 郧西县| 延庆县| 灵山县| 大兴区| 全南县| 酒泉市| 丰台区| 富阳市| 孟津县| 华阴市| 绥滨县| 苍南县| 惠安县| 翁源县| 马龙县| 宾阳县| 百色市|