Which errors to handle in clojure REST+disk-I/O app?

I have a server application which, somewhat simplified, periodically takes measurements via a rest-api from a not beefy-enough-server. The values should be cached locally (and are timestamped/immutable), maybe stored as a [FloatBuffer][1] where every position corresponds to a measurement sample. There's a webbrowser application which periodically makes ajax requests to update some neat statistics on the webpage, like this picture: ![Picture describing system architechture for REST measurement service and presentation][2] Assuming that the server is up and running, there are still many places where errors could occur - The REST measurement server could be unreachable (where the server just keeps storing measurements locally) - The network connection to the measurement server could be down - The storage could be full or somehow corrupt - The Browser could lose contact with the server and try to take it up again My *strategy* for coping with errors in general should be the following: If there are problems getting values from the measurement service via REST, there should be retries every minute. If the error persists for more than 30 minutes consequtively the administrator should be notified. In case of disk problems the administratior should be notified at once, or preferably even before the disk goes full. The end user experience should be as transparent to the errors as possible, but the application should still function as *sanely* as possible, by notifying the user an error have occured but also show the latest data availiable. How do I find which errors to cope with regarding network problems (using [clj-http][3] via an agent triggered by a `ScheduledThreadPoolExecutor` job to make REST request) and regarding problems with disk when trying to flush the `FloatBuffer`? What is a sane way to implement the quite stateful yet algorithmic strategy mentioned above? Should I simply handle the error when the `agent` reports it and switch to some kind of a recovery-mode job? [1]: http://docs.oracle.com/javase/6/docs/api/java/nio/FloatBuffer.html [2]: http://i.stack.imgur.com/VmUmB.jpg [3]: https://github.com/dakrone/clj-http
thanks for the pointers! However, I realize I'm really looking for a is a java server implementation of any kind (I want to make the whole solution from scratch). I'm heading for Jetty and/or Tomcat. Thanks again.

以上就是Which errors to handle in clojure REST+disk-I/O app?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准