??xml version="1.0" encoding="utf-8" standalone="yes"?>一区二区在线影院,欧美激情综合色综合啪啪五月,自拍偷拍亚洲一区http://www.aygfsteel.com/vcycyv/category/47721.htmlzh-cnSun, 21 Jun 2015 02:10:31 GMTSun, 21 Jun 2015 02:10:31 GMT60Encountered an exception that google doesn't know: NoSuchMethodError: findMergedAnnotationAttributes(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;ZZ)Lorg/springframework/core/annotation/AnnotationAttributes;http://www.aygfsteel.com/vcycyv/archive/2015/06/21/425810.html人在江湖人在江湖Sun, 21 Jun 2015 01:08:00 GMThttp://www.aygfsteel.com/vcycyv/archive/2015/06/21/425810.htmlhttp://www.aygfsteel.com/vcycyv/comments/425810.htmlhttp://www.aygfsteel.com/vcycyv/archive/2015/06/21/425810.html#Feedback1http://www.aygfsteel.com/vcycyv/comments/commentRss/425810.htmlhttp://www.aygfsteel.com/vcycyv/services/trackbacks/425810.html我在写一个用spring boot的应用,需要了q个exception:
NoSuchMethodError: findMergedAnnotationAttributes(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/String;ZZ)Lorg/springframework/core/annotation/AnnotationAttributes;
at org.springframework.test.util.MetaAnnotationUtils$AnnotationDescriptor.<init>(MetaAnnotationUtils.java:290)
at org.springframework.test.util.MetaAnnotationUtils$UntypedAnnotationDescriptor.<init>(MetaAnnotationUtils.java:365)
at org.springframework.test.util.MetaAnnotationUtils$UntypedAnnotationDescriptor.<init>(MetaAnnotationUtils.java:360)
at org.springframework.test.util.MetaAnnotationUtils.findAnnotationDescriptorForTypes(MetaAnnotationUtils.java:191)
at org.springframework.test.util.MetaAnnotationUtils.findAnnotationDescriptorForTypes(MetaAnnotationUtils.java:208)
at org.springframework.test.util.MetaAnnotationUtils.findAnnotationDescriptorForTypes(MetaAnnotationUtils.java:166)
at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:274)
at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTestContextBootstrapper.java:110)
at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:120)
at org.springframework.test.context.TestContextManager.<init>(TestContextManager.java:105)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:143)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<init>(SpringJUnit4ClassRunner.java:134)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

The solution is: in the pom.xml, instead of using 
<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.0.BUILD-SNAPSHOT</version>
</parent>

Use a specific version:
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.4.RELEASE</version>
    </parent>


人在江湖 2015-06-21 09:08 发表评论
]]>
为QA准备的用以性能试的javaU表http://www.aygfsteel.com/vcycyv/archive/2013/04/04/397392.html人在江湖人在江湖Thu, 04 Apr 2013 14:28:00 GMThttp://www.aygfsteel.com/vcycyv/archive/2013/04/04/397392.htmlhttp://www.aygfsteel.com/vcycyv/comments/397392.htmlhttp://www.aygfsteel.com/vcycyv/archive/2013/04/04/397392.html#Feedback0http://www.aygfsteel.com/vcycyv/comments/commentRss/397392.htmlhttp://www.aygfsteel.com/vcycyv/services/trackbacks/397392.html以前QA做性能试用手机的U表Q很不方ѝ前两年为QA做了一个javaU表Q记录鼠标两ơ点M间的旉差。但是那是基于JInvoke的,JInvoke是收费YӞ有试用的旉Q用来封装JNI~程的复杂性。最qQA要求我再搞一个完全免费的cM软g。这ơ用的是jnativehook.
jnativehook可以用来监控键盘和鼠标的事g。底层通过调用不同q_的native code屏蔽了^台相x。它强大的地方在于,Zjnativehook的Y件可以后台运行,没有cM“监控某窗?/strong>内键?鼠标事g”的限制?/div>
扩展jnativehook的这个小工具可以记录两次鼠标点击之间的时间差Q更切地说Q是记录W一ơ鼠标抬起和W二ơ鼠标按?/strong>的时间差。D一个QA使用的例子,比如在UI上点M个buttonQ等着执行成功弹出的对话框。QA在点击buttonӞ鼠标一抬vQ这个小工具开始计Ӟ当QA看见对话框时Q马上在屏幕L位置炚w标,软gp录了q两ơ点M间的旉差。当Ӟq样做还是不够精,存在人反应时间的误差?/div>
jnativehook目的主在 https://code.google.com/p/jnativehook/
我扩展程序的源代码如下:
import org.jnativehook.GlobalScreen;
import org.jnativehook.NativeHookException;
import org.jnativehook.mouse.NativeMouseEvent;
import org.jnativehook.mouse.NativeMouseInputListener;


public class MouseHook  implements NativeMouseInputListener  {

    static double startPoint = 0.0;
    /**
     * 
@param args
     
*/
    public static void main(String[] args) {
        try {
            GlobalScreen.registerNativeHook();
    }
    catch (NativeHookException ex) {
            System.err.println("There was a problem registering the native hook.");
            System.err.println(ex.getMessage());

            System.exit(1);
    }

    //Construct the example object.
        MouseHook example = new MouseHook();

    //Add the appropriate listeners for the example object.
    GlobalScreen.getInstance().addNativeMouseListener(example);

    }

    @Override
    public void nativeMouseClicked(NativeMouseEvent arg0) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void nativeMousePressed(NativeMouseEvent arg0) {
        System.out.println((System.currentTimeMillis() - startPoint)/1000);
        
    }

    @Override
    public void nativeMouseReleased(NativeMouseEvent arg0) {
        startPoint = System.currentTimeMillis();        
    }

    @Override
    public void nativeMouseDragged(NativeMouseEvent arg0) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void nativeMouseMoved(NativeMouseEvent arg0) {
        // TODO Auto-generated method stub
        
    }

}
可以在eclipse里右键点java 目Q在export...里选择Java目录下的Runnable Jar File
假如你保存的jar文g叫mousehook.jar. 可以直接使用java -jar mousehook.jar启动可以用了?/div>

