< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java

Print this page




 152      */
 153     public int getPort() {
 154         Assert.check(containsPortInfo);
 155         return serverPort;
 156     }
 157 
 158     /**
 159      * If so, then we can acquire the server cookie.
 160      */
 161     public long getCookie() {
 162         Assert.check(containsPortInfo);
 163         return serverCookie;
 164     }
 165 
 166     /**
 167      * Store the values into the locked port file.
 168      */
 169     public void setValues(int port, long cookie) throws IOException {
 170         Assert.check(lock != null);
 171         rwfile.seek(0);
 172         // Write the magic nr that identifes a port file.
 173         rwfile.writeInt(magicNr);
 174         rwfile.writeInt(port);
 175         rwfile.writeLong(cookie);
 176         myServerPort = port;
 177         myServerCookie = cookie;
 178     }
 179 
 180     /**
 181      * Delete the port file.
 182      */
 183     public void delete() throws IOException, InterruptedException {
 184         // Access to file must be closed before deleting.
 185         rwfile.close();
 186 
 187         file.delete();
 188 
 189         // Wait until file has been deleted (deletes are asynchronous on Windows!) otherwise we
 190         // might shutdown the server and prevent another one from starting.
 191         for (int i = 0; i < 10 && file.exists(); i++) {
 192             Thread.sleep(1000);




 152      */
 153     public int getPort() {
 154         Assert.check(containsPortInfo);
 155         return serverPort;
 156     }
 157 
 158     /**
 159      * If so, then we can acquire the server cookie.
 160      */
 161     public long getCookie() {
 162         Assert.check(containsPortInfo);
 163         return serverCookie;
 164     }
 165 
 166     /**
 167      * Store the values into the locked port file.
 168      */
 169     public void setValues(int port, long cookie) throws IOException {
 170         Assert.check(lock != null);
 171         rwfile.seek(0);
 172         // Write the magic nr that identifies a port file.
 173         rwfile.writeInt(magicNr);
 174         rwfile.writeInt(port);
 175         rwfile.writeLong(cookie);
 176         myServerPort = port;
 177         myServerCookie = cookie;
 178     }
 179 
 180     /**
 181      * Delete the port file.
 182      */
 183     public void delete() throws IOException, InterruptedException {
 184         // Access to file must be closed before deleting.
 185         rwfile.close();
 186 
 187         file.delete();
 188 
 189         // Wait until file has been deleted (deletes are asynchronous on Windows!) otherwise we
 190         // might shutdown the server and prevent another one from starting.
 191         for (int i = 0; i < 10 && file.exists(); i++) {
 192             Thread.sleep(1000);


< prev index next >