Making Async AJAX calls Synchronous

Environment: Ext-JS Frontend UI -> AJAX Calls -> Spring MVC Server/Java -> Apache CXF to MQ -> Back-end COBOL.

Based on the above environment we can not handle asynchronous AJAX calls being sent due to a limitation with the backend COBOL server. Normally we daisy chain our ajax calls. However now we need an automatic refresh mechanism on some UI pages. So if we happen to send a normal AJAX request from the UI at the same time as a refresh (AJAX) calls gets dispatched then we need to queue the two calls and make them effectively Synchronous. Any solution would need to be generic though.

What would be the simplest way of dealing with this scenario ? Is there a simple approach of blocking the refresh call when a request has already been dispatched? Or would it be best to use an ExecutorService in the Java Server layer to handle the scenario ? Or maybe futures/promises. How would I make that work ?

Hope this make sense and any suggestions on an approach would be appreciated.


你有没有想过使用像Beanstalkd这样的排队系统,流程如下所示:

Ext-JS Frontend UI -> AJAX Calls -> Spring MVC Server/Java -> Beanstalkd -> Apache CXF to MQ -> Back-end COBOL.

链接地址: http://www.djcxy.com/p/9440.html

上一篇: Js延期/承诺/未来与Scala等功能语言相比

下一篇: 使异步AJAX调用同步