人在江湖 2013-04-04 22:28 发表评论
]]>关于调优之数据库(一Q?/title><link>http://www.aygfsteel.com/vcycyv/archive/2013/03/31/397206.html</link><dc:creator>人在江湖</dc:creator><author>人在江湖</author><pubDate>Sun, 31 Mar 2013 13:49:00 GMT</pubDate><guid>http://www.aygfsteel.com/vcycyv/archive/2013/03/31/397206.html</guid><wfw:comment>http://www.aygfsteel.com/vcycyv/comments/397206.html</wfw:comment><comments>http://www.aygfsteel.com/vcycyv/archive/2013/03/31/397206.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/vcycyv/comments/commentRss/397206.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/vcycyv/services/trackbacks/397206.html</trackback:ping><description><![CDATA[<div style="font-family: 微Y雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2;">q篇文字主要讨论sql的一般编写原则。下一讨论根据执行计划进行调优的话题?/div> <div style="font-family: 微Y雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2;">|上q类文章很多Q但往往只是l出l论Q比如,q样写sql会比那样写sql效率更高。阅读者如果打打开数据库自己做一遍实验,看看效率差异到底有多,需要自己造数据,q是比较ȝ。这文字会把DDL和DML以及sql的执行时间都写出来,一斚wl一个更直观的印象,另一斚w方便阅读者自己实验?/div> <div style="font-family: 微Y雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2;"></div> <div style="font-family: 微Y雅黑; line-height: normal; orphans: 2; text-align: -webkit-auto; widows: 2;">以Oracle为实验用数据库,使用著名的emp表。安装oracle数据库之后,scott用户的密码是tiger. 在他的schema下有几张sample表,很多sql教程都以q几张表为基. 据说Q熟悉oracle数据库的人提到smithq个人名Q就能联惌vsample表中他的工作是clerk. emp表就是sample表之一。这张表原始数据只有14行,Z体现不同sql性能上的差异Q我们需要多填充一些数据进厅R作为填充数据的预备知识Q我们可以看一下如何生成一pd从小到大的id:<br /> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #0000FF; ">SELECT</span> ROWNUM<br /> <span style="color: #0000FF; ">FROM</span> DUAL<br /> CONNECT <span style="color: #0000FF; ">BY</span> <span style="color: #0000FF; ">LEVEL</span> <span style="color: #808080; "><</span> <span style="color: #800000; font-weight: bold; ">10000</span>;</div> <span style="font-family: monospace, Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 14px; white-space: pre;">填充随机数据可以借助于dbms_random包,不想覆盖已有的表Q所以新创徏一个表l构基本一LQ?/span> <br /> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #0000FF; ">create</span> <span style="color: #0000FF; ">table</span> emp_new<br /> <span style="color: #0000FF; ">as</span><br /> <span style="color: #0000FF; ">select</span> <span style="color: #0000FF; ">level</span>                                                          empno,<br />        SYS.dbms_random.String(<span style="color: #FF0000; ">'</span><span style="color: #FF0000; ">u</span><span style="color: #FF0000; ">'</span>, SYS.dbms_random.value(<span style="color: #800000; font-weight: bold; ">3</span>,<span style="color: #800000; font-weight: bold; ">10</span>))       ename,<br />        SYS.dbms_random.String(<span style="color: #FF0000; ">'</span><span style="color: #FF0000; ">u</span><span style="color: #FF0000; ">'</span>, SYS.dbms_random.value(<span style="color: #800000; font-weight: bold; ">3</span>,<span style="color: #800000; font-weight: bold; ">9</span>))        job,<br />        <span style="color: #FF00FF; ">round</span>(SYS.dbms_random.value(<span style="color: #800000; font-weight: bold; ">1000</span>,<span style="color: #800000; font-weight: bold; ">9999</span>))                        mgr,<br />        TO_DATE (   <span style="color: #FF00FF; ">ROUND</span> (DBMS_RANDOM.VALUE (<span style="color: #800000; font-weight: bold; ">1</span>, <span style="color: #800000; font-weight: bold; ">28</span>))<br />                     <span style="color: #808080; ">||</span> <span style="color: #FF0000; ">'</span><span style="color: #FF0000; ">-</span><span style="color: #FF0000; ">'</span><br />                     <span style="color: #808080; ">||</span> <span style="color: #FF00FF; ">ROUND</span> (DBMS_RANDOM.VALUE (<span style="color: #800000; font-weight: bold; ">1</span>, <span style="color: #800000; font-weight: bold; ">12</span>))<br />                     <span style="color: #808080; ">||</span> <span style="color: #FF0000; ">'</span><span style="color: #FF0000; ">-</span><span style="color: #FF0000; ">'</span><br />                     <span style="color: #808080; ">||</span> <span style="color: #FF00FF; ">ROUND</span> (DBMS_RANDOM.VALUE (<span style="color: #800000; font-weight: bold; ">1980</span>, <span style="color: #800000; font-weight: bold; ">2012</span>)),<br />                     <span style="color: #FF0000; ">'</span><span style="color: #FF0000; ">DD-MM-YYYY</span><span style="color: #FF0000; ">'</span><br />                    )                                                   hiredate,<br />         <span style="color: #FF00FF; ">round</span>(SYS.dbms_random.value(<span style="color: #800000; font-weight: bold; ">300</span>,<span style="color: #800000; font-weight: bold; ">9999</span>))                         sal,<br />         <span style="color: #FF00FF; ">round</span>(SYS.dbms_random.value(<span style="color: #800000; font-weight: bold; ">1</span>,<span style="color: #800000; font-weight: bold; ">6</span>)) <span style="color: #808080; ">*</span> <span style="color: #800000; font-weight: bold; ">100</span>                        comm,<br />         <span style="color: #FF00FF; ">round</span>(SYS.dbms_random.value(<span style="color: #800000; font-weight: bold; ">1</span>,<span style="color: #800000; font-weight: bold; ">4</span>)) <span style="color: #808080; ">*</span> <span style="color: #800000; font-weight: bold; ">10</span>                         deptno<br />  <span style="color: #0000FF; ">FROM</span> DUAL<br /> CONNECT <span style="color: #0000FF; ">BY</span> <span style="color: #0000FF; ">LEVEL</span> <span style="color: #808080; "><</span> <span style="color: #800000; font-weight: bold; ">1000000</span>;</div> <div number3="" index2="" alt2"="" style="color: #222222; font-family: monospace, Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 1.1em !important; outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important; white-space: pre !important;"><br /> </div> <div number3="" index2="" alt2"="" style="color: #222222; font-family: monospace, Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 1.1em !important; outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important; white-space: pre !important;"><span style="font-size: 14px; ">q里有一个局限,原本的emp表mgr列reference empno列。上面新创徏的emp_new中失Mq个constraint. q点可以从Oracle SQL Developer中看到?/span></div> <div number3="" index2="" alt2"="" style="color: #222222; font-family: monospace, Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13px; line-height: 1.1em !important; outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important; white-space: pre !important;"><span style="font-size: 14px;">emp表:<br /> <a target="_blank"><img src="http://f-1.tuzhan.com/adb507d00a2a/p-2/l/2013/03/31/09/7c29f2ddaa7d47f29535dbe8b892c36a.png" alt="with_constrant.png" border="0" /><br /> </a></span> <span style="font-size: 14px; line-height: 14px;">emp_new表:</span> <span style="font-size: 14px;"><br /> <a target="_blank"><img src="http://f-1.tuzhan.com/33bdd567b454/p-2/l/2013/03/31/09/485143eb02104036ba1f146fb0d99375.png" alt="no_constrant.png" border="0" /></a> </span> <div style="color: #000000; font-family: 微Y雅黑; font-size: 14px; line-height: normal; text-align: -webkit-auto; white-space: normal;"><table border="0" cellpadding="0" cellspacing="0" style="width: 402px; color: #222222; font-family: monospace, Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-size: 13px !important; outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; box-sizing: content-box !important; direction: ltr !important;"><tbody style="outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-style: initial !important; border-color: initial !important; border-image: initial !important; vertical-align: baseline !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow-x: visible !important; overflow-y: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important; "><tr style="outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-style: initial !important; border-color: initial !important; border-image: initial !important; vertical-align: baseline !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; overflow-x: visible !important; overflow-y: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important; "><td class="code" style="word-break: break-all; outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-style: initial !important; border-color: initial !important; border-image: initial !important; vertical-align: baseline !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow-x: visible !important; overflow-y: visible !important; position: static !important; right: auto !important; top: auto !important; width: 402px; box-sizing: content-box !important; direction: ltr !important; "><div id="wmqeeuq" class="container" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: relative !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; white-space: pre; ">下面开始测试sql了:</span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; white-space: pre; ">1. 先比较一下加primary key前后的结果:</span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; white-space: pre; ">select * from emp_new where empno=1;</span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; white-space: pre; ">加primary key constraint之前q行0.023U?加了primary key constraint之后0.001U。加</span><span style="font-size: 14px; white-space: pre; line-height: 1.1em; ">primary key constraint?00万条数据上大U花?U钟?/span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">2. where子句 vs. having子句</span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">select deptno, avg(sal) from emp_new group by deptno having deptno != 10 and deptno != 20;</span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">0.24U?/span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">select deptno, avg(sal) from emp_new where deptno != 10 and deptno != 20 group by deptno ;</span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">0.16U?/span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">所以having中的条g一般用于对一些集合函数的比较Q如count(){,除此之外Q一般条件应该写在where子句中?/span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; "><br /></span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">3. 减少对表的查?/span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">update emp_new set sal=(select max(sal) from emp_new), comm=(select max(comm) from emp_new) where empno=1237;</span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">0.11U左?/span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">update emp_new set (sal, comm) =(select max(sal), max(comm) from emp_new) where empno=1224;</span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">0.07U到0.08U之?/span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; "><br /></span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">注意Q以上三个测试都只fetch?0条数据?/span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; "><br /></span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">4. 传说中用exists替代in通常可提高查询效率, not exists 也比not in 快?br />先生成dept_new表:<br /></span><div style="background-color: #eeeeee; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">create</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">table</span><span style="color: #000000; "> dept_new<br /></span><span style="color: #0000FF; ">as</span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">select</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">level</span><span style="color: #000000; ">                                                          deptno,<br />       SYS.dbms_random.String(</span><span style="color: #FF0000; ">'</span><span style="color: #FF0000; ">u</span><span style="color: #FF0000; ">'</span><span style="color: #000000; ">, SYS.dbms_random.value(</span><span style="color: #800000; font-weight: bold; ">3</span><span style="color: #000000; ">,</span><span style="color: #800000; font-weight: bold; ">10</span><span style="color: #000000; ">))       dname,<br />       SYS.dbms_random.String(</span><span style="color: #FF0000; ">'</span><span style="color: #FF0000; ">u</span><span style="color: #FF0000; ">'</span><span style="color: #000000; ">, SYS.dbms_random.value(</span><span style="color: #800000; font-weight: bold; ">3</span><span style="color: #000000; ">,</span><span style="color: #800000; font-weight: bold; ">9</span><span style="color: #000000; ">))        loc<br /></span><span style="color: #0000FF; ">FROM</span><span style="color: #000000; "> DUAL<br />CONNECT </span><span style="color: #0000FF; ">BY</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">LEVEL</span><span style="color: #000000; "> </span><span style="color: #808080; "><</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">10000</span><span style="color: #000000; ">;</span></div></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">实际试中,无论是执行计划还是实际测试的速度都是基本一致的?/span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">W一l?/span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; ">select * from emp_new e where e.empno > 986000 and e.deptno in (select d.deptno from dept_new d where d.loc='AYDN') select * from emp_new e where empno > 986000 and exists (select * from dept_new d where d.deptno = e.deptno and d.loc='AYDN') W二l? select e.empno from emp_new e where e.empno > 996000 and not exists (select 1 from dept_new d where d.deptno = e.deptno and loc like 'A%') select e.empno from emp_new e where e.empno > 996000 and e.deptno not in (select d.deptno from dept_new d where loc like 'A%')</span></div><div id="wmqeeuq" class="line number3 index2 alt2" style="outline: 0px !important; border: 0px !important; vertical-align: baseline !important; margin: 0px !important; padding: 2px 1em 2px 0em !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; overflow: visible !important; position: static !important; right: auto !important; top: auto !important; width: auto !important; box-sizing: content-box !important; direction: ltr !important;"><span style="font-size: 14px; line-height: 15px; white-space: pre; "><br /></span></div></div></td></tr></tbody></table></div><div style="color: #000000; font-family: 微Y雅黑; font-size: 14px; line-height: normal; text-align: -webkit-auto; white-space: normal;"></div><div style="color: #000000; font-family: 微Y雅黑; font-size: 14px; line-height: normal; text-align: -webkit-auto; white-space: normal;">q篇文字主要参考两文章:</div><div style="color: #000000; font-family: 微Y雅黑; font-size: 14px; line-height: normal; text-align: -webkit-auto; white-space: normal;">Generating Random Data in<a href="file:///C:/Users/Chuyang/AppData/Local/youdao/ynote/editor/web/Oracle%EF%BC%9Ahttp://viralpatel.net/blogs/generating-random-data-in-oracle/" style="cursor: pointer; "> OracleQhttp://viralpatel.net/blogs/generating-random-data-in-oracle/</a></div><div style="color: #000000; font-family: 微Y雅黑; font-size: 14px; line-height: normal; text-align: -webkit-auto; white-space: normal;">Oracle sql  性能优化调整Q?a href="file:///C:/Users/Chuyang/AppData/Local/youdao/ynote/editor/web/&nbsp;http://wenku.baidu.com/view/571cddd4195f312b3169a507" style="cursor: pointer; "> http://wenku.baidu.com/view/571cddd4195f312b3169a507</a> </div> <span style="font-size: 14px;"><br /> <br /> <br /> <br /> </span></div> </div><img src ="http://www.aygfsteel.com/vcycyv/aggbug/397206.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/vcycyv/" target="_blank">人在江湖</a> 2013-03-31 21:49 <a href="http://www.aygfsteel.com/vcycyv/archive/2013/03/31/397206.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>自录performance tuning, jvm, visualvm视频(更新Q已发送视频至优酷)http://www.aygfsteel.com/vcycyv/archive/2012/08/24/386164.html人在江湖人在江湖Fri, 24 Aug 2012 00:30:00 GMThttp://www.aygfsteel.com/vcycyv/archive/2012/08/24/386164.htmlhttp://www.aygfsteel.com/vcycyv/comments/386164.htmlhttp://www.aygfsteel.com/vcycyv/archive/2012/08/24/386164.html#Feedback12http://www.aygfsteel.com/vcycyv/comments/commentRss/386164.htmlhttp://www.aygfsteel.com/vcycyv/services/trackbacks/386164.htmlvisualvm是Sun JDK自带的Java profiling的工兗自己录了一个视?35分钟Q简单的介绍了performance tuning的lifecycle, jvm的一点点理论Q以及visualvm的操作:定位死锁Q查看out of memory, 定位q行~慢的method.

 

视频文g在:https://docs.google.com/open?id=0B22ayLe4teeYQm56QnhaWkUxM2s

ppt在:https://docs.google.com/open?id=0B22ayLe4teeYdEhsMkItTk16UDg

有h说google drive上不Ҏ下蝲大文Ӟ压羃一下,但是我不太会用视频压~YӞ压过之后效果不好了,倒是也能就着看:

https://docs.google.com/open?id=0B22ayLe4teeYY1pvNlVtSWdUOVU

我的声音像梦游一Phttp://v.youku.com/v_show/id_XNDQ1Nzk0NDYw.html
 

 



人在江湖 2012-08-24 08:30 发表评论
]]>
ȝJava的Genericshttp://www.aygfsteel.com/vcycyv/archive/2012/08/20/385803.html人在江湖人在江湖Mon, 20 Aug 2012 00:13:00 GMThttp://www.aygfsteel.com/vcycyv/archive/2012/08/20/385803.htmlhttp://www.aygfsteel.com/vcycyv/comments/385803.htmlhttp://www.aygfsteel.com/vcycyv/archive/2012/08/20/385803.html#Feedback0http://www.aygfsteel.com/vcycyv/comments/commentRss/385803.htmlhttp://www.aygfsteel.com/vcycyv/services/trackbacks/385803.html阅读全文

