Uploaded image for project: 'Couchbase Java Client'
  1. Couchbase Java Client
  2. JCBC-157

Unsure if CouchbaseConnectionFactory.pastReconnThreshold really does what it's suppose to do

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.3
    • Fix Version/s: 1.1-beta
    • Component/s: Core
    • Security Level: Public
    • Labels:
      None
    • Environment:
      Oracle Jdk 1.6.0_26

      Description

        private boolean pastReconnThreshold() {
          long currentTime = System.nanoTime();
          if (currentTime - thresholdLastCheck > 100000000) { //if longer than 10 sec
            configThresholdCount = 0; // it's been more than 10 sec since last
                                      // tried, so don't try again just yet.
          }
          configThresholdCount++;
          thresholdLastCheck = currentTime;
       
          if (configThresholdCount >= maxConfigCheck) {
            return true;
          }
          return false;
        }
      

      Does the above really work as expected? It looks strange. 100000000 in nanos is only 100 millis and not 10 seconds as stated in comments.
      If there is more than 100 millis between calls we always reset configThresholdCount and will never return true, which seems very strange.

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

        Activity

        Hide
        daschl Michael Nitschinger added a comment -

        fixed and pushed to master, will be available in beta.

        Show
        daschl Michael Nitschinger added a comment - fixed and pushed to master, will be available in beta.
        Hide
        marcus.nylander@gmail.com Marcus Nylander added a comment - - edited

        Checking the fix. Not that I've looked deeply into what pastReconnThreshold() should do, but just increasing the timeout?
        Isn't it more like it should return true every maxConfigCheck calls or return true if last call was more than 10 seconds ago?

        Show
        marcus.nylander@gmail.com Marcus Nylander added a comment - - edited Checking the fix. Not that I've looked deeply into what pastReconnThreshold() should do, but just increasing the timeout? Isn't it more like it should return true every maxConfigCheck calls or return true if last call was more than 10 seconds ago?
        Show
        daschl Michael Nitschinger added a comment - http://review.couchbase.org/#/c/22902/
        Hide
        daschl Michael Nitschinger added a comment -

        can you take a look at this?

        Show
        daschl Michael Nitschinger added a comment - can you take a look at this?

          People

          • Assignee:
            ingenthr Matt Ingenthron
            Reporter:
            marcus.nylander@gmail.com Marcus Nylander
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Gerrit Reviews

              There are no open Gerrit changes