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

JavaỊ̈߳ºÐÂÌØÕ÷ ×èÈûÕ»

JavaỊ̈߳ºÐÂÌØÕ÷-×èÈûÕ»
 
¶ÔÓÚ×èÈûÕ»£¬Óë×èÈû¶ÓÁÐÏàËÆ¡£²»Í¬µãÔÚÓÚÕ»ÊÇ“ºóÈëÏȳö”µÄ½á¹¹£¬Ã¿´Î²Ù×÷µÄÊÇÕ»¶¥£¬¶ø¶ÓÁÐÊÇ“ÏȽøÏȳö”µÄ½á¹¹£¬Ã¿´Î²Ù×÷µÄÊǶÓÁÐÍ·¡£
 
ÕâÀïÒªÌرð˵Ã÷Ò»µãµÄÊÇ£¬×èÈûÕ»ÊÇJava6µÄÐÂÌØÕ÷¡£¡¢
 
JavaΪ×èÈûÕ»¶¨ÒåÁ˽ӿڣºjava.util.concurrent.BlockingDeque£¬ÆäʵÏÖÀàÒ²±È½Ï¶à£¬¾ßÌå¿ÉÒԲ鿴JavaAPIÎĵµ¡£
 
ÏÂÃæ¿´Ò»¸ö¼òµ¥Àý×Ó£º
 
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;
/**
* JavaỊ̈߳ºÐÂÌØÕ÷-×èÈûÕ»
*
* @author leizhimin 2009-11-5 15:34:29
*/
public class Test {
        public static void main(String[] args) throws InterruptedException {
                BlockingDeque bDeque = new LinkedBlockingDeque(20);
                for (int i = 0; i < 30; i++) {
                        //½«Ö¸¶¨ÔªËØÌí¼Óµ½´Ë×èÈûÕ»ÖУ¬Èç¹ûûÓпÉÓÿռ䣬½«Ò»Ö±µÈ´ý£¨Èç¹ûÓбØÒª£©¡£
                        bDeque.putFirst(i);
                        System.out.println("Ïò×èÈûÕ»ÖÐÌí¼ÓÁËÔªËØ:" + i);
                }
                System.out.println("³ÌÐòµ½´ËÔËÐнáÊø£¬¼´½«Í˳ö----");
        }
}
 
Êä³ö½á¹û£º
Ïò×èÈûÕ»ÖÐÌí¼ÓÁËÔªËØ:0
Ïò×èÈûÕ»ÖÐÌí¼ÓÁËÔªËØ:1
Ïò×èÈûÕ»ÖÐÌí¼ÓÁËÔªËØ:2
Ïò×èÈûÕ»ÖÐÌí¼ÓÁËÔªËØ


Ïà¹ØÎĵµ£º

JavaỊ̈߳ºÏß³Ì״̬µÄת»»

JavaỊ̈߳ºÏß³Ì״̬µÄת»»
 
SCJP5ѧϰ±Ê¼Ç
 
Ò»¡¢Ïß³Ì״̬
 
Ï̵߳Ä״̬ת»»ÊÇÏ߳̿ØÖƵĻù´¡¡£Ïß³Ì״̬×ܵĿɷÖΪÎå´ó״̬£º·Ö±ðÊÇÉú¡¢ËÀ¡¢¿ÉÔËÐС¢ÔËÐС¢µÈ´ý/×èÈû¡£ÓÃÒ»¸öͼÀ´ÃèÊöÈçÏ£º
 
1¡¢ÐÂ״̬£ºÏ̶߳ÔÏóÒѾ­´´½¨£¬»¹Ã»ÓÐÔÚÆäÉϵ÷ÓÃstart()·½·¨¡£
 
2¡¢¿ÉÔËÐÐ״̬£ºµ±Ïß³ÌÓÐ× ......

JavaỊ̈߳ºÏ̵߳Äͬ²½ ͬ²½·½·¨

