1. The plaintiff may, at any time before the receipt of the defendant’s defence, or after the receipt thereof, before taking any other proceeding in the action (save any interlocutory application), by notice in writing wholly discontinue his action against all or any of the defendants, or withdraw any part or parts of his alleged cause of complaint, and thereupon he shall pay such defendant’s costs of the action, or, if the action be not wholly discontinued, the costs occasioned by the matter so withdrawn. Such costs shall be taxed, and such discontinuance or withdrawal, as the case may be, shall not be a defence to any subsequent action. Save as in this order otherwise provided, it shall not be competent for the plaintiff to withdraw or discontinue the action without leave of the Judge, but the Judge may before, or at, or after the hearing or trial, upon such terms as to costs, and as to any other action, and otherwise as may be just, order the action to be discontinued, or any part of the alleged cause of complaint to be struck out. The Judge may, in like manner, and with the like discretion as to terms, upon the application of the defendant, order the whole or any part of his alleged grounds of defence or counterclaim to be withdrawn or struck out, but it shall not be competent for a defendant to withdraw his defence, or any part thereof, without such leave.
2. When an action, matter or proceeding has been entered for trial, it may be withdrawn by either plaintiff or defendant, upon producing to the County Registrar a consent in writing signed by the parties.
3. Any defendant may enter judgment for the costs of the action, if it is wholly discontinued against him, or for the costs occasioned by the matter withdrawn, if the action be not wholly discontinued, in case such respective costs are not paid within four days after taxation.
4. If any subsequent action shall be brought before payment of the costs of a discontinued action, for the same or substantially the same cause of action, the Judge may order a stay of such subsequent action until such costs shall have been paid.