Original Post
Hello, I need some advice from experienced web developers. Currently I am working on a browser game using hybrid technology. This is I got a MySQL server, a C++ application and tomcat+jsp It the whole system as follows. client ->JSP -> encode commands as strings -> MySQL command queue(just a innodb table) MySQL command queue -> decode commands -> C++ App -> update MySQL database MySQL database -> JSP -> client(some browser) The problem is the last step, I need to guarantee it is executed after the C++ has updated the MySQL database, otherwise the refreshed page would contain old information and I had to refresh once again. I see only two options a) using AJAX set some timer and then load the actual page content b) since each servlets a threaded, I had to sleep/schedule the servlet thread some time maybe 500 ms a) is an elegant solution but involved a lot of more work and you need javascript on the client side b) on the other hand delaying the servlet is a simple and effective solution What do you think which way should I go?