From 9d4f01f1dba86973f824965bf5025a7437f8fe0c Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Fri, 26 Aug 2005 14:53:25 +0000 Subject: [PATCH] Improving servlet loading performance svn: r685 --- collects/web-server/dispatch-servlets.ss | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/collects/web-server/dispatch-servlets.ss b/collects/web-server/dispatch-servlets.ss index 9e8cfc1127..f09020bf81 100644 --- a/collects/web-server/dispatch-servlets.ss +++ b/collects/web-server/dispatch-servlets.ss @@ -250,11 +250,18 @@ ;; refreshed (see dispatch). (define (cached-load name) (let ([e - (call-with-semaphore config:scripts-lock - (lambda () - (hash-table-get (unbox config:scripts) - name - (lambda () (reload-servlet-script name)))))]) + ; First try to get the cache entry + (hash-table-get + (unbox config:scripts) + name + (lambda () + ; Then try to update the cache entry + (call-with-semaphore + config:scripts-lock + (lambda () + (hash-table-get (unbox config:scripts) name + (lambda () + (reload-servlet-script name)))))))]) (values (cache-entry-servlet e) (cache-entry-namespace e))))