Reputation: 11377
I'm starting to use Play framework, I've tried some examples and i wonder how exactly it acts on page refresh : does it recompile all files or just those which were modified?
Upvotes: 1
Views: 465
Reputation: 33379
It only recompiles relevant files after your modification. Here's what Play official website says:
Running the server in development mode
In this mode, the server will be launched with the auto-reload feature enabled,
meaning that for each request Play will check your project and recompile required sources.
If needed the application will restart automatically.
As a side note, Play uses JNotify to monitor the changes in your file system.
Here's a link for JNotify: http://jnotify.sourceforge.net/
Upvotes: 2
Reputation: 562
You can read this article which explains how Play's hot reload works: http://jto.github.io/articles/play_anatomy_part2_sbt/
Basically, on file change SBT (building tool used in Play) recognise what to recompile and re-insert the new code in your instance.
Note that it only works in a state-less environnement, because it doesn't trash nor reinitiate old objects. In a stateless world, every request create all the objects it needs and keep nothing from outside. If you use websockets with Play, you may encounter some weird behaviours since websockets are stateful (you have to open a new socket to get the changes).
Upvotes: 2
Reputation: 1272
Play only compiles the whole project the first time you open your browser. This means that the first time you run it in browser it might be a little slow to load. I'm not exactly sure how play recognize which files that were modified from the last compile, but to answer your question it only compiles the modified files.
Upvotes: 1