kirklund edited a comment on pull request #6874:
URL: https://github.com/apache/geode/pull/6874#issuecomment-941266748


   @albertogpz @jhuynh1 `AcceptorImpl` is the class that runs server-side 
threads to execute requests from clients. When the thread starts, you could 
check a global in `QueryObserverHolder` and then set the `ThreadLocal` on each 
thread that it starts.
   
   It might even be possible to support multiple QueryObservers and invoke them 
all for each query.
   
   So here are some suggestions from Jason and me:
   
   Have the test set a global in the server(s). When the server starts a 
`AcceptorImpl` thread to process that query, set that same `ThreadLocal` on 
that thread.
   
   The query execution then adds the instance of `QueryObserver` to the 
`ExecutionContext`.
   
   Don't forget to call `ThreadLocal.remove()` after a query completes.
   
   `OrderByComparator` has a call to `QueryObserverHolder.getInstance()`. 
Change that to just fetch the observer from the `context` field in that class.
   
   It might even be possible to avoid the `ThreadLocal` by using a unique 
observer instance per execution context. I envisioned stuffing a unique 
instance of `QueryObserver` into the `ThreadLocal `that is then garbage 
collected after the query finishes and `ThreadLocal.remove` has been called.


-- 
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