views:

67

answers:

2

Hi guys,

I am try to create a JSP page that will show all the status in a group of local servers. Currently I create a schedule class that will constantly poll to check the status of the server with 30 second interval, with 5 second delay to wait for each server reply, and provide the JSP page with the information. However I find this way to be not accurate as it will take some time before the information of the schedule class to be updated. Do you guys have a better way to check the status of several server within a local network?

-- Update --

Thanks @Romain Hippeau and @dbyrne for their answers

Currently I am trying to make the code more in server end, that is to do a constant check on the status of the group of server asynchronously for update so as to make it more responsive. However I forgot to add that the client have the ability to control the server status. Thus I have problem for example when the client changes the server status, and then refresh the page. When the page retrieve the information from not updated schedule class, it will show the previous status of the server instead.

A: 

Make sure you poll the servers asynchronously. You don't want to wait for a response from one server before polling the next. This will dramatically cut down the amount of time it takes to poll all the servers. It was unclear to me from your question whether or not you are already doing this.

dbyrne
thanks dbyrne, right now I doing this sequentially. You are right, i think i will try to experiment with java.util.concurrent.future to make it async
Yijinsei
A: 

You can use Tomcat Comet here is an article http://www.ibm.com/developerworks/web/library/wa-cometjava/index.html.
This technology (which is part of the Servlet 3.0 spec) allows you to push notifications to the clients. There are issues with running it behind a firewall, If you are within an Intranet this should not be too big of an issue

Romain Hippeau
thanks for the articles. I shall give it a shot. But currently for Ajax, I am using DWR frameworks, which also provides Reverse Ajax such as polling and comet.
Yijinsei