人在江湖 2012-08-20 08:13 发表评论
]]>
发现thinking in java 4th edition的一个错?/title><link>http://www.aygfsteel.com/vcycyv/archive/2012/07/30/384290.html</link><dc:creator>人在江湖</dc:creator><author>人在江湖</author><pubDate>Mon, 30 Jul 2012 02:30:00 GMT</pubDate><guid>http://www.aygfsteel.com/vcycyv/archive/2012/07/30/384290.html</guid><wfw:comment>http://www.aygfsteel.com/vcycyv/comments/384290.html</wfw:comment><comments>http://www.aygfsteel.com/vcycyv/archive/2012/07/30/384290.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/vcycyv/comments/commentRss/384290.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/vcycyv/services/trackbacks/384290.html</trackback:ping><description><![CDATA[     摘要: thinking in java看了差不多有5Q?遍,但是之前有些章节看得不仔l。最q有感于自己技术的不扎实,开始重看thinking in java, 发现了书中的一个错误,在原书的491c?  1: //: generics/Wildcards.java 2: // Exploring the meaning of wildcards. 3:  4:...  <a href='http://www.aygfsteel.com/vcycyv/archive/2012/07/30/384290.html'>阅读全文</a><img src ="http://www.aygfsteel.com/vcycyv/aggbug/384290.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/vcycyv/" target="_blank">人在江湖</a> 2012-07-30 10:30 <a href="http://www.aygfsteel.com/vcycyv/archive/2012/07/30/384290.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>remove element without causing ConcurrentModificationException & i18n number input solution & 免费录屏软ghttp://www.aygfsteel.com/vcycyv/archive/2012/06/23/381353.html人在江湖人在江湖Sat, 23 Jun 2012 08:28:00 GMThttp://www.aygfsteel.com/vcycyv/archive/2012/06/23/381353.htmlhttp://www.aygfsteel.com/vcycyv/comments/381353.htmlhttp://www.aygfsteel.com/vcycyv/archive/2012/06/23/381353.html#Feedback0http://www.aygfsteel.com/vcycyv/comments/commentRss/381353.htmlhttp://www.aygfsteel.com/vcycyv/services/trackbacks/381353.html
List<String> names = .
Iterator<String> i = names.iterator();
while (i.hasNext()) {
   // Do something
   i.remove();
}

Note that you must call i.next() before you can call i.remove()

2. 法语Qd语中数字数点用,表示Q千位符?." 如果做支持I18n的UIQ?需要显C数字ƈ接受他们输入的数?可以q样做:
    public static void main(String[] args) throws ParseException{
        String numString = "0.05";
        String frenchNumString = "0,05";
        NumberFormat nf = NumberFormat.getNumberInstance();
        System.out.println("French format of raw string: " + nf.format(Double.parseDouble(numString)));
        
        Double n = (Double) nf.parse(frenchNumString);
        System.out.println("Parse french number and calculate: " + (n + 1));
    }

3. 免费的录屏YӞHyperCam 