JavaỊ̈߳ºÏ̵߳Äͬ²½-ͬ²½·½·¨
 
Ï̵߳Äͬ²½ÊDZ£Ö¤¶àḬ̈߳²È«·ÃÎʾºÕù×ÊÔ´µÄÒ»ÖÖÊֶΡ£
Ï̵߳Äͬ²½ÊÇJava¶àÏ̱߳à³ÌµÄÄѵ㣬ÍùÍù¿ª·¢Õ߸㲻Çå³þʲôÊǾºÕù×ÊÔ´¡¢Ê²Ã´Ê±ºòÐèÒª¿¼ÂÇͬ²½£¬Ôõôͬ²½µÈµÈÎÊÌ⣬µ±È»£¬ÕâЩÎÊÌâûÓкÜÃ÷È·µÄ´ð°¸£¬µ«ÓÐЩԭÔòÎÊÌâÐèÒª¿¼ÂÇ£¬ÊÇ·ñÓоºÕù×ÊÔ´±»Í¬Ê±¸Ä¶¯µÄÎÊÌ⣿
 
ÔÚ± ......

JavaỊ̈߳ºvolatile¹Ø¼ü×Ö

JavaỊ̈߳ºvolatile¹Ø¼ü×Ö
 
Java™ ÓïÑÔ°üº¬Á½ÖÖÄÚÔÚµÄͬ²½»úÖÆ£ºÍ¬²½¿é£¨»ò·½·¨£©ºÍ volatile ±äÁ¿¡£ÕâÁ½ÖÖ»úÖƵÄÌá³ö¶¼ÊÇΪÁËʵÏÖ´úÂëÏ̵߳ݲȫÐÔ¡£ÆäÖÐ Volatile ±äÁ¿µÄͬ²½ÐԽϲµ«ÓÐʱËü¸ü¼òµ¥²¢ÇÒ¿ªÏú¸üµÍ£©£¬¶øÇÒÆäʹÓÃÒ²¸üÈÝÒ׳ö´í¡£
 
̸¼°µ½volatile¹Ø¼ü×Ö£¬²»µÃ²»ÌáµÄһƪÎÄÕÂÊÇ£º¡¶Java ......

Eclipse Java×¢ÊÍÄ£°åÉèÖÃÏê½â


ÉèÖÃ×¢ÊÍÄ£°åµÄÈë¿Ú£º Window->Preference->Java->Code Style->Code Template È»ºóÕ¹¿ªComments½Úµã¾ÍÊÇËùÓÐÐèÉèÖÃ×¢Ê͵ÄÔªËØÀ²¡£ÏÖ¾Íÿһ¸öÔªËØÖðÒ»½éÉÜ£º
Îļþ(Files)×¢ÊͱêÇ©£º
/**   
* @Title: ${file_name}
* @Package ${package_name}
* @Description: ${todo}(ÓÃÒ»¾ä»°ÃèÊö¸ÃÎļ ......

JavaỊ̈߳ºÐÂÌØÕ÷ Ëø£¨ÉÏ£©

JavaỊ̈߳ºÐÂÌØÕ÷-Ëø£¨ÉÏ£©
 
ÔÚJava5ÖУ¬×¨ÃÅÌṩÁËËø¶ÔÏó£¬ÀûÓÃËø¿ÉÒÔ·½±ãµÄʵÏÖ×ÊÔ´µÄ·âËø£¬ÓÃÀ´¿ØÖƶԾºÕù×ÊÔ´²¢·¢·ÃÎʵĿØÖÆ£¬ÕâЩÄÚÈÝÖ÷Òª¼¯ÖÐÔÚjava.util.concurrent.locks °üÏÂÃ棬ÀïÃæÓÐÈý¸öÖØÒªµÄ½Ó¿ÚCondition¡¢Lock¡¢ReadWriteLock¡£
 
Condition
Condition ½« Object ¼àÊÓÆ÷·½·¨£¨wait¡¢notify ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