Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JAVAÏ̳߳صÄʹÓÃ

Ï̳߳ØÀàΪ java.util.concurrent.ThreadPoolExecutor£¬³£Óù¹Ôì·½·¨Îª£º ThreadPoolExecutor(int corePoolSize, int maximumPoolSize,
long keepAliveTime, TimeUnit unit,
BlockingQueue<Runnable> workQueue,
RejectedExecutionHandler handler) corePoolSize£º Ï̳߳Øά»¤Ï̵߳Ä×îÉÙÊýÁ¿
maximumPoolSize£ºÏ̳߳Øά»¤Ï̵߳Ä×î´óÊýÁ¿
keepAliveTime£º Ï̳߳Øά»¤Ïß³ÌËùÔÊÐíµÄ¿ÕÏÐʱ¼ä
unit£º Ï̳߳Øά»¤Ïß³ÌËùÔÊÐíµÄ¿ÕÏÐʱ¼äµÄµ¥Î»
workQueue£º Ï̳߳ØËùʹÓõĻº³å¶ÓÁÐ
handler£º Ï̳߳ضԾܾøÈÎÎñµÄ´¦Àí²ßÂÔ Ò»¸öÈÎÎñͨ¹ý execute(Runnable)·½·¨±»Ìí¼Óµ½Ï̳߳أ¬ÈÎÎñ¾ÍÊÇÒ»¸ö RunnableÀàÐ͵ĶÔÏó£¬ÈÎÎñµÄÖ´Ðз½·¨¾ÍÊÇ RunnableÀàÐͶÔÏóµÄrun()·½·¨¡£ µ±Ò»¸öÈÎÎñͨ¹ýexecute(Runnable)·½·¨ÓûÌí¼Óµ½Ï̳߳Øʱ£º Èç¹û´ËʱÏ̳߳ØÖеÄÊýÁ¿Ð¡ÓÚcorePoolSize£¬¼´Ê¹Ï̳߳ØÖеÄÏ̶߳¼´¦ÓÚ¿ÕÏÐ״̬£¬Ò²Òª´´½¨ÐµÄÏß³ÌÀ´´¦Àí±»Ìí¼ÓµÄÈÎÎñ¡£ Èç¹û´ËʱÏ̳߳ØÖеÄÊýÁ¿µÈÓÚ corePoolSize£¬µ«ÊÇ»º³å¶ÓÁÐ workQueueδÂú£¬ÄÇôÈÎÎñ±»·ÅÈ뻺³å¶ÓÁС£ Èç¹û´ËʱÏ̳߳ØÖеÄÊýÁ¿´óÓÚcorePoolSize£¬»º³å¶ÓÁÐworkQueueÂú£¬²¢ÇÒÏ̳߳ØÖеÄÊýÁ¿Ð¡ÓÚmaximumPoolSize£¬½¨ÐµÄÏß³ÌÀ´´¦Àí±»Ìí¼ÓµÄÈÎÎñ¡£ Èç¹û´ËʱÏ̳߳ØÖеÄÊýÁ¿´óÓÚcorePoolSize£¬»º³å¶ÓÁÐworkQueueÂú£¬²¢ÇÒÏ̳߳ØÖеÄÊýÁ¿µÈÓÚmaximumPoolSize£¬ÄÇôͨ¹ý handlerËùÖ¸¶¨µÄ²ßÂÔÀ´´¦Àí´ËÈÎÎñ¡£ Ò²¾ÍÊÇ£º´¦ÀíÈÎÎñµÄÓÅÏȼ¶Îª£º
ºËÐÄÏß³ÌcorePoolSize¡¢ÈÎÎñ¶ÓÁÐworkQueue¡¢×î´óÏß³ÌmaximumPoolSize£¬Èç¹ûÈýÕ߶¼ÂúÁË£¬Ê¹ÓÃhandler´¦Àí±»¾Ü¾øµÄÈÎÎñ¡£ µ±Ï̳߳ØÖеÄÏß³ÌÊýÁ¿´óÓÚ corePoolSizeʱ£¬Èç¹ûijÏ߳̿ÕÏÐʱ¼ä³¬¹ýkeepAliveTime£¬Ï߳̽«±»ÖÕÖ¹¡£ÕâÑù£¬Ï̳߳ؿÉÒÔ¶¯Ì¬µÄµ÷Õû³ØÖеÄÏß³ÌÊý¡£ (Ö®ËùÒÔÒªÓÐÒ»¶Î¿ÕÏÐʱ¼ä£¬ÊÇΪÁËÔÙ´ÎÓÐÈÎÎñ¿ÉÒÔ½ÚÊ¡´´½¨Ï̵߳ĿªÏú) unit¿ÉÑ¡µÄ²ÎÊýΪjava.util.concurrent.TimeUnitÖеļ¸¸ö¾²Ì¬ÊôÐÔ£º
NANOSECONDS¡¢MICROSECONDS¡¢MILLISECONDS¡¢SECONDS¡£ workQueueÎÒ³£ÓõÄÊÇ£ºjava.util.concurrent.ArrayBlockingQueue handlerÓÐËĸöÑ¡Ôñ£º
ThreadPoolExecutor.AbortPolicy()
Å׳öjava.util.concurrent.RejectedExecutionExceptionÒì³£
ThreadPoolExecutor.CallerRunsPolicy()
ÖØÊÔÌí¼Óµ±Ç°µÄÈÎÎñ£¬Ëû»á×Ô¶¯Öظ´µ÷ÓÃexecute()·½·¨
ThreadPoolExecut


