Skip to content

Instantly share code, notes, and snippets.

@jglick
Created September 30, 2014 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jglick/4835f2da45bb9c5e3fa9 to your computer and use it in GitHub Desktop.
Save jglick/4835f2da45bb9c5e3fa9 to your computer and use it in GitHub Desktop.
Try running in JDK 8u20 under debugger, then uncomment noted line and JPDA hot-reload. Does not work.
import java.util.Date;
import java.util.function.Consumer;
public class ReloadDemo {
public static void main(String[] args) throws InterruptedException {
while (true) {
run((String x) -> System.out.println(x + " first"));
run((String x) -> System.out.println(x + " second"));
//run((String x) -> System.out.println(x + " third"));
Thread.sleep(1000);
}
}
private static void run(Consumer<String> c) {
c.accept("Hello @" + new Date());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment