Position:Home>JAVA Development> The blemish of Java line Cheng
The blemish of Java line Cheng
From;  Author:Stand originally


Answer to go to Suspend() and Resume() method replace in Java programming language, they are very useful, I do not want to be regarded as to be the child of nursery school. Because they may produce potential risk (when should be being hanged, cheng of a line can hold a lock) and take out they do not have a truth. Let myself decide to whether use them please. If receive line Cheng is holding a lock, sun company should regard a run time that calls Suspend() as them unusual processing (Run-time Exception) ; Better perhaps method is, defer hangs a process actually, release all locks till line Cheng.

The I/O that is broken by block should work correctly

Should can break any operations that are broken by block, is not to let their Wait() and Sleep() only. I am in“The Socket part in the 2nd chapter of Taming Java Threads ” discussed this issue. But now, to the I/O operation on a Socket that is broken by block, breaking its only way is to shut this Socket, and the file I/O operation that breaks to be broken by block without method. For example, after once begin to read,entering block to decide position, unless arrive,it numerates actually something, otherwise line Cheng stems from block to decide position all the time. Make put out a file already sentence the handle also cannot be interrupted read an operation.

Still have, the program should support the overtime that I/O operates. The target that all likelihood occurrence block breaks an operation (for example InputStream object) also should support this kind of method:

This and Socket kind SetSoTimeout(time) method is equivalent. No less, should support an overtime to deliver what break to block to call as parameter.

ThreadGroup kind

ThreadGroup should implement all methods that line Cheng position can change in Thread. I want to let it implement Join() method particularly, such I can await all line Cheng in the group stop.

Summary

Above is my proposal. Resemble me saying in the place in caption in that way, if I am kingly. . . (hey) . I hope these are changed (or the method that other is equal) can be introduced finally in Java language. I think Java language is a kind of great programming language really; But I also think the line Cheng model of Java is designed not quite perfectly still, this is very regrettablly thing. But, java programming language is evolving, still have the prospect that can raise so.

Reference material the article is pair of Taming Java Threads is newer extract and compile. This book discussed the trap in process designing of Cheng of the multi-line in Java language and issue, offerred a Java program package related to line Cheng to solve these problems. The Bill Pugh of Maryland university is dedicated to revising JLS to increase model of its line Cheng. What offer and do not recommend of Bill like article place is so wide, he basically devotes oneself to to let existing line Cheng model move with more logical way. More information can be obtained from Www.cs.umd.edu/~pugh/java/memoryModel/ . From Sun the website can find the standard of all Java language. Want to examine line Cheng from angle of a pure technology, the Concurrent Programming In Java that consults Doug Lea compiles: The second edition of Design Principles And Patterns. This is this very good book, but what constant learning changes its style dispute is not certain suit all readers. Right " Taming Java Threads " it is a very good compensatory reader. The Java Threads that writes by Scott Oaks and Henry Wong should be measured gently than Taming Java Threads some, but if you never had written line Cheng program,this book suits more. The help that Oaks and Wong realized Holub to offer likewise kind, and the different solution that sees pair of same problems always is beneficial. By Bill Lewis and Daniel J. The Threads Primer that Berg writes: A Guide To Multithreaded Programming is pair of line Cheng (not the very good introduction of Java) of be confined to introduces. The information of a few technologies of Java line Cheng can be found on Sun website. The SMP issue of multi-line Cheng system discussed in the Paul Jakubik in "Multiprocessor Safety And Java" .
Previous 1 2 3 4 5 6 7 8 9 10 11 1213 Next