javajettyjetty-10

How to turn off the scan for the war files in Jetty10


I am working with Jetty10 and by defalut, war scan is enabled and the scan interval is set to 1 second. It means Jetty scans the complete web apps directory every 1 sec. Please correct me if I am wrong. the below code is in the jetty\etc\jetty-deploy.XML

 <Set name="scanInterval"><Property name="jetty.deploy.scanInterval" default="1"/></Set>

I don't want that burden to my application and turning this scan off will reduce the overhead of jetty scanning complete web apps every 1 sec.

So, my question is how can we turn off this scan? do we need to set it to -1 or is there any approach to do this?


Solution

  • The WebAppProvider uses a org.eclipse.jetty.util.Scanner, and the javadoc for Scanner.setScanInterval(int) says:

    @param scanInterval pause between scans in seconds, or 0 for no scan after the initial scan.

    So if don't want regular scans after the initial scan you can set the scanInterval to 0 by setting the Jetty property jetty.deploy.scanInterval=0 in your deploy.ini file.