Singleton pattern for sorts in java backend

ready for review
I was about to do that.