WEB-483 added lock exceptions and middleware