Commit Changes (Java API)

My system stops under volume with various errors related to the Transport client. I want to commit changes. I understand the solution needs to use a flush. Has anyone code examples of using flush to commit changes under Java?