Singleton pattern for sorts in java backend

ready for review
no really, it is used to test why the rewriting gets stuck at some final configuration. I forgot to remove it previously, and none of us noticed that.