OK, I guess(guess!) I understand you now. First, it depends on your OS. Sometimes your OS will do this work for you. Second, you may use key word "synchronized" to adjust a statement to let this statement(s) can be

ericwu (Eric Wu)
OK, I guess(guess!) I understand you now. First, it depends on your OS. Sometimes your OS will do this work(exclusively operate a file) for you. Second, you may use the key word "synchronized" to adjust statement(s) to let this statement(s) can be invoked by only one thread. So, a file can only be accessed by one user.
May be I will send you short sample codes.
(#15811@0)
2000-11-26 -05:00

回到话题: Re #15734: how to lock a file in Java? I mean how java provide flock()?

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论

URL:   
http://www.rolia.net/zh/post.php?f=0&p=15811