- App Server. You see Tomcat as heavy in terms of runtime footprint, or amount of learning or ...? I would tend to chose something that has well established integration with an IDE. So Eclipse + Tomcat or Apache Geronimo, perhaps in it's WebSphere Community Edition guise would do the job. From what I've seen these are sufficient for what you want, and the learning curves are really pretty manageable.
- Yes JSPs. You may yet find that your presentation needs become a tad more complex. The extra effort of going to JSF might yet pay off - nice widgets such as Date pickers.
- In your processing you will have a servlet (or an action class if you're using JSF) that class can have a member variable of type Engine initialised on startup and then used for every request. The thing to bear in mind is that many users will hit that servlet, and hence that engine at the same time. Is your Engine safe to be used from more than one thread at the same time?
To expand in this point. When implementing JSPs, there are two models refered to as (with some inventiveness) as Model 1 and Model 2. See this explanation.
In the case of model 1 you tend to put code directly into the JSP, it's acting in a controller role. Persoanlly, even when dealing with small, quickly developed apps, I do not so this. I always use Model 2. However if you choose you can just put some Java into your JSP.
<% MyWorker theWorker = MyWorkerFactory.getWorker();
// theWorker.work();
%>
I woudl favour having a factory like this so that you can control the creation of the worker. The factory would have something like (to give a really simple example)
private static MyWorker s_worker = new MyWorker();
public static synchronized getWorker() {
return s_worker;
}
Alternatively you could create the worker when that method is first called.
In the case of model 2 you naturally have a servlet into which you are going to put some code, so you can just have
private MyWorker m_worker = MyWorkerFactory.getWorker();
This will be initialised when the servlet is loaded. No need to worry about setting it to load on startup, you just know that it will be initialsed before the first request is run.
Better still, use the init() method of the servlet. This is guranteed to be called before any requests are processed and is the servlet API architected place for such work.
public class EngineServlet extends HttpServlet {
private Engine engine;
// init is the "official" place for initialisation
public void init(ServletConfig config) throws ServletException {
super.init(config);
engine = new Engine();
}
I found a good tutorial and the quick start documentation on the installation of Jetty in a windows environment. It's not simply an installer, but you merely unzip the files into a folder and run the command:
java -jar start.jar
in the folder where you unzipped it to start the server.
Best Answer
Any JMX console should work, including JConsole and JVisualVM.