When a request comes to tomcat and tomcat does not have any free thread available or all the threads are busy and request queue is also full then where I need to write the logic for redirect the request to some other server.
I have ConnectionRedirectionValve.java already written but in that file the request redirection logic is handled when threads are not sufficient at application level means application inside tomcat do not have any spare semaphore that is handled in this file.
Even though when tomcat does not have sufficient threads then I do not think the flow will move to ConnectionRedirectionValve.java So please suggest how to handle this