(Twinkies might not be leaving your local grocery store shelf after all.) Reuters

Hostess Brands Inc. has agreed to hold mediation talks with its bakery workers’ union on Tuesday at the urging of a bankruptcy court judge to avoid the immediate liquidation of the maker of Twinkies, Ho Hos and Wonder Bread, according to media reports.

A hearing on Monday during which Hostess was set to ask for permission to liquidate was quickly adjourned until Wednesday after the judge urged the parties to mediate in private.

"My desire to do this is prompted primarily by the potential loss of over 18,000 jobs, as well as my belief that there is a possibility to resolve this matter notwithstanding the losses that the debtors have incurred over the last week or so and the difficulty of reorganizing this company in the first place," U.S. Bankruptcy Judge Robert Drain said Monday at a hearing in White Plains, N.Y., according to Bloomberg.

He will preside over the mediation session Tuesday afternoon. Should the talks collapse, Hostess will be back in court to seek approval of a close-out plan on Wednesday morning.

“I believe that mediation really only works if the parties are willing to do it, but I’m also strongly suggesting that the parties should be willing to do it,” Drain said. He expressed concern that neither side had exhausted all efforts to avoid a complete shutdown of the company.

“To me not to have gone through that step leaves a huge question mark over this case, which I think will only be answered in litigation,” the judge said.

On Friday, the baker of Twinkies announced plans to liquidate and lay off most of its nearly 19,000 employees, a week after the Bakery, Confectionery, Tobacco Workers and Grain Millers International Union went on strike. The company said the work stoppage had caused irreversible damage to its operation and had made it impossible to reorganize its finances.