tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject svn commit: r575477 - in /tomcat/tc6.0.x/trunk: java/org/apache/catalina/valves/JDBCAccessLogValve.java webapps/docs/changelog.xml
Date Thu, 13 Sep 2007 21:52:32 GMT
Author: pero
Date: Thu Sep 13 14:52:31 2007
New Revision: 575477

URL: http://svn.apache.org/viewvc?rev=575477&view=rev
Log:
Optimized JDBCAccessLogValve combined pattern request attribute access.

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java?rev=575477&r1=575476&r2=575477&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java Thu Sep 13
14:52:31 2007
@@ -458,15 +458,16 @@
      */    
     public void invoke(Request request, Response response) 
         throws IOException, ServletException {
-
+        final String EMPTY = "" ;
+        
         getNext().invoke(request, response);
 
-        String remoteHost = "";
+        String remoteHost = EMPTY;
         if(resolveHosts)
             remoteHost = request.getRemoteHost();
         else
             remoteHost = request.getRemoteAddr();
-        String user = "";
+        String user = EMPTY;
         if(request != null)
             user = request.getRemoteUser();
         String query="";
@@ -477,19 +478,15 @@
         if(bytes < 0)
             bytes = 0;
         int status = response.getStatus();
-        if (pattern.equals("combined")) {
-                String virtualHost = "";
-                if(request != null)
-                    virtualHost = request.getServerName();
-                String method = "";
-                if(request != null)
-                    method = request.getMethod();
-                String referer = "";
-                if(request != null)
-                    referer = request.getHeader("referer");
-                String userAgent = "";
-                if(request != null)
-                    userAgent = request.getHeader("user-agent");
+        String virtualHost = EMPTY;
+        String method = EMPTY;
+        String referer = EMPTY;
+        String userAgent = EMPTY;
+        if (pattern.equals("combined") && request != null) {
+            virtualHost = request.getServerName();
+            method = request.getMethod();
+            referer = request.getHeader("referer");
+            userAgent = request.getHeader("user-agent");
         }
         synchronized (this) {
           int numberOfTries = 2;
@@ -511,19 +508,6 @@
                     ps.setInt(6, (int) bytes);
                 }               
                 if (pattern.equals("combined")) {
-     
-                      String virtualHost = "";
-                      if(request != null)
-                         virtualHost = request.getServerName();
-                      String method = "";
-                      if(request != null)
-                         method = request.getMethod();
-                      String referer = "";
-                      if(request != null)
-                         referer = request.getHeader("referer");
-                      String userAgent = "";
-                      if(request != null)
-                         userAgent = request.getHeader("user-agent");
                       ps.setString(7, virtualHost);
                       ps.setString(8, method);
                       ps.setString(9, referer);

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=575477&r1=575476&r2=575477&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Thu Sep 13 14:52:31 2007
@@ -79,6 +79,9 @@
       <fix>
         Improve large-file support (more then 4 Gb) at all AccessLogValves, backport from
5.5.25. (pero)
       </fix>     
+      <update>
+        Optimized JDBCAccessLogValve combined pattern request attribute access. (pero)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message