Cached instance in cpp side instead of calling static methods, improved singleton pattern in the java side.