update the java code and make the workflow better