[ 
https://issues.apache.org/jira/browse/TINKERPOP-2617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17557598#comment-17557598
 ] 

ASF GitHub Bot commented on TINKERPOP-2617:
-------------------------------------------

simonz-bq commented on PR #1709:
URL: https://github.com/apache/tinkerpop/pull/1709#issuecomment-1163431400

   > Let me get to a first review by end of this week @simonz-bq . Meanwhile, 
it would be great if we could get some testing around the edge cases that you 
mentioned which aren't correctly handled in the current code.
   
   @divijvaidya the additional edge cases logic was removed, but I forgot to 
update the initial commit comment. It was causing existing integration tests to 
fail and hang and investigation into how to fixing them proved to be difficult 
and complex for what was being considered as a easy win. 




> Refactor Java Driver to have one method for connection selection
> ----------------------------------------------------------------
>
>                 Key: TINKERPOP-2617
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2617
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: driver
>    Affects Versions: 3.4.12
>            Reporter: Stephen Mallette
>            Priority: Minor
>
> 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:
> {code}
>  if (borrowed >= maxSimultaneousUsagePerConnection && 
> leastUsedConn.availableInProcess() == 0) {
> {code}
> and another is:
> {code}
> 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;
>                     }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to