java verboseÃüÁî
java -verbose[:class|gc|jni] ÔÚÊä³öÉ豸ÉÏÏÔʾÐéÄâ»úÔËÐÐÐÅÏ¢¡£
1.java -verbose:class
ÔÚ³ÌÐòÔËÐеÄʱºò¾¿¾¹»áÓжàÉÙÀà±»¼ÓÔØÄØ£¬Ò»¸ö¼òµ¥³ÌÐò»á¼ÓÔØÉÏ°Ù¸öÀàµÄ£¡Äã¿ÉÒÔÓÃverbose:classÀ´¼àÊÓ£¬ÔÚÃüÁîÐÐÊäÈëjava -verbose:class XXX (XXXΪ³ÌÐòÃû)Äã»áÔÚ¿ØÖÆ̨¿´µ½¼ÓÔصÄÀàµÄÇé¿ö¡£
verboseºÍverbose:classº¬ÒåÏàͬ£¬Êä³öÐéÄâ»ú×°ÈëµÄÀàµÄÐÅÏ¢£¬ÏÔʾµÄÐÅÏ¢¸ñʽÈçÏ£º [Loaded java.io.FilePermission$1 from shared objects file] µ±ÐéÄâ»ú±¨¸æÀàÕÒ²»µ½»òÀà³åͻʱ¿ÉÓô˲ÎÊýÀ´Õï¶ÏÀ´²é¿´ÐéÄâ»ú´Ó×°ÈëÀàµÄÇé¿ö¡£
2.java –verbose:gc
ÔÚÐéÄâ»ú·¢ÉúÄÚ´æ»ØÊÕʱÔÚÊä³öÉ豸ÏÔʾÐÅÏ¢£¬¸ñʽÈçÏ£º [Full GC 268K->168K(1984K), 0.0187390 secs] ¸Ã²ÎÊýÓÃÀ´¼àÊÓÐéÄâ»úÄÚ´æ»ØÊÕµÄÇé¿ö¡£
01 public class TestGC{¡¡
02
03 public static void main(String[] args)¡¡{¡¡¡¡
04
05 TestGC test = new TestGC();¡¡¡¡
06
07 System.gc();¡¡
08
09 }
10
11 }
ÔÚÕâ¸öÀý×ÓÖУ¬Ò»¸öеĶÔÏó±»´´½¨£¬ÓÉÓÚËüûÓÐʹÓã¬ËùÒԸöÔÏóѸËٵرäΪ¿É´ï£¬³ÌÐò±àÒëºó£¬Ö´ÐÐÃüÁ java -verbose:gc TestGC ºó½á¹ûΪ£º
[Full GC 168K->97K(1984K)£¬ 0.0253873 secs]
»úÆ÷µÄ»·¾³Îª£¬Windows 2000 + JDK1.3.1£¬¼ýÍ·Ç°ºóµÄÊý¾Ý168KºÍ97K·Ö±ð±íʾÀ¬»øÊÕ¼¯GCÇ°ºóËùÓдæ»î¶ÔÏóʹÓõÄÄÚ´æÈÝÁ¿£¬ËµÃ÷ÓÐ168K-97K=71KµÄ¶ÔÏóÈÝÁ¿±»»ØÊÕ£¬À¨ºÅÄÚµÄÊý¾Ý1984KΪ¶ÑÄÚ´æµÄ×ÜÈÝÁ¿£¬ÊÕ¼¯ËùÐèÒªµÄʱ¼äÊÇ0.0253873Ã루Õâ¸öʱ¼äÔÚÿ´ÎÖ´ÐеÄʱºò»áÓÐËù²»Í¬£©¡£
3.java –verbose:jni
-verbose:jniÊä³önative·½·¨µ÷ÓõÄÏà¹ØÇé¿ö£¬Ò»°ãÓÃÓÚÕï¶Ïjniµ÷ÓôíÎóÐÅÏ¢¡£
ÔÚÐéÄâ»úµ÷ÓÃnative·½·¨Ê±Êä³öÉ豸ÏÔʾÐÅÏ¢£¬¸ñʽÈçÏ£º [Dynamic-linking native method HelloNative.sum ... JNI] ¸Ã²ÎÊýÓÃÀ´¼àÊÓÐéÄâ»úµ÷Óñ¾µØ·½·¨µÄÇé¿ö£¬ÔÚ·¢Éújni´íÎóʱ¿ÉΪÕï¶ÏÌṩ±ãÀû¡£
Ïà¹ØÎĵµ£º
ÒÔÏÂÊǶÔJAVAÒì³£µÄ¼Ì³Ð»úÖƵÄһЩ×ܽᡣ
1. RuntimeExceptionÓëException, Error²»Í¬µã£º µ±·½·¨ÌåÖÐÅ׳ö·ÇRuntimeException£¨¼°Æä×ÓÀࣩʱ£¬·½·¨Ãû±ØÐëÉùÃ÷Å׳öµÄÒì³££»µ«Êǵ±·½·¨ÌåÖÐÅ׳öRuntimeException£¨°üÀ¨RuntimeException×ÓÀࣩʱ£¬·½·¨Ãû²»±ØÉùÃ÷¸Ã¿ÉÄܱ»Å׳öµÄÒì³££¬¼´Ê¹ÉùÃ÷ÁË£¬JAVA³ÌÐòÔÚij¸öµ÷Óõĵط½£¬Ò² ......
Ä¿Ç°ÍøÂçÉϹØÓÚ¶ÔÏóÐòÁл¯µÄÎÄÕ²»ÉÙ£¬µ«ÊÇÎÒ·¢ÏÖÏêϸÐðÊöÓ÷¨ºÍÔÀíµÄÎÄÕÂÌ«ÉÙ¡£±¾ÈË°Ñ×Ô¼º¾¹ý¾Ñé×ܽáºÍʵ¼ÊÔËÓÃÖеÄÌå»áд³ÉµÄѧϰ±Ê¼Ç¹±Ï׸ø´ó¼Ò¡£Ï£ÍûÄÜΪÕû¸öjavaÉçÇøµÄ·±ÈÙ×öÒ»µãÊÂÇé¡£
¡¡¡¡ÐòÁл¯µÄ¹ý³Ì¾ÍÊǶÔÏóдÈë×Ö½ÚÁ÷ºÍ´Ó×Ö½ÚÁ÷ÖжÁÈ¡¶ÔÏó¡£½«¶ÔÏó״̬ת»»³É×Ö½ÚÁ÷Ö®ºó£¬¿ÉÒÔÓÃjava.io°üÖеĸ÷ÖÖ×Ö½ÚÁ÷Àà½«Æ ......
1.Proxy
ģʽ
´úÀíģʽ֧³Ö½«Ä³Ð©²Ù×÷´Óʵ¼ÊµÄ¶ÔÏóÖзÖÀë³öÀ´£¬Í¨¹ýËüµÄ´úÀíÀàÌṩ´¦Àí¡£ÕâÑù±ãÓÚÐ޸ĺ͹ÜÀíÕâЩÌض¨µÄ²Ù×÷¡£
ÏÂÃæʾÀýÒ»¸ö´úÀíģʽµÄʵÏÖ¡£
<<interface>>Subject.java
package
com.zj.proxy;
public
interface
Subject {
void
operation1();
......
Éè¼Æģʽ
Ò»¸ö³ÌÐòÔ±¶ÔÉè¼ÆģʽµÄÀí½â:
“²»¶®”ΪʲôҪ°ÑºÜ¼òµ¥µÄ¶«Î÷¸ãµÃÄÇô¸´ÔÓ¡£ºóÀ´Ëæ×ÅÈí¼þ¿ª·¢¾ÑéµÄÔö¼Ó²Å¿ªÊ¼Ã÷°×ÎÒËù¿´µ½µÄ“¸´ÔӔǡǡ¾ÍÊÇÉè¼ÆģʽµÄ¾«ËèËùÔÚ£¬ÎÒËùÀí½âµÄ“¼òµ¥”¾ÍÊÇÒ»°ÑÔ¿³×¿ªÒ»°ÑËøµÄģʽ£¬Ä¿µÄ½ö½öÊÇ×ÅÑÛÓÚ½â¾öÏÖÔÚµÄÎÊÌ⣬¶øÉè¼ÆģʽµÄ“¸´ÔÓ&rdq ......
±¾ÎÄÊ×ÏÈÉè¼ÆÒ»¸öµ¥´Î¶¨Ê±Æ÷Timer+TimerTask£¬È»ºóÔٴλù´¡ÉÏÉè¼ÆÒ»¸öÑ»·¶¨Ê±Æ÷¡£
ÎÒ½«°Ñ java.util.Timer ºÍ java.util.TimerTask ͳ³ÆΪ Java ¼ÆʱÆ÷¿ò¼Ü£¬ËüÃÇʹ³ÌÐòÔ±¿ÉÒÔºÜÈÝÒ׵ؼƻ®¼òµ¥µÄÈÎÎñ£¨×¢ÒâÕâЩÀàÒ²¿ÉÓÃÓÚ J2ME ÖУ©¡£²»¹ý£¬Java ¼ÆʱÆ÷¿ò¼ÜûÓÐ× ......