If an action be brought against several next of kin jointly, or several legatees jointly, for assets delivered to them, and a recovery be had against them, the costs shall be apportioned among the several defendants in proportion to the amount of the damages recovered against each. In either case, the payment or satisfaction of the judgment recovered against any one of the defendants shall discharge that defendant and that defendant’s property from such judgment.