Yeah, sorry it's not super clear, but I just changed the code style to add it at the top:

    def resourceOffers(offers: Seq[WorkerOffer]): Seq[Seq[TaskDescription]] = synchronized { ...

This is a more common style for making a whole method synchronized in Scala