Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-8951

Java: Cas Mismatch try/catch example confusing

    XMLWordPrintable

Details

    Description

      String id = "my-document";
      collection.upsert(id, JsonObject.create().put("initial", true));

      GetResult found = collection.get(id);
      JsonObject content = found.contentAsObject();
      content.put("modified", true).put("initial", false);
      while (true) {
      try

      { collection.replace(id, content, replaceOptions().cas(found.cas())); break; // if successful, break out of the retry loop }

      catch (CasMismatchException ex)

      { // don't do anything, we'll retry the loop }

      }

      The documentation says I should try – No matter how many times you try this it is going to be the same right?

      Reporter: M N
      E-mail: maheshvasn@gmail.com

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            hakim.cassimally Hakim Cassimally
            docsite-collector Docs Site Collector
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty