js client cannot handle correctly response when monitoring instance is offline
We've decided to create a landing page that contains all our resources and shows its actual state. For that purpose, we're using an excellent tool - Jolokia 1.3.3 (thanks for it). The main idea - enable JMX support on server side and implement several MBeans that provide required information about the deployed application. On client side - run long polling using ajax. As a bridge between server JMX and ajax client, Jolokia jvm agent is used.
Let's consider simplified example with 1 server instance (tomcat) and 1 configured application with enabled jmx support. The Tomcat Container is configured to start with jvm Jolokia agent to provide integration point for different clients over http. JS client is configured as scheduler as described here. The problem is when server instance is down (and jvm agent is offline too), the client can't handle ajax error correctly, because the scheduler (as far as I understand) doesn't support jQuery ajaxError callback. On the other hand, if request is configured asynchronously and send once as described in section '220.127.116.11. Operational modes' of manual and 'ajaxError' callback is defined, the callback is triggered successfully, thus we have a possibility to hook the error.
My question is - what is the easiest and right way to handle the case when application with agent are offline for js scheduler?
Thanks in advance
P.S.: as a temp solution I modified js client by adding 'ajaxError' support for the scheduler.