Skip to content

Commit

Permalink
fix TRINIDAD#39: Hotdeploy issue with capistrano
Browse files Browse the repository at this point in the history
  • Loading branch information
calavera committed Feb 28, 2011
1 parent 111d901 commit c14fe30
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/main/java/org/jruby/trinidad/HotDeployObserver.java
Expand Up @@ -38,7 +38,7 @@ public void createMonitor() {
monitor.createNewFile();
lastModified = monitor.lastModified();
} catch (IOException io) {
System.err.println("Was not allowed to create the monitor: " + monitor.getAbsolutePath());
System.err.println("[ERROR] Unable to create the monitor file: " + monitor.getAbsolutePath());
interrupted = true;
}
}
Expand All @@ -47,10 +47,22 @@ public void observeAndRestart() {
boolean monitorExists;
try {
monitorExists = monitor.exists();
} catch(SecurityException e) {
System.err.println("Was not allowed to check monitor existance: " + monitor.getAbsolutePath());
interrupted = true;
return;
} catch (SecurityException e) {
// double check. Capistrano removes the parent directory temporarily
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
System.err.println("[ERROR] Thread interrupted");
interrupted = true;
return;
}
try {
monitorExists = monitor.exists();
} catch (SecurityException e1) {
System.err.println("[WARNING] The monitor file doesn't exist: " + monitor.getAbsolutePath());
System.err.println("[WARNING] Trying to check it again in " + delay + "ms");
return;
}
}

if (monitorExists) {
Expand Down

0 comments on commit c14fe30

Please sign in to comment.