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

java¸ß¼¶¶àÏ̱߳à³Ì ¹ØÓÚÏ̵߳ÄÍ£Ö¹ÎÊÌâ(ת)

¶àÏß³ÌÊÇjavaµÄÒ»¸öÓÅÊÆ£¬javaʹµÃ³ÌÐòÔ±¿ÉÒԺܷ½±ãµÄ½øÐжàÏ̳߳ÌÐò¿ª·¢¡£»ñµÃ¸üºÃµÄÐÔÄÜ¡£
¹ØÓÚ¶àÏ̵߳ĸÅÄîÒÔ¼°Ò»°ãµÄ¶àÏ̱߳à³Ì£¬±ÈÈçÈçºÎÒÔ¼°ÎªºÎʵÏÖrunnable½Ó¿Ú£¬ÎªºÎstop()»á±»DeprecatedµôµÈµÈ£¬Õâ¸öÇë¿´matrix֮ǰµÄ¶àÏ̱߳à³Ì»ù´¡»òÕßsunµÄjavaÎĵµ¡£
¹ØÓÚ¶àÏ̱߳à³Ì£¬Óм¸µãÕâÀïÒªÌáµ½µÄ£º
1¡£¼ÈÈ»stop()ÊDz»±»ÍƼöµÄ£¬ÄÇôÎÒÃÇÈçºÎÍ£Ö¹Ò»¸öÏß³ÌÄØ£¿Ö±½ÓkillÂð£¿ÔÚÕâÀ±ÊÕß×ܽáÒ»ÖֱȽÏͨÓÃÒ²±È½ÏÎȶ¨µÄ·½·¨£º
class threadtest extend Thread{
//skip some code..
boolean runflag=true;  
public synchronized void stopthread()
{
runflag=false;  
}
public synchronized boolean getrunflag()
{
return runflag;  
}  
public void run() {
runflag=true;
try {
while (getrunflag()) {
code1£»
code2£»  
//put your code here
}
}
}
catch (IOException e) {
e.printStackTrace();
}
System.out.println(this.getClass().getName()+" stopped");
}
//skip some code..
}  
ÕâÑù£¬Ã¿µ±ÐèҪֹͣ¸ÃÏß³Ìʱ£¬Ö»Ðèµ÷ÓÃstopthread()¼´¿É¡£
ÕâÀïÓÐÁ½µãÐèҪעÒ⣺
1£©ÎÒÃÇÓÃÁËÒ»¸öͬ²½·½·¨getrunflag()À´µÃµ½µ±Ç°µÄ״̬£¬ÎªÊ²Ã´ÓÃÕâ¸ö·½·¨¶ø²»ÊÇÖ±½ÓʹÓÃwhile(runflag)ÄØ£¿
Õâ¸öÊÇÒòΪÔÚjavaµÄ¶àÏß³ÌÄ£ÐÍÖУ¬ÓÐÒ»¸ö¹«¹²µÄ¶ÔÏó´æ´¢Çø£¬µ«ÊÇÿ¸ö¶ÔÏó¶¼ÓÐ×Ô¼ºµÄ˽Óб¸·Ý£¬µ±Ò»¸öÏ̸߳ıäÁË״̬£¬jvm²¢²»Äܱ£Ö¤Õâ¸öÏ̸߳ıä¹ýµÄ±äÁ¿¼´Ê±¸üй«¹²¶ÔÏó´æ´¢ÇøµÄ״̬£¬¿ÉÄÜ(¿ÉÄÜÐÔ²»´ó)Ôì³ÉÎÊÌâ¡£
ËùÒÔ½¨ÒéÓкõÄÉè¼ÆÏ°¹ß£¬²ÉÓÃͬ²½·½·¨À´»ñµÃµ±Ç°µÄrunflagÖµ¡£
2£©»¹ÓÐÒ»µã£¬ÌرðÊÇÉæ¼°ÍøÂçµÄ¶àỊ̈߳¬Èç¹û·¢ÉúÁËÍøÂç×èÈû(ÔÚwhileÑ­»·ÀïÃæ·¢Éú)£¬ÄÇô£¬¼´Ê¹runflag״̬±ÈÈç¸Ä±ä³Éfalse£¬ÓÉÓÚ³ÌÐò±»×èÈû£¬Ïß³ÌÓÃÕâÖÖ·½·¨ÊÇÓÀÔ¶¶¼²»»á±»Í£Ö¹µÄ¡£
¾Ù¸öÀý×Ó£º±ÈÈçÉÏÃæµÄ³ÌÐò£¬Èç¹ûcode1ÊÇÒ»¶ÎÍøÂç³Ìʽ£¬Èç¹ûÔÚcode1·¢ÉúÁË×èÈû£¬×èÈûµÄÒâÒå¾ÍÊǵò»µ½ÇëÇóµÄ
×ÊÔ´£¬ÔÚÎÞÏÞÆڵȴý£¬Õâ¸öʱºò£¬runflag״̬µÄ±ä»¯¶ÔwhileÑ­»·ÊÇÆð²»ÁË×÷Óõģ¬Ï̲߳»»á±»Í£Ö¹¡£
±ÊÕßÔø¾­²ÎÓë¶à¸öÉæ¼°µ½»ñÈ¡ÍøÂç×ÊÔ´µÄjava³Ìʽ£¬¾­³£Óöµ½ÒòΪÍøÂçµÄ×èÈûÒýÆðµÄÏß³ÌÎÊÌâ¡£
Èç¹ûÄãµÄ³Ìʽ¿ÉÄÜÉæ¼°µ½ÍøÂç×èÈû£¬»òÕßÓпÉÄÜ·¢ÉúijÖÖÏûÏ¢½ÓÊܵÄ×èÈû¡£ÄÇô£¬Çë²»ÒªÓÃÕâÖÖ·½·¨À´Í£Ö¹Ï̡߳£¾ßÌå·½·¨Çë¿´±ÊÕßÁíÍâһƬÎÄÕ£º¸ß¼¶¶àÏ̱߳


