Singleton pattern for sorts in java backend

ready for review
actually you know what, never mind, this is a deprecated code path, it's okay if it doesn't work with parametric sorts later.