How do I run a different thread from a servlet? I have the below code in the init()
method of the servlet.
FileThread myThread = new FileThread();
myThread.start();
myThread.run();
FileThread is supposed to see some folder to check whether files were changed or not. So this thread is made to run in a loop. But it doesn't work as I expected. It freezes (server doesn't return HTML) the service of the server.
I want this thread to run on background and not to interfere with servlet`s process. How can I achive this?