Java synchronized
ÖÚËùÖÜÖª£¬ÔÚJava¶àÏ̱߳à³ÌÖУ¬Ò»¸ö·Ç³£ÖØÒªµÄ·½Ãæ¾ÍÊÇÏ̵߳Äͬ²½ÎÊÌâ¡£
¹ØÓÚÏ̵߳Äͬ²½£¬Ò»°ãÓÐÒÔϽâ¾ö·½·¨£º
1.
ÔÚÐèҪͬ²½µÄ·½·¨µÄ·½·¨Ç©ÃûÖмÓÈësynchronized¹Ø¼ü×Ö¡£
2.
ʹÓÃsynchronized¿é¶ÔÐèÒª½øÐÐͬ²½µÄ´úÂë¶Î½øÐÐͬ²½¡£
3. ʹÓÃJDK
5ÖÐÌṩµÄjava.util.concurrent.lock°üÖеÄLock¶ÔÏó¡£
ÁíÍ⣬ΪÁ˽â¾ö¶à¸öÏ̶߳Ôͬһ±äÁ¿½øÐзÃÎÊʱ¿ÉÄÜ·¢ÉúµÄ°²È«ÐÔÎÊÌ⣬ÎÒÃDz»½ö¿ÉÒÔ²ÉÓÃͬ²½»úÖÆ£¬¸ü¿ÉÒÔͨ¹ýJDK
1.2ÖмÓÈëµÄThreadLocalÀ´±£Ö¤¸üºÃµÄ²¢·¢ÐÔ¡£
±¾ÆªÖУ¬½«ÏêϸµÄÌÖÂÛJava¶àÏß³Ìͬ²½»úÖÆ£¬²¢¶ÔThreadLocal×ö³ö̽ÌÖ¡£
´óÖµÄĿ¼½á¹¹ÈçÏ£º
Ò»¡¢Ï̵߳ÄÏÈÀ´ºóµ½——ÎÊÌâµÄÌá³ö£ºÎªÊ²Ã´ÒªÓжàÏß³Ìͬ²½£¿Java¶àÏß³Ìͬ²½µÄ»úÖÆÊÇʲô£¿
¶þ¡¢¸øÎÒÒ»°ÑËø£¬ÎÒÄÜ´´ÔìÒ»¸ö¹æ¾Ø——´«Í³µÄ¶àÏß³Ìͬ²½±à³Ì·½·¨ÓÐÄÄЩ£¿ËûÃÇÓкÎÒìͬ£¿
Èý¡¢LockÀ´ÁË£¬´ó¼Ò¶¼Èÿª——
Java²¢·¢¿ò¼ÜÖеÄLockÏê½â¡£
ËÄ¡¢ÄãÓÐÎÒÓÐÈ«¶¼ÓЗ— ThreadLocalÈçºÎ½â¾ö²¢·¢°²È«ÐÔ£¿
Îå¡¢×ܽᗗJavaḬ̈߳²È«µÄ¼¸ÖÖ·½·¨¶Ô±È¡£
Ò»¡¢Ï̵߳ÄÏÈÀ´ºóµ½
ÎÒÃÇÀ´¾ÙÒ»¸öDirtyµÄÀý×Ó£ºÄ³²ÍÌüµÄÎÀÉú¼äºÜС£¬¼¸ºõÖ»ÄÜÈÝÄÉÒ»¸öÈËÈç²Þ¡£ÎªÁ˱£Ö¤²»ÊܸÉÈÅ£¬Èç²ÞµÄÈ˽øÈëÎÀÉú¼ä£¬¾ÍÒªËøÉÏ·¿ÃÅ¡£ÎÒÃÇ¿ÉÒÔ°ÑÎÀÉú¼äÏë
Ïó³ÉÊǹ²ÏíµÄ×ÊÔ´£¬¶øÖÚ¶àÐèÒªÈç²ÞµÄÈË¿ÉÒÔ±»ÊÓ×÷¶à¸öÏ̡߳£¼ÙÈçÎÀÉú¼äµ±Ç°ÓÐÈËÕ¼Óã¬ÄÇôÆäËûÈ˱ØÐëµÈ´ý£¬Ö±µ½Õâ¸öÈËÈç²ÞÍê±Ï£¬´ò¿ª·¿ÃÅ×ß³öÀ´ÎªÖ¹¡£Õâ¾Í
ºÃ±È¶à¸öÏ̹߳²ÏíÒ»¸ö×ÊÔ´µÄʱºò£¬ÊÇÒ»¶¨Òª·Ö³öÏÈÀ´ºóµ½µÄ¡£
ÓÐÈË˵£ºÄÇÈç¹ûÎÒûÓÐÕâµÀÃÅ»áÔõÑùÄØ£¿ÈÃÁ½¸öÏß³ÌÏ໥¾ºÕù£¬ËÇÀÏÈÁË£¬Ë¾Í¿ÉÒÔÏȸɻÕâÑù¶àºÃ°¢£¿µ«ÊÇÎÒÃÇÖªµÀ£ºÈç¹û²ÞËùûÓÐÃŵĻ°£¬Èç²ÞµÄÈËÒ»ÆðÓ¿Ïò
²ÞËù£¬ÄÇô±ØÈ»»á·¢ÉúÕùÖ´£¬Õý³£µÄÈç²Þ²½Öè¾Í»á±»´òÂÒ£¬ºÜÓпÉÄܻᷢÉúÒâÏë²»µ½µÄ½á¹û£¬ÀýÈçijЩÈË¿ÉÄÜÖ»ºÃ±»ÆÈÔÚ²»ÕýÈ·µÄµØ·½Ê©·Ê……
ÕýÊÇÒòΪÓÐÕâµÀÃÅ£¬ÈκÎÒ»¸öµ¥¶À½øÈëÈç²ÞµÄÈ˶¼¿ÉÒÔ˳ÀûµÄÍê³ÉËûÃǵÄÈç²Þ¹ý³Ì£¬¶ø²»»á±»¸ÉÈÅ£¬ÉõÖÁ·¢ÉúÒÔÍâµÄ½á¹û¡£Õâ¾ÍÊÇ˵£¬Èç²ÞµÄʱºòÒª½²¾¿ÏÈÀ´ºóµ½¡£
ÄÇôÔÚJava
¶àÏ̳߳ÌÐòµ±ÖУ¬µ±¶à¸öÏ߳̾ºÕùͬһ¸ö×ÊÔ´µÄʱºò£¬ÈçºÎÄܹ»±£Ö¤ËûÃDz»»á²úÉú“´ò¼Ü”µÄÇé¿öÄØ£¿ÓÐÈË˵ÊÇʹÓÃͬ²½»úÖÆ¡£Ã»´í£¬ÏñÉÏÃæÕâ¸öÀý×Ó£¬¾ÍÊǵäÐ͵Ä
ͬ²½°¸Àý£¬Ò»µ©µÚһλ¿ªÊ¼Èç²Þ£¬ÔòµÚ¶þλ±ØÐëµÈ´ý
Ïà¹ØÎĵµ£º
¶àÏ̵߳Äͬ²½ÒÀ¿¿µÄÊǶÔÏóËø»úÖÆ£¬synchronized¹Ø¼ü×ֵı³ºó¾ÍÊÇÀûÓÃÁË·âËøÀ´ÊµÏÖ¶Ô¹²Ïí×ÊÔ´µÄ»¥³â·ÃÎÊ¡£
ÏÂÃæÒÔÒ»¸ö¼òµ¥µÄʵÀýÀ´½øÐжԱȷÖÎö¡£ÊµÀýÒªÍê³ÉµÄ¹¤×÷·Ç³£¼òµ¥£¬¾ÍÊÇ´´½¨10¸öỊ̈߳¬Ã¿¸öÏ̶߳¼´òÓ¡´Ó0µ½99Õâ100¸öÊý×Ö£¬ÎÒÃÇÏ£ÍûÏß³ÌÖ®¼ä²»»á³öÏÖ½»²æÂÒÐò´òÓ¡£¬¶øÊÇ˳ÐòµØ´òÓ¡¡£
ÏÈÀ´¿´µÚÒ»¶Î´úÂ룬ÕâÀïÎÒÃÇÔÚru ......
java¶ÁÈ¡mp3Îļþ ÊÕ²Ø
JMFʵ¼ÊÉÏÊÇJavaµÄÒ»¸öÀà°ü¡£JMF 2.1.1¼¼ÊõÌṩÁËÏȽøµÄýÌå´¦ÀíÄÜÁ¦£¬´Ó¶øÀ©Õ¹ÁËJavaƽ̨µÄ¹¦ÄÜ¡£ÕâЩ¹¦ÄÜ°üÀ¨£ºÃ½Ì岶»ñ¡¢Ñ¹Ëõ¡¢Á÷ת¡¢»Ø·Å£¬ÒÔ¼°¶Ô¸÷ÖÖÖ÷ҪýÌåÐÎʽºÍ±àÂëµÄÖ§³Ö£¬ÈçM-JPEG¡¢H.263¡¢MP3¡¢RTP/RTSP (ʵʱ´«ËÍÐÒéºÍʵʱÁ÷תÐÒé)¡¢Macromedias Flash¡¢IBMµÄHotMediaºÍBeatniksµÄRi ......
ÄÜͨ¹ýJavaÀ´²Ù×÷Word»òÕßExcelµÄapi£¬¾ÝÎÒËùÖªµÄÓÐÕâЩ£¬¶¼¿¼²ìÁËһϣ¬¿ªÔ´µÄ³ýÁËOpenofficeºÍofficewriter¶ÔWordµÄ±í¸ñÓкõÄÖ§³ÖÍ⣬ÆäËû¶¼ºÜ²»×¨Òµ£¬»òÕß²»Ö§³Ö¡£
jacob http://sourceforge.net/projects/jacob-project/
JACOB is a JAVA-COM Bridge that allows you to call COM Automation components from Java. ......
package com.sj.main;
public class Snippet {
public static void main(String[] args){
//Õâ¸öÀàÖ÷ÒªÊÇÉèÖÃÓʼþ
MailSenderInfo mailInfo = new MailSenderInfo();
String biaoti ="ÎÒÊÇËÕ½¨£¬ÕâÊÇÎҵIJâÊÔÓʼþ";
String neirong = "ÎÒÊÇËÕ½¨ÒÔÏÂÊÇÎҵIJâÊÔÓʼþ£¬»¶Ó´ó¼Ò½ ......
Date ---->String
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.fomat(new Date());
String ---->Date
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse("2010-03-16");
ÈÕÆڱȽϴóС£¬Õâ¾ÍÓõ½ÁËDateÀàÖеÄbefore()ºÍafter()·½· ......