Added lock mechanism when requests are passing through

Added lock mechanism when requests are passing through, to prevent
multiple concurrent requests to the backend.