本文发表在 rolia.net/zh 相约加拿大网上社区枫下论坛
My discussion is as below:
As Jabber said above and as far as I know, directly control of file locking is outside of JVM.
If someone want to store the message number in a text or plain file and to use servlet to access the message number, I just know one way which can probably resolve what "Servlet" posted above: using native method in servlet (but this will involve non-Java programming and some level of platform-specific, so is not a pure Java solution). I do not know any more upto now.
I think the better way to solve this "message number stored in a text or plain file" problem is non-Java CGI or ISAPI or NSAPI.
Something which are about outside of control of JVM remains puzzled with me for a long time. The native method in a Java class is a way to get outside of JVM, and it seems very easy for the Java designers to implemented native methods to control almost any things outside of JVM. In fact I think they have done a lot: many of the "system" Java classes depend on the native methods. On the other side, I think they have not done a lot of important low level things which usually is platform-specific. I am not sure if there is any other reason besides the platform-specific for those Java designers to gave up so many important low level staffs.
更多精彩文章及讨论，请光临枫下论坛. 网址: rolia.net/zh