My Java application in Google App Engine loads a whitelist file stored in /WEB-INF
. The file is defined as a resource file in appengine-web.xml
:
<resource-files>
<include path="/whitelist.txt" />
</resource-files>
The whitelist is loaded when the first GET request is received.
However, I want to modify the code such that the whitelist is loaded every 15 minutes. This way if I make any changes to the whitelist file (in WEB-INF/whitelist.txt
), the changes are reflected soon after.
I tried using a ScheduledExecutorService
with a Runnable task as mentioned here https://stackoverflow.com/a/2249068/1244329 where the task consists of just reading the file. However, the task inside contextInitialized
is never executed. In fact, I don't think I am even hitting the contextInitialized
method.
What am I doing wrong? How should I implement this?