Why look at Servlet. You got the source, just do it the way JBoss does it, in an MBean. Perhaps there is some code you can borrow, or even extend from JBoss. Make a class that does what you want. Make an MBean wrapper for that class. You can then deploy your MBean in JBoss and any other app server that supports JMX - they most all do because they are all playing catch up to JBoss. If you run into a app server that does not have JMX, then you can call your class from a servlet, I guess.
The only issue you might have with an mbean is if it needs to talk to a deployed application.
If your directory scanner is generic I would go the mbean, but if it is only talking to one deployed app for instance, I would go the servlet.
Thanks, that probably is the "correct" way of doing it...if I had more time, I would implement it that.
I am going to continue to use a servlet, but instead of extneding GenericServlet, I will use HTTPServlet and allow the developement team to post requests to the servlet to monitor the status of the thread.