人在江湖 2012-06-23 16:28 发表评论
]]>
微改q版DAV Explorer和推荐几个好看的视频http://www.aygfsteel.com/vcycyv/archive/2012/04/16/374702.html人在江湖人在江湖Mon, 16 Apr 2012 00:45:00 GMThttp://www.aygfsteel.com/vcycyv/archive/2012/04/16/374702.htmlhttp://www.aygfsteel.com/vcycyv/comments/374702.htmlhttp://www.aygfsteel.com/vcycyv/archive/2012/04/16/374702.html#Feedback5http://www.aygfsteel.com/vcycyv/comments/commentRss/374702.htmlhttp://www.aygfsteel.com/vcycyv/services/trackbacks/374702.htmlWeb Dav是一U可以在上面d文g的web server. 支持加锁Q解锁。还支持版本控制。树状结构,可以在上面存储键值对?/p>

理Web Dav一般用Dav ExplorerQ它是开源的. qx用Dav Explorer的时候有两点有些不爽?/p>

W一Q它不能理中文Q非英文Q目录,以至于所有子目录也不能通过q个工具讉K

W二Q它不能保存密码Q^时工作时常连不同机器Q天天输入密码?/p>

最q改了一些它的代码,q两个问题都解决了?/p>

解决中文目录问题Q主要是通过commons-httpclient.jar包里的URIUtil.encodePathQ它能直接encode完整的http url, 而不像URLEncoder只能encode url的文仉分(http://以及前面的context path不能直接用URLEncoder来encodeQ?/p>

解决保存密码的问题主要是通过Java的Preferences.

改进后的Dav Explorer可以在我的网盘下载:http://115.com/file/c2k7519k#DAVExplorer-chuyang.zzip 下蝲之后后缀名要Ҏ.zip. jar包里包含源代码?/p>

 

最q看演讲视频l习p听力Q看C些对自己很有触动的推荐一下,大家有啥?荐的也说一下!
1.  TED演讲Q脆q力量Q这是关于如何做到全心全力(whole-heartedQ生zȝ 演讲Q当时反复看了三遍,带给自己很多思考?
http://www.en8848.com.cn/tingli/speech/ted/148318.html


2. ҎUI交互设计师的演讲Q主题叫Inventing on PrincipleQ期间的演示令h 叹ؓ观止Q他的思想也耐hd?
http://coolshell.cn/articles/6775.html


3. 奥巴马就职演_气场q真是强大?
http://v.ku6.com/show/2XDTp_25OOYOJC1u.html


4. Yang Xu在这个bbs推荐q,Randy Pausch的最后一课,值得感受一下他的h?态度Q震撹{看到生日蛋p那块儿的时候快哭了都?
最喜欢的一D话QThe brick walls are there to give us a chance to show how badly we want something. Because the brick walls are there to stop the people who don't want it badly enough. They are there to stop the other people.
http://v.youku.com/v_show/id_XMjQ3MTUzNDI4.html


5. 乔布斯斯坦福演讲Q这个太出名了,不说了?
http://www.tudou.com/programs/view/dS0wNIaiWT4/


发现TED是很好的视频演讲资源QTED指technology, entertainment, designQ可 以在优酷搜“TED演讲集”,最q看了接q?0个,很多演讲智慧而幽默?



人在江湖 2012-04-16 08:45 发表评论
]]>
假如我是CTOhttp://www.aygfsteel.com/vcycyv/archive/2011/08/01/355469.html人在江湖人在江湖Mon, 01 Aug 2011 00:25:00 GMThttp://www.aygfsteel.com/vcycyv/archive/2011/08/01/355469.htmlhttp://www.aygfsteel.com/vcycyv/comments/355469.htmlhttp://www.aygfsteel.com/vcycyv/archive/2011/08/01/355469.html#Feedback6http://www.aygfsteel.com/vcycyv/comments/commentRss/355469.htmlhttp://www.aygfsteel.com/vcycyv/services/trackbacks/355469.htmlq辈子怕是没机会当CTO了,只能假如一下了。CTO的主要职责是了解当前行的技术ƈ有前L地讑֮技术战略;预先感知未来的技术发展方向,保持市场竞争中技术较为领先的CQ这U领先应该是可以转化为商业h值的。CTO可以很大E度上左x术型公司的命q,如果作出正确的技术决{,p在竞争中늝Ҏd赎ͼ成ؓ游戏规则的制定者;一旦做错决{,可能接下来几q公司在技术上的投入都要化为影,费大量人力财力?/p>

商业公司q求最大化商业利润QCTO应该能够感知公司所处的业务市场的前景,如果整个市场处于萎羃状态,公司难保独善其nQ所以CTO”最怕入错行"QCTO有责dd司未来的技术蓝图,q且他还应该懂市? 我假想IBM当初从Y件{向服务,背后的推手应该是CTO, 即很多操作是由CEO来做Q有前瞻性地提出转型的h应该是CTOQ因Z了解技术前景,或者说Q他了解某些斚w的技术是否在未来有市场?/p>

整个软g行业都在行收购Q但最初坚定走收购道\的先驱ƈ不能得到q泛的理解和认可。多q以前,oracle开始展现收购战略的时候,他的ҎSAP有些揶揄意味圎ͼ针锋相对提出“organic grow? 依靠自n成长。结果“成镎쀝了几年发现q是Ҏ依靠收购扩张得更快,才开始跟着花钱收购Q从q个角度_SAP在战略上已经先输一招儿了。收购战略或许是Larry Ellison的灵光一玎ͼ具体扩充哪些斚w的市场,选择哪些技术领先的Ҏq行收购Q收购之后的整合规划Q这些应该都属于CTO的职责范围。不q就Oracleq个例子QLarry的技术嗅觉可能已l达到猎狗水准了?/p>

随着开源越来越盛行Q技术也来們֐于开放。在开源盛行之前,每个公司Q无论大,都有自己的技术框架。发布的各个产品都架构在q个框架之上。后来出C不同斚w的开源技术框Ӟ比如spring, hibernate, 各种MVC框架QCTO应该直接领导团队Ҏ在可能吸收的新技术进行评估。这些开源的技术往往更优UQ因为新技术往往吸收了已有技术的_֍q加以改q,另外Q开源技术有q泛的用L验证q帮助优化。但同时Q技术优U不表C成熟,公司里需要有专门的团队评估哪U技术可以在什么时候可以替代公司已有的技术?/strong> q种选择应该們֐于保守,宁可略微慢一点,也不能冒q做错技术选型。比如flex和html5在三q之前比较,不太Ҏ看出哪种技术有更好的前景。我个h觉得现在比较q两U技术的话,html5的优势明显更大一些了。开攄技术吸引更多的技术狂热者推动ƈ完善它,html5g来好用了。技术选型的决{需要审慎地慢慢做,但一旦决{完成,p雷厉风行执行决策。如果公司已l有十个产品Z老框架开发,那么不急于用新框架替代老框枉C改老品,毕竟商业产品最l目的是Z卖钱Q而不是追求完技术?/strong>更替已有产品框架无谓地引入风险。但是对于新产品Q就要坚定不Ud使用l过评估的新技术,如果公司范围里,有不同的新老技术框Ӟl护h的确有格外的成本Q但d老技术肯定是死\一条?strong>CTO做技术决定的时候,需要把各个斚w的考虑写成文档Q让一U技术h员了解技术决{的背景。上面用flex和html5举例Qƈ认ؓCTO应该让一U技术h员了解技术决{背景,原因在于我所在的公司一直在推行flexQ而我一直疑惑这个决定是怎么做出来的Q背后的依据是什么?/p>

搞创新性的技术,甌专利当然好,q个没啥可说的?没有一直追t新技术,况且最q几个月在学数学Q统计,sas之类跟java没啥关系的技? 只是p一下对技术的看法Qjava斚w个h看好的技术包括,

Spring —?它的Ҏ是JBoss seam, seam当然也值得x。在之前的博客讨论Domain Driven Design的时候说q,q不喜欢Spring所有方面,其它跟DDD的思\有相悖的地方。但Spring已经成ؓ一个流行^収ͼ它太行了,所以各路专家好手都会在它的基础上帮助改qSpring. qDDD理论的创Eric Evans都说要把DDD的思想带入Spring中,q就是龙头的优势。公司跟qSpring的技术风险小。Spring Roo是个格外值得x的项目?/p>

AspectJ —?AspectJ可以支撑技术框Ӟ但是不适合大量用在应用层面的程序里?/p>

OSGI —?其实不太了解OSGIQ但他看h比较Ҏ成ؓ标准

Groovy —?很多人在讨论谁可以替代javaQ?ruby, scala, phythonq是groovy。我个h不觉得什么能替代java。横向比较这几个技术,比较看好groovy, 因ؓ它是java的亲戚, 能自然地复用java成熟的品应用,所以它天生有“成熟”的因子。h们往往看重快速开发的Ҏ,而我觉得Q支持底层开发和易维护性才更适合企业U开发应用?/p>

人在江湖 2011-08-01 08:25 发表评论
]]>
java serializableQ{Q?/title><link>http://www.aygfsteel.com/vcycyv/archive/2011/02/23/345019.html</link><dc:creator>人在江湖</dc:creator><author>人在江湖</author><pubDate>Wed, 23 Feb 2011 15:15:00 GMT</pubDate><guid>http://www.aygfsteel.com/vcycyv/archive/2011/02/23/345019.html</guid><wfw:comment>http://www.aygfsteel.com/vcycyv/comments/345019.html</wfw:comment><comments>http://www.aygfsteel.com/vcycyv/archive/2011/02/23/345019.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/vcycyv/comments/commentRss/345019.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/vcycyv/services/trackbacks/345019.html</trackback:ping><description><![CDATA[     摘要: q篇包含三篇文章的{载和摘抄一Deffective java的code W一{? 大家都知道Serializable是一个mark interface,告诉JVMq个对象可以被{换成二进制流来传?但是Serializable与Externalizable的{换二q制的q程是不一L.Serializable 在我们实现这个接口的时?我们可以使用4个私有方法来控制序列化的q程: ...  <a href='http://www.aygfsteel.com/vcycyv/archive/2011/02/23/345019.html'>阅读全文</a><img src ="http://www.aygfsteel.com/vcycyv/aggbug/345019.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/vcycyv/" target="_blank">人在江湖</a> 2011-02-23 23:15 <a href="http://www.aygfsteel.com/vcycyv/archive/2011/02/23/345019.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ȝjava的exceptionhttp://www.aygfsteel.com/vcycyv/archive/2011/02/22/344791.html人在江湖人在江湖Mon, 21 Feb 2011 16:12:00 GMThttp://www.aygfsteel.com/vcycyv/archive/2011/02/22/344791.htmlhttp://www.aygfsteel.com/vcycyv/comments/344791.htmlhttp://www.aygfsteel.com/vcycyv/archive/2011/02/22/344791.html#Feedback5http://www.aygfsteel.com/vcycyv/comments/commentRss/344791.htmlhttp://www.aygfsteel.com/vcycyv/services/trackbacks/344791.htmlq篇和前面的 ȝjava的interface和abstract class 一栗蟩q最基础语法不聊Q只说一些比较tricky的东西和一些好的practice.

 

语法Q?/strong>

Exceptionl承自Throwable. Throwableq有一个儿子是Error,但是一般用不到。不q有些二百五面试官喜Ƣ问回字有几U写法,所以还是要知道有Errorq回事的。Exception分ؓchecked和unchecked两种?

 

java的checked exception一直是个很有争议的东西。Thinking in Java的作者Bruce, C#的设计者和Martin Fowler都对checked exception持质疑态度?一个典型的反对理由是:"We felt it was unrealistic to require the programmer to provide handlers in situations where no meaningful action can be taken." q话太实惠了。写Ҏlcaller调用Q怎么能magically知道调用q个Ҏ?strong>所?/strong>callerQ能够处理特定的异常呢?

 

关于Exception有个比较基本的语法是Q子coverride的方法如果声明抛出exception, 只能抛出父方法声明的exceptionQ或者那个exception的子cR需要注意的是,“?#8221;字还有一U写法,对于constructor来说没有q个限制Q子cd以抛ZQ意exception。父cL造函数声明的exception,子类也必d明,而且子类的构造函C能捕捉父cd明的exception. q个x也容易理解,父类构造出错了Q儿子居然能处理q把自己生出来了Q没老子哪来的儿子?当然你可以抬杠说老子戴绿帽子的情c?

 

实践Q?/strong>

1. 量不要在构造函数里做复杂的操作Q尽量不要让constructor抛出exception。如果在构造函数里抛出exception,需要用nested try block. 如下Q?/p>

   1: public class Cleanup { 
   2:   public static void main(String[] args) { 
   3:     try { 
   4:       InputFile in = new InputFile("Cleanup.java"); 
   5:       try { 
   6:         String s; 
   7:         int i = 1; 
   8:         while((s = in.getLine()) != null) 
   9:           ; // Perform line-by-line processing here... 
  10:       } catch(Exception e) { 
  11:         System.out.println("Caught Exception in main"); 
  12:         e.printStackTrace(System.out); 
  13:       } finally { 
  14:         in.dispose(); 
  15:       } 
  16:     } catch(Exception e) { 
  17:       System.out.println("InputFile construction failed"); 
  18:     } 
  19:   } 
  20: } 

而不是用finally来做清理工作?/p>

 

2. exception的一个基本用原则是Qexception不是设计用来控制E序flow的?q是很简单的道理Q还是引用effective java的一个例子吧

   1: // Horrible abuse of exceptions. Don't ever do this!
   2: try {
   3: int i = 0;
   4: while(true)
   5: range[i++].climb();
   6: } catch(ArrayIndexOutOfBoundsException e) {
   7: }

我真正要说明的是Q上面说的原则很对,但是走到极端׃对了。有的hZ 不用exception控制E序flow, 写一大堆的if…else语句试图考虑各种情况Q正好前不久有同事说了个W话Q我觉得可以辅助解释q个问题?/p>

=============================

某日,老师在课堂上惌考学生们的智?问一个男?#8220;树上有十只鸟,开枪打M?q剩几只?”

男孩反问“是无声手枪,q是其他没有声音的枪?”

“不是?#8221;

“枪声有多?”

“80~100分贝?#8221;

“那就是说会震的x?”

“是?#8221;

“在这个城市里打鸟犯不犯法?”

“不犯?#8221;

“您确定那只鸟真的被打d?”

“定.”老师已经不耐烦?”拜托,你告诉我q剩几只p?OK?”

“OK.鸟里有没有聋?”

“没有?#8221;

“有没有鸟智力有问题,呆傻到听到枪响不知道飞的Q?#8221;

“没有Q智商都?00以上Q?#8221;

“有没有关在笼子里?”

“没有?#8221;

。。?

==============================

后面q有一?#8220;例外”情况。我们写E序M能真写成

if(鸟是聋子)

else if(鸟是d)

else if(鸟是瘸子)

原则应该是,如果一些情늡实是 “例外情况”Q就用exception处理吧。不要很勤奋地写一堆defensive的判断。我们不会有故事里的男孩儿思维那么滴水不漏的。别把JavaE序退回c语言了。另一个例子是FileNotFoundException, java I/O没有让你每次用文仉提前调用exists()查一下,我想原因不光?查文件的那一毫秒文g存在QrunC一步的时候,下一毫秒文g消失了,Sun没觉得你人品那么坏吧。理念仍然是Q如果你觉得文g肯定存在Q你q接用吧,一旦不存在Q你再另外当成异常情况处理。不要让一堆if…else弄脏了程序?

 

3. exception有个典型用法是在Ҏ体中Q进行参数合法性校?

 

   1: public BigInteger mod(BigInteger m) {
   2: if (m.signum() <= 0)
   3: throw new ArithmeticException("Modulus <= 0: " + m);
   4: ... // Do the computation
   5: }

也有很多人用assert语句判断Q?比如 Assert.notNull(object)。手动抛exception可以抛特定的cdQassert语句更方ѝ可以根据实际情况取舍?/p>

 

4. 既然上面说了checked exception本n是java设计不太合理的地斏V我們֐于说Q应?strong>及时把checked exception translate成unchecked. 我知道exception的处理原则有一条是Q如果你不知道怎么处理它,׃要捕捉它?对于checked exception来说Q它总force你去处理Q太讨厌了。如果caller不知道怎么处理Q留着l更上层的程序处?#8230;底层的程序都不会处理Q一般来说上层的E序更不知道该怎么处理了,那还不如在尽量底层的调用中,要么处理它(q种情况很少Q打log之类的算不上“处理”Q,要么p{成RuntimeException抛上? 消灭掉checked exception带来的burden. 注意Qtranslate exception的过E中Q不要扔了原来的exception, 而要把它攑֜exception constructor的argument? new RuntimeException(e)。这是很基本的东西,不多说?/p>

 

5. 不要吞exception. q个太基Q不多说?/p>

 

6. 见到exception要把它记log里,而不是简单print stack一下,log4j的api有可以接受Throwable作ؓ参数的?

 

7. 每层抛出来的exception要对当前q一层有意义Q比如persistence层出问题QUI上你告诉客户hibernate的session关闭了,不能l箋load数据了,客户q以Z的程序怎么跟狗熊一栯会冬眠的。即使是UI层以下,底层exception,比如sql exception也不要爬到domain层里处理

 

8. apache commons的lang包里有ExceptionUtilsc,玩儿exception最好把q个工具揣口袋里?br />
9.exception是设计的一部分, 但它不同于API的设计。通常我们设计API的时候,不会设计一个函数destroyBaghdad()Q通常我们会写destroyCity(Baghdad)。这样做的目的是Z重用。换句话_你设计API的时候,L装作忘了use caseQcallerQ? 而去写适合复用的API, 管上面的例子use case是destroy Baghdad, 你还是要写更general的destroyCity函数Q然后把城市的名字作为参Cq去.但exception的设计不应该用同L思\做,因ؓ你很难料惛_复用的情况下Q你声明的exception是不是总能在Q何情况下都得到妥善的处理。D个例子,q是我时想的例子,形象但是U技太超前了。我们写一个print()E序l打印机AQprint()的时候没有纸可以抛一个checked NoPaperExceptionQ这时候exceptino的处理程序可以自动加载纸Q目前这么高U的功能正在贝尔实验室研发呢Q。也许有新型的打印机BL先加U,后打华ͼ那么永远也不存在NoPaperException。如果打印机是老式打印机CQ不会自动加载纸Q见到NoPaterException也无计可施,没法处理。checked exception的哲学是Q强制让caller处理它。从上面的例子看Q只有A打印?strong>需要ƈ能够
处理NoPaperException?B打印Z需要处理exception。C打印机没能力处理exception. 所以,|“需要ƈ能够”处理是个太严格的限制Q一般情况下不应该用checked exception. 我们可以让print声明抛出unchecked exception. 提醒caller可以处理它,但是对于不应该处理它的caller也不强制d理它?/p>

人在江湖 2011-02-22 00:12 发表评论
]]>
ȝjava的interface和abstract classhttp://www.aygfsteel.com/vcycyv/archive/2011/02/20/344716.html人在江湖人在江湖Sun, 20 Feb 2011 14:06:00 GMThttp://www.aygfsteel.com/vcycyv/archive/2011/02/20/344716.htmlhttp://www.aygfsteel.com/vcycyv/comments/344716.htmlhttp://www.aygfsteel.com/vcycyv/archive/2011/02/20/344716.html#Feedback1http://www.aygfsteel.com/vcycyv/comments/commentRss/344716.htmlhttp://www.aygfsteel.com/vcycyv/services/trackbacks/344716.html先说说interface和abstract method语法中需要注意的地方?/p>

Interface:

1. An interface can contain fields, but these are implicitly static and final.

2. You can choose to explicitly declare the methods in an interface as public, but they are public even if you don’t say it.

3. Interface cannot define static method

 

Abstract:

1. 一个类中如果所有的Ҏ都有实现Q我们仍然可以定义这个类为abstract class

2. abstract和static不能攑֜一起定义方法?/p>

 

Interface和Abstract class的实?/p>

1. interface适合定义mixinsQ不知道mixin怎么译Q它指窄接口Q只定义specific contractQ?

java不能多重l承。如果想辑ֈ多重l承的效果,需要借助“多重实现”interface. interface的一个典型用法是定义接口。比如Comparable。这样它的实现成本比较小Q一个class比较Ҏmixin多个interface?/p>

2. 如果interface不是mixin, 而是大一点的接口?/p>

effective java, 2nd edition有精彩的阐述Q对于大接口Q我们往往使用skeletal implementation class. 举个例子Q?/p>

   1: // Concrete implementation built atop skeletal implementation
   2: static List<Integer> intArrayAsList(final int[] a) {
   3: if (a == null)
   4: throw new NullPointerException();
   5: return new AbstractList<Integer>() {
   6: public Integer get(int i) {
   7: return a[i];  // Autoboxing (Item 5)
   8: }
   9: @Override public Integer set(int i, Integer val) {
  10: int oldVal = a[i];
  11: a[i] = val;     // Auto-unboxing
  12: return oldVal;  // Autoboxing
  13: }
  14: public int size() {
  15: return a.length;
  16: }
  17: };
  18: }

new AbstractList<Integer>是在应用Skeletal implementation. 有两个好处:

a) 它实现接口更方便了

b) If, in a subsequent release, you want to add a new method to an abstract class, you can always add a concrete method containing a reasonable default implementation. All existing implementations of the abstract class will then provide the new method. This does not work for interfaces.

