每一个线程都有一个优先度(priority)。 Thread类里面定义了 static int MAX_PRIORITY static int MIN_PRIORITY static int NORM_PRIORITY int getPriority() void setPriority(int newPriority) 但是priority对scheduling的影响应不同的平台而异。
1,solaris JVM's are pre-emptive windows JVM's were pre-emptive until java 1.0.2 ---------------------------------------------------- Mactinosh JVM's are time-sliced windows JVM's are time-sliced after java 1.0.22,~~~
2.是 notifyall()效果是要好一些
Thread类里面定义了
static int MAX_PRIORITY
static int MIN_PRIORITY
static int NORM_PRIORITY
int getPriority()
void setPriority(int newPriority)
但是priority对scheduling的影响应不同的平台而异。
2、建议用notifyall()。
windows JVM's were pre-emptive until java 1.0.2
----------------------------------------------------
Mactinosh JVM's are time-sliced
windows JVM's are time-sliced after java 1.0.22,~~~