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

java ÖÐµÄ synchronized

synchronized£º ͬ²½µÄ
synchronizedÔÚ²Ù×÷ÉÏÓÐÁ½ÖÖÓ°Ïì¶ÔÏóµÄÇé¿ö£º
1) ÔÚij¸ö¶ÔÏóʵÀýÄÚ£¬synchronized method(){}¿ÉÒÔ·ÀÖ¹¶à¸öÏß³Ìͬʱ·ÃÎÊÕâ¸ö¶ÔÏóµÄsynchronized·½·¨£¨Èç¹ûÒ»¸ö¶ÔÏóÓжà¸ösynchronized·½·¨£¬Ö»ÒªÒ»¸öÏ̷߳ÃÎÊÁËÆäÖеÄÒ»¸ösynchronized·½·¨£¬ÆäËüÏ̲߳»ÄÜͬʱ·ÃÎÊÕâ¸ö¶ÔÏóÖÐÈκÎÒ»¸ösynchronized·½·¨£©¡£Õâʱ£¬²»Í¬µÄ¶ÔÏóʵÀýµÄsynchronized·½·¨ÊDz»Ïà¸ÉÈŵġ£Ò²¾ÍÊÇ˵£¬ÆäËüÏß³ÌÕÕÑù¿ÉÒÔͬʱ·ÃÎÊÏàͬÀàµÄÁíÒ»¸ö¶ÔÏóʵÀýÖеÄsynchronized·½·¨£»
2) ÔÚij¸öÀàµÄ·¶Î§£¬synchronized static aStaticMethod{}·ÀÖ¹¶à¸öÏß³Ìͬʱ·ÃÎÊÕâ¸öÀàÖеÄsynchronized static ·½·¨¡£Ëü¿ÉÒÔ¶ÔÀàµÄËùÓжÔÏóʵÀýÆð×÷Óá£
³ýÁË·½·¨Ç°ÓÃsynchronized¹Ø¼ü×Ö£¬synchronized¹Ø¼ü×Ö»¹¿ÉÒÔÓÃÓÚ·½·¨ÖеÄij¸öÇø¿éÖУ¬±íʾֻ¶ÔÕâ¸öÇø¿éµÄ×ÊԴʵÐл¥³â·ÃÎÊ¡£Ó÷¨ÊÇ: synchronized(this){/*Çø¿é*/}£¬ËüµÄ×÷ÓÃÓòÊǵ±Ç°¶ÔÏó£»
synchronized¹Ø¼ü×ÖÊDz»Äܼ̳еģ¬Ò²¾ÍÊÇ˵£¬»ùÀàµÄ·½·¨synchronized method(){} Ôڼ̳ÐÀàÖв¢²»×Ô¶¯ÊÇsynchronized method(){}£¬¶øÊDZä³ÉÁËmethod(){}¡£¼Ì³ÐÀàÐèÒªÄãÏÔʽµÄÖ¸¶¨ËüµÄij¸ö·½·¨Îªsynchronized·½·¨£»
ÎÞÂÛsynchronized¹Ø¼ü×Ö¼ÓÔÚ·½·¨ÉÏ»¹ÊǶÔÏóÉÏ£¬ËûÈ¡µÃµÄËø¶¼ÊǶÔÏóËø£¬¶ø²»ÊÇ°ÑÒ»¶Î´úÂë»òº¯ÊýËø¶¨£¬²»Äܱ»±ðµÄ¶ÔÏó·ÃÎÊ£¬Í¬Ò»¸öÀàÖеÄͬһ¸ö·½·¨»áÔÚ¸ÃÀàµÄ²»Í¬¶ÔÏóÉϱ»ÆäËûÏ̵߳ĶÔÏó·ÃÎÊ¡£
ÿ¸ö¶ÔÏóÖ»ÓÐÒ»°ÑËø£¨lock£©ºÍËüÏà¹ØÁª¡£
ʵÏÖͬ²½ÊÇÒªºÜ´óµÄϵͳ¿ªÏú×÷Ϊ´ú¼ÛµÄ£¬ÉõÖÁ¿ÉÄÜÔì³ÉËÀËø£¬ËùÒÔ¾¡Á¿±ÜÃâÎÞνµÄͬ²½¿ØÖÆ¡£
µ«µ±Ã»ÓÐÃ÷È·µÄ¶ÔÏóÐèÒªËø¶¨£¬Ö»ÊÇÏëÈÃÒ»¶Î´úÂëͬ²½Ê±£¬Äܹ»´´½¨Ò»¸öÌرðµÄinstance±äÁ¿£¨ËûµÃÊǸö¶ÔÏó£©À´³äµ±Ëø£º
class Foo implements Runnable {
       private byte[] lock = new byte[0];  // ÌرðµÄinstance±äÁ¿
       Public void method() {
           synchronized(lock) { //… }
       }
       //…
}
Á㳤¶ÈµÄbyteÊý×é¶ÔÏó´´½¨ÆðÀ´½«±ÈÈκζÔÏ󶼾­¼Ã£¬±àÒëºóµÄ×Ö½ÚÂ룺Éú³ÉÁ㳤¶ÈµÄbyte[]¶ÔÏóÖ»Ðè3Ìõ²Ù×÷Â룬¶øObject lock = new Object()ÔòÐèÒª7ÐвÙ×÷Âë¡£
class Foo {
    public void method() { 
    &


Ïà¹ØÎĵµ£º

JavaỊ̈߳º²¢·¢Ð­×÷ ËÀËø

JavaỊ̈߳º²¢·¢Ð­×÷-ËÀËø
 
Ï̷߳¢ÉúËÀËø¿ÉÄÜÐÔºÜС£¬¼´Ê¹¿´ËÆ¿ÉÄÜ·¢ÉúËÀËøµÄ´úÂ룬ÔÚÔËÐÐʱ·¢ÉúËÀËøµÄ¿ÉÄÜÐÔÒ²ÊÇС֮ÓÖС¡£
 
·¢ÉúËÀËøµÄÔ­ÒòÒ»°ãÊÇÁ½¸ö¶ÔÏóµÄËøÏ໥µÈ´ýÔì³ÉµÄ¡£
 
ÔÚ¡¶JavaỊ̈߳ºÏ̵߳Äͬ²½ÓëËø¡·Ò»ÎÄÖУ¬¼òÊöËÀËøµÄ¸ÅÄîÓë¼òµ¥Àý×Ó£¬µ«ÊÇËù¸øµÄÀý×ÓÊDz»ÍêÕûµÄ£¬ÕâÀï¸ø³öÒ»¸öÍêÕûµÄÀ ......

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

JavaỊ̈߳ºÐÂÌØÕ÷-×èÈûÕ»
 
¶ÔÓÚ×èÈûÕ»£¬Óë×èÈû¶ÓÁÐÏàËÆ¡£²»Í¬µãÔÚÓÚÕ»ÊÇ“ºóÈëÏȳö”µÄ½á¹¹£¬Ã¿´Î²Ù×÷µÄÊÇÕ»¶¥£¬¶ø¶ÓÁÐÊÇ“ÏȽøÏȳö”µÄ½á¹¹£¬Ã¿´Î²Ù×÷µÄÊǶÓÁÐÍ·¡£
 
ÕâÀïÒªÌرð˵Ã÷Ò»µãµÄÊÇ£¬×èÈûÕ»ÊÇJava6µÄÐÂÌØÕ÷¡£¡¢
 
JavaΪ×èÈûÕ»¶¨ÒåÁ˽ӿڣºjava.util.concurrent.Block ......

JavaỊ̈߳ºÐÂÌØÕ÷ ÕÏ°­Æ÷

JavaỊ̈߳ºÐÂÌØÕ÷-ÕÏ°­Æ÷
 
Java5ÖУ¬Ìí¼ÓÁËÕÏ°­Æ÷À࣬ΪÁËÊÊÓ¦Ò»ÖÖеÄÉè¼ÆÐèÇ󣬱ÈÈçÒ»¸ö´óÐ͵ÄÈÎÎñ£¬³£³£ÐèÒª·ÖÅäºÃ¶à×ÓÈÎÎñÈ¥Ö´ÐУ¬Ö»Óе±ËùÓÐ×ÓÈÎÎñ¶¼Ö´ÐÐÍê³Éʱºò£¬²ÅÄÜÖ´ÐÐÖ÷ÈÎÎñ£¬Õâʱºò£¬¾Í¿ÉÒÔÑ¡ÔñÕÏ°­Æ÷ÁË¡£
 
ÕÏ°­Æ÷ÊǶàÏ̲߳¢·¢¿ØÖƵÄÒ»ÖÖÊֶΣ¬Ó÷¨ºÜ¼òµ¥¡£ÏÂÃæ¸ø¸öÀý×Ó£º
 
import jav ......

java ÊÓƵ´¦Àí ffmpeg+mencoder

java ÊÓƵ´¦Àí ffmped+mencoder
תÔØ×Ô http://huqilong.blog.51cto.com/53638/136985
 
ffmpeg+mencoder¼¸ºõ¿ÉÒÔÍê³ÉÄ¿Ç°»ùÓÚwebµÄ²¥¿Íƽ̨ÈκÎÒôÊÓƵ´¦ÀíµÄ²Ù×÷.Èç¹û»¹ÐèÒªÌí¼ÓһЩʲôµÄ»°,ÄÇô¾ÍÊÇÊÓƵÔÚÏß¼Öƹ¦ÄÜÁË,Õâ¸öÒ²¿ÉÒÔÓÃffmpeg+fmsÀ´Íê³É,Òò´ËÒ»°ãµÄÀàËÆÓÚYouTubeµÄһЩ¿É¼û¹¦Äܶ¼¿ÉÒÔÔÚffmpeg+menco ......

JAVAÀà·¾¶

Java Àà·¾¶
Java Àà·¾¶¸æËß java ½âÊÍÆ÷ºÍ javac ±àÒëÆ÷È¥ÄÄÀïÕÒËüÃÇÒªÖ´Ðлòµ¼ÈëµÄÀà¡£ÀࣨÄú¿ÉÄÜ×¢Òâµ½µÄÄÇЩ *.class Îļþ£©¿ÉÒÔ´æ´¢ÔÚĿ¼»ò jar ÎļþÖУ¬»òÕß´æ´¢ÔÚÁ½ÕßµÄ×éºÏÖУ¬µ«ÊÇÖ»ÓÐÔÚËüÃÇλÓÚÀà·¾¶ÖеÄij¸öµØ·½Ê±£¬Java ±àÒëÆ÷»ò½âÊÍÆ÷²Å¿ÉÒÔÕÒµ½ËüÃÇ¡£
ÔÚ Windows ÖУ¬Àà·¾¶ÖеĶà¸öÏîÊÇÓ÷ֺŷָô£¨ ;£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