跟interface相关的还有一个话题是wrapper classQ也很精彩,它是把承{成合成的方式Q应用了decorater模式的思想. 在书里的W?6章介l?/p>

   1: // Wrapper class - uses composition in place of inheritance
   2: public class InstrumentedSet<E> extends ForwardingSet<E> {
   3:     private int addCount = 0;
   4:     public InstrumentedSet(Set<E> s) {
   5:         super(s);
   6:     }
   7:     @Override public boolean add(E e) {
   8:         addCount++;
   9:         return super.add(e);
  10:     }
  11:     @Override public boolean addAll(Collection<? extends E> c) {
  12:         addCount += c.size();
  13:         return super.addAll(c);
  14:     }
  15:     public int getAddCount() {
  16:         return addCount;
  17:     }
  18: }
  19: // Reusable forwarding class
  20: public class ForwardingSet<E> implements Set<E> {
  21:     private final Set<E> s;
  22:     public ForwardingSet(Set<E> s) { this.s = s; }
  23:     public void clear()               { s.clear();            }
  24:     public boolean contains(Object o) { return s.contains(o); }
  25:     public boolean isEmpty()          { return s.isEmpty();   }
  26:     public int size()                 { return s.size();      }
  27:     public Iterator<E> iterator()     { return s.iterator();  }
  28:     public boolean add(E e)           { return s.add(e);      }
  29:     public boolean remove(Object o)   { return s.remove(o);   }
  30:     public boolean containsAll(Collection<?> c)
  31:                                    { return s.containsAll(c); }
  32:     public boolean addAll(Collection<? extends E> c)
  33:                                    { return s.addAll(c);      }
  34:     public boolean removeAll(Collection<?> c)
  35:                                    { return s.removeAll(c);   }
  36:     public boolean retainAll(Collection<?> c)
  37:                                    { return s.retainAll(c);   }
  38:     public Object[] toArray()          { return s.toArray();  }
  39:     public <T> T[] toArray(T[] a)      { return s.toArray(a); }
  40:     @Override public boolean equals(Object o)
  41:                                        { return s.equals(o);  }
  42:     @Override public int hashCode()    { return s.hashCode(); }
  43:     @Override public String toString() { return s.toString(); }
  44: }

使用它的客户端程序:

   1: Set<Date> s = new InstrumentedSet<Date>(new TreeSet<Date>(cmp));
   2: Set<E> s2 = new InstrumentedSet<E>(new HashSet<E>(capacity));

 

3. Zh都说 面向接口~程Q很多时候矫枉过正了Q?搞得接口漫天飞。interface常常是重构出来的Q而不L设计出来的。程序分层中Q越是靠q底层的E序Q越們֐于需要接口,靠q顶层的E序Q对接口的需求們֐于越。如果你明知道以后不太可能提供另一套实玎ͼ提前写个接口摆那里也没啥意义Q尽定义接口的成本很低。如果你担心一旦有一天确实提供了另一套实玎ͼ重构code也不会很ȝ。只要遵守了单一职责原则和_c特法则。_c特法则的一U表q方式是Qtalk only to your immediate friends?/p>

人在江湖 2011-02-20 22:06 发表评论
]]>
利用jetty实现轻量web开?/title><link>http://www.aygfsteel.com/vcycyv/archive/2011/02/13/344214.html</link><dc:creator>人在江湖</dc:creator><author>人在江湖</author><pubDate>Sun, 13 Feb 2011 14:40:00 GMT</pubDate><guid>http://www.aygfsteel.com/vcycyv/archive/2011/02/13/344214.html</guid><wfw:comment>http://www.aygfsteel.com/vcycyv/comments/344214.html</wfw:comment><comments>http://www.aygfsteel.com/vcycyv/archive/2011/02/13/344214.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.aygfsteel.com/vcycyv/comments/commentRss/344214.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/vcycyv/services/trackbacks/344214.html</trackback:ping><description><![CDATA[<p>几年前,如果你不用EJBQ很多h都用IDE+tomcat插g做web开发?现在来多Z用jetty了。这不是单地用Jetty替换tomcatQy妙的地方在于我们可以直接用main函数在IDE里启动Jetty. q样Q你不需要配|IDE的server。不同于IDE+tomcat插g的方式需要两个project,web app和server project. 使用下面介绍的方式你只有一个java projectp. 开发环境更单,debug也更方便Q不需要remote debug的方式,jetty非常快,可以明显提高开发效率?/p> <p>参考了|上的一些文章,整理了一下。本文以Eclipse作ؓIDE。最后有可以q行的示例代码下载,非常单?/p> <p>1. 建立Java project(不必是dynamic web project), 取个名字Q比如jetty</p> <p>2. 建立jetty目录及其子目录如图所C?所有文仉可以在最后的附g里找到。略作一点说明:webdefault.xml通常不需要你攏V它是web.xml之外的一个配|文Ӟ配置一些公共属性。web app的文Ӟjsp之类的都攑֜web目录下。web.xml和index.jsp都是CZ性质最单的。lib目录下需要放一些jetty的jar包,也一样在附g里有</p> <p> <a href="http://www.aygfsteel.com/images/blogjava_net/vcycyv/WindowsLiveWriter/jettyweb_13ECB/image_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.aygfsteel.com/images/blogjava_net/vcycyv/WindowsLiveWriter/jettyweb_13ECB/image_thumb.png" width="283" height="435"></a> </p> <p>3. 新徏java文g如下Q(注意q里我用的端口是8020Q以免和其他jboss或tomcat冲突Q?/p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1"> 1:</span> <span style="color: #0000ff">package</span> jetty;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2"> 2:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3"> 3:</span> <span style="color: #0000ff">import</span> org.mortbay.jetty.Connector;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4"> 4:</span> <span style="color: #0000ff">import</span> org.mortbay.jetty.Server;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5"> 5:</span> <span style="color: #0000ff">import</span> org.mortbay.jetty.nio.SelectChannelConnector;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6"> 6:</span> <span style="color: #0000ff">import</span> org.mortbay.jetty.webapp.WebAppContext;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7"> 7:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8"> 8:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> OneWebApp</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9"> 9:</span> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10"> 10:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> main(String[] args) <span style="color: #0000ff">throws</span> Exception</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11"> 11:</span> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12"> 12:</span> String jetty_home = <span style="color: #006080">"jetty"</span>;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13"> 13:</span> <span style="color: #0000ff">int</span> port = 8020;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14"> 14:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15"> 15:</span> Server server = <span style="color: #0000ff">new</span> Server();</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16"> 16:</span> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17"> 17:</span> Connector connector=<span style="color: #0000ff">new</span> SelectChannelConnector();</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18"> 18:</span> connector.setPort(port);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19"> 19:</span> server.addConnector(connector);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20"> 20:</span> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21"> 21:</span> WebAppContext webapp = <span style="color: #0000ff">new</span> WebAppContext(jetty_home + <span style="color: #006080">"/web"</span>, <span style="color: #006080">"/jetty"</span>);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22"> 22:</span> webapp.setDefaultsDescriptor(jetty_home+<span style="color: #006080">"/etc/webdefault.xml"</span>);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23"> 23:</span> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24"> 24:</span> server.setHandler(webapp);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25"> 25:</span> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26"> 26:</span> server.start();</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27"> 27:</span> <span style="color: #008000">//server.join();</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28"> 28:</span> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29"> 29:</span> }</pre><!--CRLF--></div></div> <p>可以runq个java文gQ然后在览器里讉K<a href="http://localhost:8020/jetty">http://localhost:8020/jetty</a>看结果?/p> <p> </p> <p>整个eclipse工程可以从这里下载:<a title="http://cid-d8b11f9bf86fecfa.office.live.com/self.aspx/.Public/code/RunJettyInEclipse.rar" >http://cid-d8b11f9bf86fecfa.office.live.com/self.aspx/.Public/code/RunJettyInEclipse.rar</a></p> <img src ="http://www.aygfsteel.com/vcycyv/aggbug/344214.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/vcycyv/" target="_blank">人在江湖</a> 2011-02-13 22:40 <a href="http://www.aygfsteel.com/vcycyv/archive/2011/02/13/344214.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jvm ?profilerhttp://www.aygfsteel.com/vcycyv/archive/2011/01/30/343782.html人在江湖人在江湖Sun, 30 Jan 2011 10:12:00 GMThttp://www.aygfsteel.com/vcycyv/archive/2011/01/30/343782.htmlhttp://www.aygfsteel.com/vcycyv/comments/343782.htmlhttp://www.aygfsteel.com/vcycyv/archive/2011/01/30/343782.html#Feedback0http://www.aygfsteel.com/vcycyv/comments/commentRss/343782.htmlhttp://www.aygfsteel.com/vcycyv/services/trackbacks/343782.htmlq轻代:

    所有新生成的对象首先都是放在年M的。年M的目标就是尽可能快速的攉掉那些生命周期短的对象。年M分三个区。一个Eden区,两个 Survivor?一般而言)。大部分对象在EdenZ生成。当Eden区满Ӟq存zȝ对象被复制到Survivor区(两个中的一个)Q当q个 Survivor区满Ӟ此区的存zd象将被复制到另外一个Survivor区,当这个SurvivorM满了的时候,从第一个Survivor区复?q来的ƈ且此时还存活的对象,被复制“q老区(Tenured)”。需要注意,Survivor的两个区是对U的Q没先后关系Q所以同一个区中可能同?存在从Eden复制q来 对象Q和从前一个Survivor复制q来的对象,而复制到q老区的只有从W一个Survivor去过来的对象。而且QSurvivor区L一个是I?的。同ӞҎE序需要,Survivor区是可以配置为多个的Q多于两个)Q这样可以增加对象在q轻代中的存在时_减少被放到年老代的可能?/p>

