Java ÖеÄÄÚ²¿¾²Ì¬Àà
Java ÖÐÄÚ²¿¶¯Ì¬Àà(ûÓÐstatic)¹Ø¼ü×ÖºÍÄÚ²¿¾²Ì¬ÀàµÄ¾ÍÔÚÓÚÄÚ²¿¶¯Ì¬À಻Äܶ¨Ò徲̬±äÁ¿»òÊǾ²Ì¬·½·¨,Èç¹ûÒªÔÚÄÚ²¿ÀàÖÐʹÓþ²Ì¬³ÉÔ±,±ØÐ뽫ÀàÉùÃ÷Ϊ¾²Ì¬Àà. ÄÚ²¿ÀàÖеľ²Ì¬·½·¨¿ÉÒÔ·ÃÎÊÍⲿÀàµÄ¾²Ì¬·½·¨ºÍ±¾ÀàÖеľ²Ì¬·½·¨»ò³ÉÔ±, ·Ç¾²Ì¬·½·¨¿ÉÒÔ·ÃÎÊÆäËûËùÓеķ½·¨»ò³ÉÔ±
Ïà¹ØÎĵµ£º
ʲôÊÇÁ÷£º
Á÷ÊÇÒ»¸ö³éÏóµÄ¸ÅÄî¡£µ±Java³ÌÐòÐèÒª´ÓÊý¾ÝÔ´¶ÁÈ¡Êý¾Ýʱ£¬»á¿ªÆôÒ»¸öµ½Êý¾ÝÔ´µÄÁ÷¡£Êý¾ÝÔ´¿ÉÒÔÊÇÎļþ£¬ÄÚ´æ»òÕßÍøÂçµÈ¡£Í¬Ñù£¬µ±³ÌÐòÐèÒªÊä³öÊý¾Ýµ½Ä¿µÄµØʱҲһÑù»á¿ªÆôÒ»¸öÁ÷£¬Êý¾ÝÄ¿µÄµØÒ²¿ÉÒÔÊÇÎļþ¡¢ÄÚ´æ»òÕßÍøÂçµÈ¡£Á÷µÄ´´½¨ÊÇΪÁ˸ü·½±ãµØ´¦ÀíÊý¾ÝµÄÊäÈëÊä³ö¡£
Á÷·ÖΪ×Ö½ÚÁ÷ºÍ×Ö·ûÁ÷¡£×Ö½ÚÁ÷Ò²³ÆΪÔÊ ......
ºÜ¶àÅóÓÑÔÚJava¿ª·¢ÖУ¬Ê¹ÓÃOracleÊý¾Ý¿âµÄʱºò£¬¾³£»áÅöµ½ÓÐORA-01000: maximum open cursors exceeded.µÄ´íÎó¡£
ʵ¼ÊÉÏ£¬Õâ¸ö´íÎóµÄÔÒò£¬Ö÷Òª»¹ÊÇ´úÂëÎÊÌâÒýÆðµÄ¡£
ora-01000: maximum open cursors exceeded.
±íʾÒѾ´ïµ½Ò»¸ö½ø³Ì´ò¿ªµÄ×î´óÓαêÊý¡£
ÕâÑùµÄ´íÎóºÜÈÝÒ׳öÏÖÔÚJava´úÂëÖеÄÖ÷ÒªÔÒòÊÇ£ºJava´úÂëÔÚÖ´ ......
1 Èç¹ûÒ»¿éÄÚ´æÇøÓòÄܹ»Öظ´ÀûÓã¬×îºÃ²»ÒªÉêÇëеġ£Õâ¸öÄÚ´æÇøÓòÓпÉÄÜÊÇϵͳµÄÒ»¸öÀ࣬×Ô¼ºµÄÒ»¸öÄÚ²¿ÓÐÊý×éÔªËØ£¬»òÕßÄܹ»·Å´óÁ¿Êý¾ÝµÄ½á¹¹¡£
2 ×îºÃ²»ÒªÔÚÑ»·ÀïÃæÉêÇëÄڴ棬ѻ·Ô½´ó£¬Ô½»µÊ¡£»»¾ä»°Ëµ£¬ÉêÇëÄÚ´æƵÂʱðÌ«¸ß¡£ºÃ±ÈÒ»¸öÈËÿ¶Ù³ÔÁ½Íë·¹ÕýºÃ£¬ÉíÌåµÄÏû»¯ÏµÍ³¿ÉÒÔ³ÐÊÜ£¬Èç¹ûÈÃËûÒ»¶Ù°ÑÊ®¶ÙµÄ¶¼³Ôµô£¬²»ÕÍ ......
1)¾²Ì¬±äÁ¿±¾Éí²»»á±»»ØÊÕ
2)¾²Ì¬±äÁ¿ËùÒýÓõĶÔÏóÊÇ¿ÉÒÔ»ØÊյġ£
µÚÒ»µã´ó¼ÒÓ¦¸ÃûÓÐÒÉÎÊ£¬ÏÂÃæÎÒÖ¤Ã÷µÚ£²µã£º
¿´ÏÂÃæµÄÀý×Ó¼°×¢ÊÍ¡£×Ô¼º¿ÉÒÔÔËÐÐÊÔÒ»ÏÂ,¡¡×¢Òâ¼ÓÉÏ-verbose:gc²ÎÊý
java -verbose:gc TestStaticGc
// TestStaticGc.java
public class TestStaticGc {
& ......