public function setLock(Lock $lock)
    {
        // Make sure that the subject from the given lock instance is this object.
        if ($lock->getSubject() !== $this) {
            throw new InvalidLockInstance('Invalid Lock instance given for current object.');
        }

        $this->lock = $lock;
    }