A person convicted of a misdemeanor may be required by the judge or magistrate to enter into a recognizance, with sufficient surety, in such sum as the judge or magistrate finds proper, to keep the peace and be of good behavior for such time, not exceeding two years, as the court directs. The court may order such person to stand committed until such order is complied with or he is discharged by law, but the court may discharge such person at any time on his own recognizance, or cancel such recognizance.
R.C. §2947.16