fixed synchronization problems in MetricsServlet, the test changed accordingly.