xiazcy commented on pull request #1478:
URL: https://github.com/apache/tinkerpop/pull/1478#issuecomment-928255527


   Hi Divij, thank you so much for your suggestions!
   
   Just as a response to the two cases you outlined, and to make sure we are on 
the same page, re-init() is actually triggered when 
`Client.noLiveHostAvailable` is set to `true`, and not `false`. This flag is 
set to `true` at beginning of `Client.initializeImplementation()`, and is set 
to `false` if at least one host is alive during initialization, not the other 
way around. This follows an "assume no live hosts unless proven otherwise" 
logic. 
   
   More specifically, in the case when there are dead hosts among other live 
hosts, `Client.noLiveHostAvailable` is first set to `true`, and then set to 
`false` when any live hosts successfully initialized a connection pool inside 
the async call to `Client.initializeConnectionSetupForHost`. This also leaves 
`Client.initialized` as `true`, which shouldn’t trigger `Client.init()` at `if 
(!initialized || noLiveHostAvailable)` inside `Client.submitAsync()`, and if 
`Client.init()` is somehow called, its `if (initialized && 
!noLiveHostAvailable)` check would be `true` and any further initialization 
would be skipped. I believe this should avoid Case#2.
   
   But in any case, this change doesn’t resolve the fact that 
`Client.initialized` is set as `true` when by definition it shouldn’t when no 
host is available, and I’m working on a way to approach this based on your 
suggestions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to