﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-&lt;font color='red'&gt;&lt;strong&gt;重新探索自我&lt;/strong&gt;&lt;/font&gt;-随笔分类-J2EE开发</title><link>http://www.blogjava.net/danxy2008/category/17617.html</link><description>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;客观条件受制于人，并不足惧。重要的是，我们拥有选择的自由，可以对现实环境积极回应，&lt;br/&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;为生命负责，为自己创造有利的机会，做一个“真正”操之在我的人！&lt;br/&gt;</description><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 08:51:27 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 08:51:27 GMT</pubDate><ttl>60</ttl><item><title>《Practical Java》学习笔记（一）</title><link>http://www.blogjava.net/danxy2008/archive/2006/11/23/83095.html</link><dc:creator>蒋利文</dc:creator><author>蒋利文</author><pubDate>Thu, 23 Nov 2006 10:50:00 GMT</pubDate><guid>http://www.blogjava.net/danxy2008/archive/2006/11/23/83095.html</guid><wfw:comment>http://www.blogjava.net/danxy2008/comments/83095.html</wfw:comment><comments>http://www.blogjava.net/danxy2008/archive/2006/11/23/83095.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/danxy2008/comments/commentRss/83095.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/danxy2008/services/trackbacks/83095.html</trackback:ping><description><![CDATA[<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						</span>
				</font> </p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l1 level1 lfo1; tab-stops: list 21.0pt">
				<font size="2">
						<strong>
								<span lang="EN-US" style="mso-bidi-font-family: 宋体">
										<span style="mso-list: Ignore">一、</span>
								</span>
								<span lang="EN-US">General Techniques</span>
						</strong>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo2; tab-stops: list 39.0pt">
				<font size="2">
						<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
								<span style="mso-list: Ignore">1、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引数以</span>
						<span lang="EN-US">by value </span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方式而非</span>
						<span lang="EN-US"> by reference </span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方式传递</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo2; tab-stops: list 39.0pt">
				<font size="2">
						<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
								<span style="mso-list: Ignore">2、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对于不变的</span>
						<span lang="EN-US">data</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</span>
						<span lang="EN-US">object reference</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用</span>
						<span lang="EN-US">final ,final</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">仅仅令</span>
						<span lang="EN-US">object reference</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">自身成为不变量，但并不限制它所指向对象的改变</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo2; tab-stops: list 39.0pt">
				<font size="2">
						<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
								<span style="mso-list: Ignore">3、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">缺省情况下，所有</span>
						<span lang="EN-US">non-static</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">都可以被覆写，不然</span>
						<span lang="EN-US">,</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">则用</span>
						<span lang="EN-US">final</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">防止覆写</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo2; tab-stops: list 39.0pt">
				<font size="2">
						<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
								<span style="mso-list: Ignore">4、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
						</span>
						<span lang="EN-US">vector</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">容器包含的是对象，与</span>
						<span lang="EN-US">arrays</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">要区别，但我认为</span>
						<span lang="EN-US">Vector</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的功能实际上有些像跟</span>
						<span lang="EN-US">Array List</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">差不多，只是</span>
						<span lang="EN-US">vector</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">现在不经常使用</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo2; tab-stops: list 39.0pt">
				<font size="2">
						<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
								<span style="mso-list: Ignore">5、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">多态优于</span>
						<span lang="EN-US">instanceof</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，只有在不得已的情况下使用</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="2">“如果你根据对象的型别来触发行为，那就改给自己一个耳光”</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">例如，当你必须从一个</span>
						<span lang="EN-US">base type</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">做向下转型为</span>
						<span lang="EN-US">derived type</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的时候，必须使用它</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt">
				<span lang="EN-US">….</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">Vector shapeVector = new Vector(10);<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?><o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">shapeVector.add(new Triangle());<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">shapeVector.add(new Triangle());<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">shapeVector.add(new Circle());<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">    </span>//...<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">    </span>//Assume many Triangles and Circles are added and removed<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">    </span>//...<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">    </span>int size = shapeVector.size();<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">    </span>for (int i=0; i&lt;size; i++)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">    </span>{<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>Object o = shapeVector.get(i);<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>if (o instanceof Triangle)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>{<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">        </span>if (((Triangle)o).isRightTriangle())<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">        </span>{<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">          </span>//...<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">        </span>}<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>}<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>else if (o instanceof Circle)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>{<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">        </span>double rad = ((Circle)o).radius();<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">        </span>//...<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>}<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39.1pt; TEXT-INDENT: 18pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">}<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-tab-count: 1">         </span>
						<span style="COLOR: #3366ff">6</span>
				</span>
				<span style="FONT-SIZE: 9pt; COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、一旦不需要对象的引用，就将它设为</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: #3366ff">null</span>
				<span style="FONT-SIZE: 9pt; COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">；</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: #3366ff">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: #3366ff">
						<span style="mso-spacerun: yes">       </span>
				</span>
				<span style="FONT-SIZE: 9pt; COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">尽管有</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: #3366ff">GC,</span>
				<span style="FONT-SIZE: 9pt; COLOR: #3366ff; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">你还是要关注的你的代码如何运用内存；</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; COLOR: #3366ff">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-tab-count: 1">         </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; LINE-HEIGHT: 12pt; mso-list: l1 level1 lfo1; tab-stops: list 21.0pt; mso-line-height-rule: exactly">
				<strong>
						<span lang="EN-US" style="FONT-SIZE: 9pt; mso-bidi-font-family: 宋体">
								<span style="mso-list: Ignore">二、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
						</span>
						<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象与相等性</span>
				</strong>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">7</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、区分</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">reference type</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">primitive type</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，理解他们的差异，你会在运用他们时候做出明智的</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选择；</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-tab-count: 1">         </span>Boolean(boolean)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-tab-count: 1">         </span>Character(char)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">Byte(byte)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">Integer(int)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">Float(float) <o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">Long(long)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">Short(short)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">Double(double)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">基本型别相等，只要是值相等就可以拉，不管是不是同一类型；而引用类型必须则按照引用的比较方式来比较，譬如</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">equals();<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 18pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">8</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">java.lang.object</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">提供的</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">equals()</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方法很多时候不是你想要的，你需要自己写一些比较的方法</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">public boolean equals(Object obj)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">  </span>{<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">    </span>if (this == obj)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>return true;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">    </span>if (obj != null &amp;&amp; getClass() == obj.getClass())<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">    </span>{<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>Golfball gb = (Golfball)obj;<span style="mso-spacerun: yes">  </span>//Classes are equal, downcast.<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>if (brand.equals(gb.brand()) &amp;&amp;<span style="mso-spacerun: yes">  </span>//Compare attributes.<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">          </span>make.equals(gb.make()) &amp;&amp;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">          </span>compression == gb.compression())<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>{<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">        </span>return true;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">      </span>}<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">    </span>}<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">    </span>return false;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<span style="mso-spacerun: yes">  </span>}<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; LINE-HEIGHT: 12pt; mso-list: l1 level1 lfo1; tab-stops: list 21.0pt; mso-line-height-rule: exactly">
				<strong>
						<span lang="EN-US" style="FONT-SIZE: 9pt; mso-bidi-font-family: 宋体">
								<span style="mso-list: Ignore">三、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
						</span>
						<span lang="EN-US" style="FONT-SIZE: 9pt">java</span>
						<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">异常</span>
				</strong>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; LINE-HEIGHT: 12pt; mso-list: l1 level2 lfo1; tab-stops: list 39.0pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">1、<span style="FONT: 7pt 'Times New Roman'">   </span></span>
				</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">try,cacth,finally<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不要将</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">catch</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的异常覆盖掉，在这样的情况下，我们要专门把异常保存下来，如用一个</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">vector</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">保存；</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不要忽略任何一个异常，因为异常一旦出现，抛出异常的那个线程将会终止；</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将一个异常加入到</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">throw</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">子句，会影响到调用它的所有函数</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">finally</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">防止资源泄露，譬如在连接数据库的时候在</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">finally</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中关闭连接；</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不要从</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">try</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">字段中返回；</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不要用</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">try</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">catch</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用于流程控制</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不要每逢出错的使用</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">try</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">catch;<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">不要在构造函数中抛出异常；</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; LINE-HEIGHT: 12pt; mso-line-height-rule: exactly">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">抛出异常前，请将对象置为有效状态；</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; LINE-HEIGHT: 12pt; mso-list: l1 level1 lfo1; tab-stops: list 21.0pt; mso-line-height-rule: exactly">
				<strong>
						<span lang="EN-US" style="FONT-SIZE: 9pt; mso-bidi-font-family: 宋体">
								<span style="mso-list: Ignore">四、<span style="FONT: 7pt 'Times New Roman'">  </span></span>
						</span>
						<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">性能</span>
				</strong>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; LINE-HEIGHT: 12pt; mso-list: l1 level2 lfo1; tab-stops: list 39.0pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">1、<span style="FONT: 7pt 'Times New Roman'">   </span></span>
				</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">先把焦点放在设计，数据机构和算法方面</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; LINE-HEIGHT: 12pt; mso-list: l1 level2 lfo1; tab-stops: list 39.0pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">2、<span style="FONT: 7pt 'Times New Roman'">   </span></span>
				</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果进行字符串的拼接，用</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">String Buffer</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">比</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt"> String </span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">快许多倍</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; LINE-HEIGHT: 12pt; mso-list: l1 level2 lfo1; tab-stops: list 39.0pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">3、<span style="FONT: 7pt 'Times New Roman'">   </span></span>
				</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在面向对象中，对象的创建是昂贵的，因此需要将对象的创建成本降到最低，减少一些没有必要的对象，在非必要的时候，别产生你的对象</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; LINE-HEIGHT: 12pt; mso-list: l1 level2 lfo1; tab-stops: list 39.0pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">4、<span style="FONT: 7pt 'Times New Roman'">   </span></span>
				</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将同步减少到最低，增加</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">stack</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的使用</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; LINE-HEIGHT: 12pt; mso-list: l1 level2 lfo1; tab-stops: list 39.0pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">5、<span style="FONT: 7pt 'Times New Roman'">   </span></span>
				</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用基本型别代码会更快</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; LINE-HEIGHT: 12pt; mso-list: l1 level2 lfo1; tab-stops: list 39.0pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">6、<span style="FONT: 7pt 'Times New Roman'">   </span></span>
				</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在使用</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">vector</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时候，用</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">get()</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来获取对象，而不是</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">Interator<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; LINE-HEIGHT: 12pt; mso-list: l1 level2 lfo1; tab-stops: list 39.0pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">7、<span style="FONT: 7pt 'Times New Roman'">   </span></span>
				</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">优先使用</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">array,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">再考虑</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">ArrayList</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">与</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">Vector</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，如果不需要</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">vector</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的同步特性，考虑使用</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">ArrayList<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; LINE-HEIGHT: 12pt; mso-list: l1 level2 lfo1; tab-stops: list 39.0pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">8、<span style="FONT: 7pt 'Times New Roman'">   </span></span>
				</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">尽可能的重复使用对象，这比重新创建对象更有效</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; LINE-HEIGHT: 12pt; mso-list: l1 level2 lfo1; tab-stops: list 39.0pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">9、<span style="FONT: 7pt 'Times New Roman'">   </span></span>
				</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">使用缓式评估，延迟计算，不必要的计算永远都不要计算</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; LINE-HEIGHT: 12pt; mso-list: l1 level2 lfo1; tab-stops: list 39.0pt; mso-line-height-rule: exactly">
				<span lang="EN-US" style="FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'">
						<span style="mso-list: Ignore">10、</span>
				</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">手动优化你的代码，特别是执行的顺序</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p><img src ="http://www.blogjava.net/danxy2008/aggbug/83095.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/danxy2008/" target="_blank">蒋利文</a> 2006-11-23 18:50 <a href="http://www.blogjava.net/danxy2008/archive/2006/11/23/83095.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用JMeter测试web项目</title><link>http://www.blogjava.net/danxy2008/archive/2006/11/23/83094.html</link><dc:creator>蒋利文</dc:creator><author>蒋利文</author><pubDate>Thu, 23 Nov 2006 10:37:00 GMT</pubDate><guid>http://www.blogjava.net/danxy2008/archive/2006/11/23/83094.html</guid><wfw:comment>http://www.blogjava.net/danxy2008/comments/83094.html</wfw:comment><comments>http://www.blogjava.net/danxy2008/archive/2006/11/23/83094.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/danxy2008/comments/commentRss/83094.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/danxy2008/services/trackbacks/83094.html</trackback:ping><description><![CDATA[<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?>
						<o:p>
								<font size="2">
								</font>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt">
				<font size="2">
						<strong>
								<span lang="EN-US" style="mso-bidi-font-family: 宋体">
										<span style="mso-list: Ignore">一、</span>
								</span>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">简介</span>
						</strong>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="2">
						<span lang="EN-US">
								<span style="mso-spacerun: yes"> </span>
								<span style="mso-spacerun: yes">        </span>Apache JMeter </span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是</span>
						<span lang="EN-US">100</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">％的</span>
						<span lang="EN-US">Java</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">桌面应用程序。用于对软件做压力测试（例如</span>
						<span lang="EN-US">Web</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">应用）。</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">它可以用于测试静态何动态资源例如静态文件、</span>
						<span lang="EN-US">Java </span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">小服务程序、</span>
						<span lang="EN-US">CGI </span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">脚本、</span>
						<span lang="EN-US">Java </span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象、数据库，</span>
						<span lang="EN-US"> FTP </span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">服务器</span>
						<span lang="EN-US">, </span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等等。</span>
						<span lang="EN-US">JMeter </span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可以用于对服务器、网络或对象模拟巨大的负载，来在不同压力类别下测试它们的强度和分析整体性能。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">另外，</span>
						<span lang="EN-US">JMeter</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">能够对应用程序做衰退测试，通过创建带有断言的脚本来验证你的程序返回了你期望的结果。为了最大限度的灵活性，</span>
						<span lang="EN-US">JMeter</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">允许使用正则表达式创建断言。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将来开发的主要目标是使得</span>
						<span lang="EN-US">JMeter</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">尽可能地变成一个有用的衰退测试工具，而不损失</span>
						<span lang="EN-US">JMeter</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">地压力测试能力。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="2">衰退测试：通过回归测试等方法来保证经过修改的代码没有衰退（质量下降）。</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p>
								<font size="2"> </font>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt">
				<font size="2">
						<strong>
								<span lang="EN-US" style="mso-bidi-font-family: 宋体">
										<span style="mso-list: Ignore">二、</span>
								</span>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">安装与配置</span>
						</strong>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt">
				<font size="2">
						<span lang="EN-US">JMeter</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的安装过程非常简单：</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第一步</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">安装</span>
						<span lang="EN-US">JDK</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（这里使用</span>
						<span lang="EN-US">JDK <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /?><st1:chsdate w:st="on" year="1899" month="12" day="30" islunardate="False" isrocdate="False">1.5.0</st1:chsdate></span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第二步</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下载</span>
						<span lang="EN-US">JMeter</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，并解压</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt">
				<font size="2">
						<span lang="EN-US">
								<span style="mso-tab-count: 1">       </span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">官方下载地址：</span>
						<span lang="EN-US">
								<a href="http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi">
										<font color="#1f354d">http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi</font>
								</a>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，下载</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt">
				<font size="2">
						<span lang="EN-US">jakarta-jmeter-2.2.zip</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">包，大小：</span>
						<st1:chmetcnv w:st="on" unitname="m" sourcevalue="9.52" hasspace="False" negative="False" numbertype="1" tcsc="0">
								<span lang="EN-US">9.52M</span>
						</st1:chmetcnv>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第三步</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">配置环境变量</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt">
				<span lang="EN-US">
						<font size="2">
								<span style="mso-tab-count: 1">       </span>JAVA_HOME = …</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt">
				<span lang="EN-US">
						<font size="2">
								<span style="mso-spacerun: yes">    </span>JMeter = …</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt">
				<span lang="EN-US">
						<font size="2">
								<span style="mso-spacerun: yes">    </span>CLASS_PATH=”%JAVA_HOME%\bin;%JAVA_HOME%\lib\tools.jar;%JMeter\bin%”</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第四步</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">运行</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt">
				<font size="2">
						<span lang="EN-US">
								<span style="mso-tab-count: 1">       </span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在命令行运行</span>
						<span lang="EN-US">jmeter.bat</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，出现如下界面，说明安装成功：</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.75pt; TEXT-ALIGN: center" align="center">
				<span lang="EN-US">
						<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /?>
						<v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600">
								<font size="2">
										<v:stroke joinstyle="miter">
										</v:stroke>
										<v:formulas>
												<v:f eqn="if lineDrawn pixelLineWidth 0">
												</v:f>
												<v:f eqn="sum @0 1 0">
												</v:f>
												<v:f eqn="sum 0 0 @1">
												</v:f>
												<v:f eqn="prod @2 1 2">
												</v:f>
												<v:f eqn="prod @3 21600 pixelWidth">
												</v:f>
												<v:f eqn="prod @3 21600 pixelHeight">
												</v:f>
												<v:f eqn="sum @0 0 1">
												</v:f>
												<v:f eqn="prod @6 1 2">
												</v:f>
												<v:f eqn="prod @7 21600 pixelWidth">
												</v:f>
												<v:f eqn="sum @8 21600 0">
												</v:f>
												<v:f eqn="prod @7 21600 pixelHeight">
												</v:f>
												<v:f eqn="sum @10 21600 0">
												</v:f>
										</v:formulas>
										<v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f">
										</v:path>
										<o:lock aspectratio="t" v:ext="edit">
										</o:lock>
								</font>
						</v:shapetype>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p>
								<font size="2"> </font>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: -21pt; mso-list: l0 level1 lfo1; tab-stops: list 21.0pt">
				<font size="2">
						<strong>
								<span lang="EN-US" style="mso-bidi-font-family: 宋体">
										<span style="mso-list: Ignore">三、</span>
								</span>
								<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项目应用</span>
						</strong>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 39.0pt">
				<font size="2">
						<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
								<span style="mso-list: Ignore">1.<span style="FONT: 7pt 'Times New Roman'">       </span></span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">项目需求</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模拟</span>
						<span lang="EN-US">5</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个用户并发请求，每个用户请求两次（一次请求结束后，发出下一个请求），得出各个请求样本的响应时间，并得出一些统计性的数据。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo2; tab-stops: list 39.0pt">
				<font size="2">
						<span lang="EN-US" style="mso-fareast-font-family: 'Times New Roman'">
								<span style="mso-list: Ignore">2.<span style="FONT: 7pt 'Times New Roman'">       </span></span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">建立测试计划</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="2">首先，添加一个线程组，如下图：</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-ALIGN: center" align="center">
				<span lang="EN-US">
						<font size="2">
						</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用户并发数为</span>
						<span lang="EN-US">5</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，因为一个用户请求我们可以看作是一个请求线程，所以我们将线程数设置为</span>
						<span lang="EN-US">5</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。这里设置休眠时间为</span>
						<span lang="EN-US">0</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，循环的次数为</span>
						<span lang="EN-US">2</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其次，建立默认的</span>
						<span lang="EN-US">HTTP</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">连接属性，这样不用每次都重新输入参数，如下图：</span>
				</font>
				<span lang="EN-US">
						<o:p>
								<font size="2"> </font>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-ALIGN: center" align="center">
				<span lang="EN-US">
						<font size="2">
						</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">再次，建立要测试的</span>
						<span lang="EN-US">Http</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">请求，如下图</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt; TEXT-ALIGN: center" align="center">
				<span lang="EN-US">
						<font size="2">
						</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="2">最后，建立查看结果形式，我们采用表格数据记录</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt 39pt">
				<span lang="EN-US">
						<o:p>
								<font size="2"> </font>
						</o:p>
				</span>
				<span lang="EN-US">
						<o:p>
								<font size="2"> </font>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="2">
						<span lang="EN-US">
								<span style="mso-tab-count: 1">       </span>3</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">．运行测试脚本</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="2">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">点击要测试的脚本，然后执行菜单运行</span>
						<span lang="EN-US">—</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">》开始，测试开始。</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="2">
						<span lang="EN-US">
								<span style="mso-spacerun: yes"> </span>
								<span style="mso-tab-count: 1">     </span>4</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">．测试数据分析</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="2">
						<span lang="EN-US">
								<span style="mso-tab-count: 2">              </span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">测试完成之后，数据如下：<br /></span>
				</font>
				<span lang="EN-US">
						<span style="mso-tab-count: 1">
								<font size="2">       </font>
						</span>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<font size="2">聚合数据分析结果如下：</font>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="2">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">模拟</span>
						<span lang="EN-US">5</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个用户并发访问</span>
						<span lang="EN-US">
								<a href="http://10.36.32.5:8080/wwwncsl/default.htm">
										<font color="#1f354d">http://10.36.32.5:8080/wwwncsl/default.htm</font>
								</a>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">页面，每个用户循环访问一次，总共</span>
						<span lang="EN-US">10</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个样本数据。最大响应时间为</span>
						<span lang="EN-US">10.355s</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，最短响应时间为</span>
						<span lang="EN-US">2.84s</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，平均为</span>
						<span lang="EN-US">6.572s</span>
				</font>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<font size="2">
						<span lang="EN-US">90%</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的可能集中在响应时间为</span>
						<span lang="EN-US">10.355s</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</span>
				</font>
		</p><img src ="http://www.blogjava.net/danxy2008/aggbug/83094.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/danxy2008/" target="_blank">蒋利文</a> 2006-11-23 18:37 <a href="http://www.blogjava.net/danxy2008/archive/2006/11/23/83094.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Tomcat 5.5 配置数据源</title><link>http://www.blogjava.net/danxy2008/archive/2006/10/17/75574.html</link><dc:creator>蒋利文</dc:creator><author>蒋利文</author><pubDate>Tue, 17 Oct 2006 04:32:00 GMT</pubDate><guid>http://www.blogjava.net/danxy2008/archive/2006/10/17/75574.html</guid><wfw:comment>http://www.blogjava.net/danxy2008/comments/75574.html</wfw:comment><comments>http://www.blogjava.net/danxy2008/archive/2006/10/17/75574.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/danxy2008/comments/commentRss/75574.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/danxy2008/services/trackbacks/75574.html</trackback:ping><description><![CDATA[<p>
				<br />
				<strong>配置文件：</strong>
				<br />&lt;Context path="/apple" docBase="D:\workspace\bolg\webdoc"<br />         privileged="true" antiResourceLocking="false" antiJARLocking="false"&gt;<br /> &lt;Resource name="jdbc/blogdb" auth="Container" <br />    type="javax.sql.DataSource"<br />    maxActive="100" maxIdle="30" maxWait="10000"<br />    username="root" password="" <br />    driverClassName="com.mysql.jdbc.Driver"<br />    url="jdbc:mysql://localhost:3306/blogdb?autoReconnect=true"/&gt;<br />&lt;/Context&gt;<br /><br /><strong>调用方式:</strong><br /> Context ctx = null ;<br /> Connection conn = null;<br /> Statement stmt = null ;<br /> ResultSet rs = null;<br /> try{<br />  ctx = new InitialContext();<br />  if( ctx == null) throw new Exception("没有匹配的环境!");<br />  DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/blogdb");<br />  if( ds == null ) throw new Exception("没有匹配的数据库!");<br />  conn = ds.getConnection();<br />  stmt = conn.createStatement();<br />  rs = stmt.executeQuery(" select * from tbl_blog");<br />  while(rs.next()){<br />   out.print(rs.getString(2));<br />  }<br />  <br /> }catch(Exception e){<br />  e.printStackTrace();<br /> }finally{<br />  if(rs!=null) rs.close();<br />  if(stmt!=null) stmt.close();<br />  if(conn!=null) conn.close();<br />  if(ctx!=null) ctx.close();<br /> }<br /><strong><br /></strong><br /><br /></p><img src ="http://www.blogjava.net/danxy2008/aggbug/75574.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/danxy2008/" target="_blank">蒋利文</a> 2006-10-17 12:32 <a href="http://www.blogjava.net/danxy2008/archive/2006/10/17/75574.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>