[Core, Locking]: Refactoring for supporting RestXQ