I am trying to create a task inside my webapp, which runs in a thread of it's own. It is a monitoring task that should run for the entire duration of the application. For this purpose, I have created a class that looks like:
public class MonitoringTask implements Runnable {
@Override
public void run() {
// perform monitoring task action
}
}
However, I get the "PMD.DoNotUseThreads" error mentioned here. If creating threads by implementing Runnable is not the recommended way in a J2EE webapp, what is?