JBPM-3814, BZ 1002724 Bugfixes with regards to concurrency locking (cherry picked from commit 5014a4b4fba83e46f49a32f21d07364da03485de)