MCPcopy Create free account
hub / github.com/apache/tomcat / invoke

Method invoke

java/org/apache/catalina/valves/SemaphoreValve.java:221–256  ·  view source on GitHub ↗

Do concurrency control on the request using the semaphore. @param request The servlet request to be processed @param response The servlet response to be created @exception IOException if an input/output error occurs @exception ServletException if a servlet error occurs

(Request request, Response response)

Source from the content-addressed store, hash-verified

219 * @exception ServletException if a servlet error occurs
220 */
221 @Override
222 public void invoke(Request request, Response response) throws IOException, ServletException {
223
224 if (controlConcurrency(request, response)) {
225 boolean shouldRelease = true;
226 try {
227 if (block) {
228 if (interruptible) {
229 try {
230 semaphore.acquire();
231 } catch (InterruptedException e) {
232 shouldRelease = false;
233 permitDenied(request, response);
234 return;
235 }
236 } else {
237 semaphore.acquireUninterruptibly();
238 }
239 } else {
240 if (!semaphore.tryAcquire()) {
241 shouldRelease = false;
242 permitDenied(request, response);
243 return;
244 }
245 }
246 getNext().invoke(request, response);
247 } finally {
248 if (shouldRelease) {
249 semaphore.release();
250 }
251 }
252 } else {
253 getNext().invoke(request, response);
254 }
255
256 }
257
258
259 /**

Callers 1

Calls 8

controlConcurrencyMethod · 0.95
permitDeniedMethod · 0.95
acquireMethod · 0.80
invokeMethod · 0.65
getNextMethod · 0.65
releaseMethod · 0.65
tryAcquireMethod · 0.45

Tested by 1