Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2617

Refactor Java Driver to have one method for connection selection

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Do
    • 3.4.12
    • None
    • driver
    • None

    Description

      To make a decision on whether a connection should be borrowed or not, a Java client today does two logic which are different from each other. They should both be same. One bit of logic to do so is at:

       if (borrowed >= maxSimultaneousUsagePerConnection && leastUsedConn.availableInProcess() == 0) {
      

      and another is:

      final int inFlight = leastUsed.borrowed.get();
                          final int availableInProcess = leastUsed.availableInProcess();
                          if (inFlight >= availableInProcess) {
                              logger.debug("Least used {} on {} has requests borrowed [{}] >= availableInProcess [{}] - may timeout waiting for connection",
                                      leastUsed, host, inFlight, availableInProcess);
                              break;
                          }
      
                          if (leastUsed.borrowed.compareAndSet(inFlight, inFlight + 1)) {
                              if (logger.isDebugEnabled())
                                  logger.debug("Return least used {} on {} after waiting", leastUsed.getConnectionInfo(), host);
                              return leastUsed;
                          }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            spmallette Stephen Mallette
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: