JavaÏ̵߳Äͬ²½
ÔÚJ2ME¿ª·¢ÖУ¬Ïß³ÌÊÇÒ»¸öÐèÒª·Ç³£ÖØÊÓµÄÎÊÌ⣬ÏÂÃæÊÇÒ»¶Î¹ØÓÚÏ̵߳ÄÎÄÕ¡£ÎÒÈÏΪ¶Ô´òºÃÏ̻߳ù±¾ºÜÓаïÖú¡£
zz
http://www.j2medev.com/Article/ShowArticle.asp?ArticleID=5478
Ò»¡¢Í¬²½ÎÊÌâÌá³ö
Ï̵߳Äͬ²½ÊÇΪÁË·ÀÖ¹¶à¸öÏ̷߳ÃÎÊÒ»¸öÊý¾Ý¶ÔÏóʱ£¬¶ÔÊý¾ÝÔì³ÉµÄÆÆ»µ¡£
ÀýÈ磺Á½¸öÏß³ÌThreadA¡¢ThreadB¶¼²Ù×÷ͬһ¸ö¶ÔÏóFoo¶ÔÏ󣬲¢ÐÞ¸ÄFoo¶ÔÏóÉϵÄÊý¾Ý¡£
public
class
Foo {
private
int
x = 100;
public
int
getX() {
return
x;
}
public
int
fix(int
y)
{
x = x - y;
return
x;
}
}
public
class
MyRunnable implements
Runnable {
private
Foo foo = new
Foo();
public
static
void
main(String[] args) {
MyRunnable r = new
MyRunnable();
Thread ta = new
Thread(r, "Thread-A"
);
Thread tb = new
Thread(r, "Thread-B"
);
ta.start();
tb.start();
}
public
void
run() {
for
(int
i =
0; i < 3; i++) {
this
.fix(30);
try
{
Thread.sleep(1);
} catch
(InterruptedException e) {
e.printStackTrace();
&nbs
Ïà¹ØÎĵµ£º
ºÃ¶à´óÐÍµÄÆóÒµÏîÄ¿¶¼ÒªÓõ½¸ß¼¶JDBCÁ¬½ÓÊý¾Ý¿âÅäÖø߼¶JDBCʵÀýÈçÏ£º
µÚÒ»£ºÅäÖÃTomcatϵÄconfÎļþ¼ÐϵÄcontext.xmlÎļþ
<?xml version='1.0' encoding='utf-8'?>
<Context>
<Resource name="jdbc/Ãû³Æ" auth="Container" type="javax.sql.DataSource"
maxActive="10" maxIdle=" ......
EclipseÓënetbeansʹÓÃÆÀ²â
½çÃæ
1 ÔÚ½çÃæÉÏnetbeans±È½ÏƯÁÁ,ÓѺá£µÃ·Ö 9
2 EclipseÓкÜÇ¿µÄ¶¨ÖÆÐУ¬Ã»netbeansÃÀ¹Û¡£ÊʺϸßÊÖ µÃ·Ö 8
¹¦ÄÜ
²»×ö±È½Ï
̸һЩ¸öÈË¿´·¨:ÔÚ¹¦ÄÜÉÏEclipseÖ§³Ö´óÁ¿µÄÀ©Õ¹,²»½ö½öÊÇÒ»¸ö java¿ª·¢¹¤¾ß,¸ü¿ÉÒÔÓÃÀ´¿ª·¢ c c++
phpµÈµÈ,¹¦ÄÜ¿ÉÒÔÎÞÏÞµÄÀ©Õ¹.netbeansÒ²Ö§³ÖÀ©Õ¹,¿ÉÒ²ÏÖÔ ......
1. Òì³£»úÖÆ
Òì³£»úÖÆÊÇÖ¸µ±³ÌÐò³öÏÖ´íÎóºó£¬³ÌÐòÈçºÎ´¦Àí¡£¾ßÌåÀ´Ëµ£¬Òì³£»úÖÆÌṩÁ˳ÌÐòÍ˳öµÄ°²È«Í¨µÀ¡£µ±³öÏÖ´íÎóºó£¬³ÌÐòÖ´ÐеÄÁ÷³Ì·¢Éú¸Ä±ä£¬³ÌÐòµÄ¿ØÖÆÈ¨×ªÒƵ½Òì³£´¦ÀíÆ÷¡£
´«Í³µÄ´¦ÀíÒì³£µÄ°ì·¨ÊÇ£¬º¯Êý·µ»ØÒ»¸öÌØÊâµÄ½á¹ûÀ´±íʾ³öÏÖÒì³££¨Í¨³ ......
×Ô¶¨Òå±êÇ©£¬±êÇ©´¦ÀíÆ÷Àࣺ
PrivilegeTag.JavaÓÐȨÏÞµÄÀàÉè¼Æ£º
package com.qizhi.tags.bean;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.tagext.TagSupport;
import com.qizhi.entity.Roleright;
import com.qizh ......
ÓÐÁ½ÖÖʵÏÖ·½·¨£¬·Ö±ðÊǼ̳ÐThreadÀàÓëʵÏÖRunnable½Ó¿Ú
ÓÃsynchronized¹Ø¼ü×ÖÐÞÊÎͬ²½·½·¨
·´¶ÔʹÓÃstop()£¬ÊÇÒòΪËü²»°²È«¡£Ëü»á½â³ýÓÉÏ̻߳ñÈ¡µÄËùÓÐËø¶¨£¬¶øÇÒÈç¹û¶ÔÏó´¦ÓÚÒ»ÖÖ²»Á¬¹á״̬£¬ÄÇôÆäËûÏß³ÌÄÜÔÚÄÇÖÖ״̬ϼì²éºÍÐÞ¸ÄËüÃÇ¡£½á¹ûºÜÄѼì²é³öÕæÕýµÄÎÊÌâËùÔÚ¡£suspend()·½·¨ÈÝÒ×·¢ÉúËÀËø¡£µ÷ÓÃsuspend()µÄʱºò ......