28 April 2007
What has changed from 1.4 to 1.5 on Threads and Concurrency?
Awareness of what you are doing is more important than having the specific information about that stuff.
Why did i write the clause above? I skip that. I will not answer.But i wanna make you think about that!!
Lets try to look at the que, written on the title.
java.Lang.Thread api has 4 basic innovation compare to 1.4.
**Thread.priority has changed.
Change is done for taking the adv. of using threads with priority = NORM_PRIORITY, this change make native threads of OS and Java threads more determenistic and more competeble.
Disadvantage is: Java priorities of Threads from 5 to 10 are not differentiated. Thread with pri. 7 has the same meaning with thread with pri.9..
**Thread.State enum class and the new getState() api has provided
You have the right and operation flexibility of states of Threads.
If you look at the JavaDoc you will see that they are available since Java 1.5.
**getStackTrace and getAllStackTraces obtains the trace of a Thread or All Threads.
Returns a map of stack traces for all live threads. The map keys are threads and each map value is an array of StackTraceElement
that represents the stack dump of the corresponding Thread. The returned stack traces are in the format specified for the getStackTrace method.
**uncaughtExceptionHandler class is now available for all Thread class NOT ONLY ThreadGroup Class.
sleep method also has changed and allows sleeping of Thread under one milliseconds of time.
moreover;
For the concurrency java.util.concurrent, java.util.concurrent.atomic, and java.util.concurrent.locks api's has been added to
Concurrency utility. Additionally, these packages provide low-level primitives for advanced concurrent programming
which take advantage of concurrency support provided by the processor, enabling programmers to implement high-performance,
highly scalable concurrent algorithms in the Java language to a degree not previously possible without resorting to native code.
You can find the jar file of changes 1.4 -> 1.5 on Threads. and use them on 1.4.
;)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment