public synchronized boolean stillMyValues ( ) throws IOException , FileNotFoundException { for ( ; ; ) { try { lock ( ) ; getValues ( ) ; unlock ( ) ; if ( containsPortInfo ) { if ( serverPort == myServerPort && serverCookie == myServerCookie ) { // Everything is ok. return true ; } // Someone has overwritten the port file. // Probably another javac server, lets quit. return false ; } // Something else is wrong with the portfile. Lets quit. return false ; } catch ( FileLockInterruptionException e ) { continue ; } catch ( ClosedChannelException e ) { // The channel has been closed since sjavac is exiting. return false ; } } }
Check if the portfile still contains my values assuming that I am the server .