# File lib/delayed/backend/data_mapper.rb, line 51
        def lock_exclusively!(max_run_time, worker = worker_name)

          now = self.class.db_time_now
          overtime = now - max_run_time
          
          # FIXME - this is a bit gross
          # DM doesn't give us the number of rows affected by a collection update
          # so we have to circumvent some niceness in DM::Collection here
          collection = locked_by != worker ?
            (self.class.all(:id => id, :run_at.lte => now) & ( self.class.all(:locked_at => nil) | self.class.all(:locked_at.lt => overtime) ) ) :
            self.class.all(:id => id, :locked_by => worker)
          
          attributes = collection.model.new(:locked_at => now, :locked_by => worker).dirty_attributes
          affected_rows = self.repository.update(attributes, collection)
            
          if affected_rows == 1
            self.locked_at = now
            self.locked_by = worker
            return true
          else
            return false
          end
        end