Ïà¹ØÎĵµ£º

javaµÄÊÂÎñ´¦Àí

Èç¹û¶ÔÊý¾Ý¿â½øÐжà´Î²Ù×÷,ÿһ´ÎµÄÖ´Ðлò²½Ö趼ÊÇÒ»¸öÊÂÎñ.Èç¹ûÊý¾Ý¿â²Ù×÷ÔÚijһ²½Ã»ÓÐÖ´Ðлò³öÏÖÒì³£¶øµ¼ÖÂÊÂÎñʧ°Ü,ÕâÑùÓеÄÊÂÎñ±»Ö´ÐÐÓеľÍûÓб»Ö´ÐÐ,´Ó¶ø¾ÍÓÐÁËÊÂÎñµÄ»Ø¹ö,È¡ÏûÏÈÇ°µÄ²Ù×÷.....
JavaBeanÖÐʹÓÃJDBC·½Ê½½øÐÐÊÂÎñ´¦Àí
public int delete(int sID) {
¡¡dbc = new DataBaseConnection();
¡¡Connectio ......

JProfiler ½â¾ö Java ·þÎñÆ÷µÄÐÔÄܸú×Ù

À´×Ô£ºhttp://www.anymobile.org
1¡¢ÕªÒª..........................................................................1
2¡¢¸ÄÉÆ·þÎñÆ÷µÄÐÔÄÜ...........................................................1
3¡¢·ÖÎöÆ÷Ô­Àí...................................................................2
4¡¢JProfiler ¼ò½é... ......

Java ³éÏóºÍ½Ó¿ÚÒÔ¼°¼Ì³ÐµÄÏê½â

ÓÐʱºò£¬ÎÒÃÇ¿ÉÄÜÏëÒª¹¹ÔìÒ»¸öºÜ³éÏóµÄ¸¸Àà¶ÔÏó£¬Ëü¿ÉÄܽö½ö´ú±íÒ»¸ö·ÖÀà»ò³éÏó¸ÅÄËüµÄʵÀýûÓÐÈκÎÒâÒ壬Òò´Ë²»Ï£ÍûËüÄܱ»ÊµÀý»¯¡£ÀýÈ磺ÓÐÒ»¸ö¸¸Àà“ Ë®¹û£¨Fruit£©”£¬ËüÓм¸¸ö×ÓÀà“Æ»¹û£¨Apple£©”¡¢“éÙ×Ó£¨Orange£©”¡¢“Ï㽶£¨Banana£©”µÈ¡£Ë®¹ûÔÚÕâÀï½ö½öÖ»ÊÇ×÷Ϊһ¸ ......

JAVA»·¾³±äÁ¿JAVA_HOME¡¢CLASSPATH¡¢PATHÉèÖÃÏê½â

 WindowsÏÂJAVAÓõ½µÄ»·¾³±äÁ¿Ö÷ÒªÓÐ3¸ö£¬JAVA_HOME¡¢CLASSPATH¡¢PATH¡£ÏÂÃæÖð¸ö·ÖÎö¡£
    JAVA_HOMEÖ¸ÏòµÄÊÇJDKµÄ°²×°Â·¾¶£¬ÈçC:\jdk1.5.0_06£¬ÔÚÕâ·¾¶ÏÂÄãÓ¦¸ÃÄܹ»ÕÒµ½bin¡¢libµÈĿ¼¡£ÖµµÃÒ»ÌáµÄÊÇ£¬JDKµÄ°²×°Â·¾¶¿ÉÒÔÑ¡ÔñÈÎÒâ´ÅÅÌĿ¼£¬²»¹ý½¨ÒéÄã·ÅµÄĿ¼²ã´Îdzһµã£¬Èç¹ûÄã·ÅµÄĿ¼ºÜÉî£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