Search code examples
javatogglz

Togglz: noCommit option in JDBCStateRepository.Builder, what does it do?


Our application currently uses Togglz. I'm migrating from a FileBasedStateRepository to a JDBCStateRepository. I'm using the builder to create the JDBCStateRepository.

I'm confused as to what the noCommit option does? Can someone explain what it does. Should I use it or not?

Thanks!


Solution

  • You can see what it does in the source code of JDBCStateRepository:

    https://github.com/togglz/togglz/blob/dbf3fc5e48d567e3e307e490f4985c48d1a4e7ca/core/src/main/java/org/togglz/core/repository/jdbc/JDBCStateRepository.java#L317-L319

    If noCommit is set, the database transaction is not committed after the repository state has been updated. This may be useful if you use Togglz in a Java EE environment where the transaction is managed by the container.