q老代Q?/strong>

    在年M中经历了Nơ垃圑֛收后仍然存活的对象,׃被放到年老代中。因此,可以认ؓq老代中存攄都是一些生命周期较长的对象?/p>

持久代:

    用于存放静态文Ӟ如今JavacR方法等。持久代对垃圑֛收没有显著媄响,但是有些应用可能动态生成或者调用一些classQ例如Hibernate {,在这U时候需要设|一个比较大的持久代I间来存放这些运行过E中新增的类。持久代大小通过-XX:MaxPermSize=<N>q行?|?/p>

什么情况下触发垃圾回收

׃对象q行了分代处理,因此垃圾回收区域、时间也不一栗GC有两U类型:Scavenge GC ?strong>Full GC ?/p>

Scavenge GC

      一般情况下Q当新对象生成,q且在Eden甌I间p|Ӟ׃触发Scavenge GCQ对Eden区域q行GCQ清除非存活对象Qƈ且把且存活的对象移动到Survivor区。然后整理Survivor的两个区。这U方式的GC是对 q轻代的Eden行,不会影响到年老代。因为大部分对象都是从Eden区开始的Q同时EdenZ会分配的很大Q所以Eden区的GC会频J进行。因 而,一般在q里需要用速度快、效率高的算法,使Eden去能快I闲出来?/p>

Full GC

      Ҏ个堆q行整理Q包括Young、Tenured和Perm。Full GC因ؓ需要对整个对进行回Ӟ所以比Scavenge GC要慢Q因此应该尽可能减少Full GC的次数。在对JVM调优的过E中Q很大一部分工作是对于FullGC的调节。有如下原因可能DFull GCQ?/p>

      q老代QTenuredQ被写满

      持久代(PermQ被写满

      System.gc()被显C?/p>

     上一ơGC之后Heap的各域分配策略动态变?/p>

串行处理器:

--适用情况Q数据量比较(100M左右Q;单处理器下ƈ且对响应旉无要求的应用?
--~点Q只能用于小型应?/p>

q行处理器:

--适用情况Q?#8220;对吞吐量有高要求”Q多CPU、对应用响应旉无要求的中、大型应用。D例:后台处理、科学计?
--~点Q垃圾收集过E中应用响应旉可能加长

q发处理器:

--适用情况Q?#8220;对响应时间有高要?#8221;Q多CPU、对应用响应旉有较高要求的中、大型应用。D例:Web服务?应用服务器、电信交换、集成开发环境?/p>

===================================

今天使用jmap和jhat试图解决permgen out of memory的问题,扑ֈ了一个很好的文章Q?/p>

http://blogs.sun.com/fkieviet/entry/how_to_fix_the_dreaded

贴个开_防止原帖丢了Q连google的线索都没有

How to fix the dreaded "java.lang.OutOfMemoryError: PermGen space" exception (classloader leaks)

In the previous blog entry Classloader leaks: the dreaded "java.lang.OutOfMemoryError: PermGen space" exception  I explained how this type of problem can originate in the application code that you deploy to an application server.  In this post I'll explain how to track down the leak so that you can fix it.

Profilers
Memory leak? Use a profiler. Right? Well... generally speaking the answer is yes, but classloader leaks are a bit special...



人在江湖 2011-01-30 18:12 发表评论
]]>
java weak referenceQ{Q?/title><link>http://www.aygfsteel.com/vcycyv/archive/2011/01/30/343781.html</link><dc:creator>人在江湖</dc:creator><author>人在江湖</author><pubDate>Sun, 30 Jan 2011 10:11:00 GMT</pubDate><guid>http://www.aygfsteel.com/vcycyv/archive/2011/01/30/343781.html</guid><wfw:comment>http://www.aygfsteel.com/vcycyv/comments/343781.html</wfw:comment><comments>http://www.aygfsteel.com/vcycyv/archive/2011/01/30/343781.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/vcycyv/comments/commentRss/343781.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/vcycyv/services/trackbacks/343781.html</trackback:ping><description><![CDATA[<p>转蝲自: <a title="http://www.java-tips.org/java-se-tips/java.util/using-weakhashmap-for-listener-lists.html" >http://www.java-tips.org/java-se-tips/java.util/using-weakhashmap-for-listener-lists.html</a></p> <p>In the Java platform, there are four types of references to objects. Direct references are the type you normally use, as in:</p> <p><code>Object obj = <strong>new </strong>Object()</code></p> <p>You can think of direct references as strong references that require no extra coding to create or access the object. The remaining three types of references are subclasses of the <code>Reference</code> class found in the <code>java.lang.ref</code> package. Soft references are provided by the <code>SoftReference</code> class, weak references by the <code>WeakReference</code> class, and phantom references by <code>PhantomReference</code>.</p> <p>  <br>Soft references act like a data cache. When system memory is low, the garbage collector can arbitrarily free an object whose only reference is a soft reference. In other words, if there are no strong references to an object, that object is a candidate for release. The garbage collector is required to release any soft references before throwing an <code>OutOfMemoryException</code>. </p> <p><br>Weak references are weaker than soft references. If the only references to an object are weak references, the garbage collector can reclaim the memory used by an object at any time. There is no requirement for a low memory situation. Typically, memory used by the object is reclaimed in the next pass of the garbage collector. </p> <p><br>Phantom references relate to cleanup tasks. They offer a notification immediately before the garbage collector performs the finalization process and frees an object. Consider it a way to do cleanup tasks within an object. </p> <img src ="http://www.aygfsteel.com/vcycyv/aggbug/343781.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/vcycyv/" target="_blank">人在江湖</a> 2011-01-30 18:11 <a href="http://www.aygfsteel.com/vcycyv/archive/2011/01/30/343781.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java父线E子U程Q{Q?/title><link>http://www.aygfsteel.com/vcycyv/archive/2011/01/30/343779.html</link><dc:creator>人在江湖</dc:creator><author>人在江湖</author><pubDate>Sun, 30 Jan 2011 10:06:00 GMT</pubDate><guid>http://www.aygfsteel.com/vcycyv/archive/2011/01/30/343779.html</guid><wfw:comment>http://www.aygfsteel.com/vcycyv/comments/343779.html</wfw:comment><comments>http://www.aygfsteel.com/vcycyv/archive/2011/01/30/343779.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/vcycyv/comments/commentRss/343779.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/vcycyv/services/trackbacks/343779.html</trackback:ping><description><![CDATA[<p>问:在父U程中New了一个子U程Q想在停止父U程时也停止子线E,应该怎么做?</p> <p>{:</p> <p>从某U程度上Ԍ做不到?nbsp;  </p> <p>  不管是父U程q是子线E,q只不过是在q行时谁Z谁时用的Q一旦所谓的字线E被启动Q这两个U程是没有先后贵贱区分的?nbsp;  </p> <p>  MU程是没有办法把另外一个线E终止的?nbsp;  </p> <p>  如果你一定想你说的那hU的话,下面是唯一个可行方案。在"父线E?建立“子线E?#8221;Ӟ?#8220;父线E?#8221;的instance传过去,?#8220;子线E?#8221;里,不停的check"父线E?是否q存z,如果否,停止?nbsp;  </p> <p>  相反的,如果"父线E?需要在"子线E?l了时结束,?父线E?建立“子线E?#8221;Ӟ留住“子线E?#8221;的instance然后keep   checking   whether   it's   still   alive.</p> <p>================================================================================</p> <p>只有在所有非守护q程都停止的情况下,jvm才退出。mainU程停止jvm也不一定退出:</p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1"> 1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> TestMitiThread {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2"> 2:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3"> 3:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> main(String[] rags) {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4"> 4:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5"> 5:</span> System.out.println(Thread.currentThread().getName() + <span style="color: #006080">" U程q行开?"</span>);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6"> 6:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7"> 7:</span> <span style="color: #0000ff">new</span> MitiSay(<span style="color: #006080">"A"</span>).start();</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8"> 8:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9"> 9:</span> <span style="color: #0000ff">new</span> MitiSay(<span style="color: #006080">"B"</span>).start();</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10"> 10:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11"> 11:</span> System.out.println(Thread.currentThread().getName() + <span style="color: #006080">" U程q行l束!"</span>);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12"> 12:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13"> 13:</span> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14"> 14:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15"> 15:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16"> 16:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17"> 17:</span> class MitiSay <span style="color: #0000ff">extends</span> Thread {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18"> 18:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19"> 19:</span> <span style="color: #0000ff">public</span> MitiSay(String threadName) {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20"> 20:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21"> 21:</span> <span style="color: #0000ff">super</span>(threadName);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22"> 22:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23"> 23:</span> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24"> 24:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25"> 25:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> run() {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26"> 26:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27"> 27:</span> System.out.println(getName() + <span style="color: #006080">" U程q行开?"</span>);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28"> 28:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29"> 29:</span> <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i < 10; i++) {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30"> 30:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31"> 31:</span> System.out.println(i + <span style="color: #006080">" "</span> + getName());</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32"> 32:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33"> 33:</span> <span style="color: #0000ff">try</span> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34"> 34:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35"> 35:</span> sleep((<span style="color: #0000ff">int</span>) Math.random() * 10);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36"> 36:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37"> 37:</span> } <span style="color: #0000ff">catch</span> (InterruptedException e) {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38"> 38:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum39"> 39:</span> e.printStackTrace();</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum40"> 40:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum41"> 41:</span> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum42"> 42:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum43"> 43:</span> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum44"> 44:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum45"> 45:</span> System.out.println(getName() + <span style="color: #006080">" U程q行l束!"</span>);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum46"> 46:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum47"> 47:</span> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum48"> 48:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum49"> 49:</span>  </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum50"> 50:</span>  </pre><!--CRLF--></div></div> <p>q行l果Q?/p> <p>main U程q行开?</p> <p>main U程q行l束!</p> <p>A U程q行开?</p> <p>0 A</p> <p>1 A</p> <p>B U程q行开?</p> <p>2 A</p> <p>0 B</p> <p>3 A</p> <p>4 A</p> <p>1 B</p> <p>5 A</p> <p>6 A</p> <p>7 A</p> <p>8 A</p> <p>9 A</p> <p>A U程q行l束!</p> <p>2 B</p> <p>3 B</p> <p>4 B</p> <p>5 B</p> <p>6 B</p> <p>7 B</p> <p>8 B</p> <p>9 B</p> <p>B U程q行l束!</p> <img src ="http://www.aygfsteel.com/vcycyv/aggbug/343779.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/vcycyv/" target="_blank">人在江湖</a> 2011-01-30 18:06 <a href="http://www.aygfsteel.com/vcycyv/archive/2011/01/30/343779.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank">ɿ</a>| <a href="http://" target="_blank">¹</a>| <a href="http://" target="_blank">Ľ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank">¡</a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">կ</a>| <a href="http://" target="_blank">ൺ</a>| <a href="http://" target="_blank">Է</a>| <a href="http://" target="_blank">˾</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">½</a>| <a href="http://" target="_blank">ɳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˼</a>| <a href="http://" target="_blank">Ϫ</a>| <a href="http://" target="_blank">п</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ڰ</a>| <a href="http://" target="_blank">԰</a>| <a href="http://" target="_blank">³ľ</a>| <a href="http://" target="_blank">¬</a>| <a href="http://" target="_blank">ն</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">¦</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">⴨</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ʡ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>