Class TransactionsCleanupConfig.Builder

java.lang.Object
com.couchbase.client.java.transactions.config.TransactionsCleanupConfig.Builder
Enclosing class:
TransactionsCleanupConfig

public static class TransactionsCleanupConfig.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • build

    • cleanupClientAttempts

      public TransactionsCleanupConfig.Builder cleanupClientAttempts(boolean cleanupClientAttempts)
      Controls where a background thread is created to cleanup any transaction attempts made by this client.

      This should be left at its default of true. Without this, this client's transactions will only be cleaned up by the lost attempts cleanup process, which is by necessity slower.

    • cleanupLostAttempts

      public TransactionsCleanupConfig.Builder cleanupLostAttempts(boolean cleanupLostAttempts)
      Controls where a background process is created to cleanup any 'lost' transaction attempts: that is, those for which the regular cleanup process has failed.

      This should be left at its default of true. Without at least one client performing this cleanup, 'lost' transactions will not be removed.

    • cleanupWindow

      public TransactionsCleanupConfig.Builder cleanupWindow(Duration cleanupWindow)
      Part of the lost attempts background cleanup process. Specifies the window during which the cleanup process is sure to discover all lost transactions.

      This process is an implementation detail, but currently consists of polling multiple documents. The default setting of 60 seconds is tuned to reduce impact on the cluster. If the application would prefer to discover lost transactions more swiftly, but at the cost of more frequent polling, it can feel free to reduce this parameter, while monitoring resource usage.

      The trade-off to appreciate is that if a document is in a transaction A, it is effectively locked from being updated by another transaction until transaction A has been completed - that is, committed or rolled back. In rare cases such as application crashes, the transaction will remain incomplete - that is, it will be lost - until the lost transactions process discovers it.

    • addCollection

      public TransactionsCleanupConfig.Builder addCollection(TransactionKeyspace collection)
      Adds a collection to the set of metadata collections that will be cleaned up automatically.

      This will also start cleanup immediately rather than on the first transaction (unless cleanup has been explicitly disabled.)

    • addCollections

      Adds collections to the set of metadata collections that will be cleaned up automatically.

      This will also start cleanup immediately rather than on the first transaction (unless cleanup has been explicitly disabled.)