Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2323

Don't allow 0 maxStaleness in ReadPreference API

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.0-rc1, 3.4.0
    • Affects Version/s: None
    • Component/s: Query Operations
    • None

      The driver currently allows a value of 0 for maxStaleness, which it documents to mean "no maximum". This is unnecessarily confusing, as users might thing, despite the API docs, that maxStaleness of 0 means "totally fresh".

      Consider changing the ReadPreference API to not treat 0 specially, and require either:

      • use of overloaded factory methods that don't take a maxStaleness parameter to indicate that there is no maximum
      • use boxed Long so that null can be passed as a value, and don't treat 0 specially.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: