I have found the solution myself on java.sun.com. Use a new file as a semaphore. Through it have some drawback,but it is platform independence. thank you all
Re #15734: how to lock a file in Java? I mean how java provide flock()?