Ïà¹ØÎĵµ£º

Java¶àÏ̱߳à³ÌÏê½â

Ò»¡¢Àí½â¶àÏß³Ì
    ¶àÏß³ÌÊÇÕâÑùÒ»ÖÖ»úÖÆ£¬ËüÔÊÐíÔÚ³ÌÐòÖв¢·¢Ö´Ðжà¸öÖ¸ÁîÁ÷£¬Ã¿¸öÖ¸ÁîÁ÷¶¼³ÆΪһ¸öỊ̈߳¬±Ë´Ë¼ä»¥Ïà¶ÀÁ¢¡£Ïß³ÌÓÖ³ÆΪÇáÁ¿¼¶½ø³Ì£¬ËüºÍ½ø³ÌÒ»ÑùÓµÓжÀÁ¢µÄÖ´ÐпØÖÆ£¬ÓɲÙ×÷ϵͳ¸ºÔðµ÷¶È£¬Çø±ðÔÚÓÚÏß³ÌûÓжÀÁ¢µÄ´æ´¢¿Õ¼ä£¬¶øÊǺÍËùÊô½ø³ÌÖеÄÆäËüÏ̹߳²ÏíÒ»¸ö´æ´¢¿Õ¼ä£¬ÕâʹµÃÏ̼߳äµÄͨ ......

Java»·¾³±äÁ¿ÉèÖÃ

Ò»¡¢ÈçºÎ°²×°JDK£¿   
    µ±ÎÒÃÇ´ÓÍøÂçÉÏDOWNÏÂJ2SE 5.0 JDKÒÔºó£¨ÊÇÒ»¸ö¿ÉÖ´ÐÐÎļþ£¬ÎļþÃû½Ð×öjdk-1_5_0-windows-i586.exe£¬µ±È»Õâ¸öÃû×Ö»áÒòΪ¶ÔÓ¦²Ù×÷ϵͳµÄ²»Í¬¶øÓÐËùÇø±ðµÄ£¬ÎÒʹÓõIJÙ×÷ϵͳ¾ÍÊÇWINDOWS£¬´ó¼Ò·¢ÏÖÁËÂ𣿣©£¬Ë«»÷Ëû¾Í¿ªÊ¼°²×°ÁË¡£ÐèҪעÒâµÄ¾ÍÊÇÑ¡Ôñ°²×°Â·¾¶µÄÎÊÌâ ......

java IO

1.InputStreamºÍOutputStreamÊÇÓÃÓÚ¶Á»òдµ¥¸ö×Ö½Ú»òÕß×Ö½ÚÊý×飬ÎÒÃǺÜÉÙÓõ½ËüÃǵķ½·¨£¬ËüÃÇÖ®ËùÒÔ´æÔÚÊÇÒòΪ±ðµÄÀà¿ÉÒÔʹÓÃËüÃÇ£¬ÒÔ±ãÌṩ¸üÓÐÓõĽӿڡ£Òò´Ë£¬ÎÒÃǺÜÉÙʹÓõ¥Ò»µÄÀàÀ´´´½¨Á÷¶ÔÏ󣬶øÊÇͨ¹ýµþºÏ¶à¸ö¶ÔÏóÀ´ÌṩËùÆÚÍûµÄ¹¦ÄÜ¡£
2.FilterInputStreamºÍFilterOutputStreamÊÇÓÃÀ´ÌṩװÊÎÆ÷Àà½Ó¿ÚÒÔ¿ØÖÆÌض¨ ......

Java ³£¼ûÉè¼Æģʽ

³£ÓõÄÉè¼Æģʽ·ÖΪÈçÏ 23 ÖÖģʽ£º
Abstract Factory£º
Ìṩһ¸ö´´½¨Ò»ÏµÁÐÏà¹Ø»òÏ໥ÒÀÀµ¶ÔÏóµÄ½Ó¿Ú£¬¶øÎÞÐèÖ¸¶¨Ëü
ÃǾßÌåµÄÀà¡£
Adapter£º
½«Ò»¸öÀàµÄ½Ó¿Úת»»³É¿Í»§Ï£ÍûµÄÁíÒ»¸ö½Ó¿Ú£¬Ê¹µÃÔ­À´ÓÉÓÚ½Ó¿Ú²»¼æÈݶø²»ÄÜÒ»Æð¹¤×÷µÄÄÇЩÀà¿ÉÒÔÒ»Æð¹¤×÷¡£
Bridge£º
½«
³éÏ󲿷ÖÓëËüµÄʵÏÖ²¿·Ö·ÖÀ룬ʹ֮¿ÉÒÔ¶ÀÁ¢±ä»¯¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