make http handler thread safe