hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r964559 - in /httpcomponents/httpcore/trunk: httpcore-nio/src/main/java/org/apache/http/impl/nio/ httpcore/src/main/java/org/apache/http/impl/ httpcore/src/main/java/org/apache/http/impl/io/
Date Thu, 15 Jul 2010 20:08:08 GMT
Author: olegk
Date: Thu Jul 15 20:08:07 2010
New Revision: 964559

URL: http://svn.apache.org/viewvc?rev=964559&view=rev
Log:
HTTPCORE-230: added protected create methods for HttpConnectionMetricsImpl and HttpTransportMetricsImpl
classes

Modified:
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java?rev=964559&r1=964558&r2=964559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
Thu Jul 15 20:08:07 2010
@@ -60,6 +60,7 @@ import org.apache.http.impl.nio.codecs.L
 import org.apache.http.impl.nio.codecs.LengthDelimitedEncoder;
 import org.apache.http.impl.nio.reactor.SessionInputBufferImpl;
 import org.apache.http.impl.nio.reactor.SessionOutputBufferImpl;
+import org.apache.http.io.HttpTransportMetrics;
 import org.apache.http.nio.reactor.EventMask;
 import org.apache.http.nio.reactor.IOSession;
 import org.apache.http.nio.reactor.SessionBufferStatus;
@@ -143,9 +144,9 @@ public class NHttpConnectionBase
         this.incomingContentStrategy = new LaxContentLengthStrategy();
         this.outgoingContentStrategy = new StrictContentLengthStrategy();
 
-        this.inTransportMetrics = new HttpTransportMetricsImpl();
-        this.outTransportMetrics = new HttpTransportMetricsImpl();
-        this.connMetrics = new HttpConnectionMetricsImpl(
+        this.inTransportMetrics = createTransportMetrics();
+        this.outTransportMetrics = createTransportMetrics();
+        this.connMetrics = createConnectionMetrics(
                 this.inTransportMetrics,
                 this.outTransportMetrics);
 
@@ -154,6 +155,22 @@ public class NHttpConnectionBase
         this.status = ACTIVE;
     }
 
+    /**
+     * @since 4.1
+     */
+    protected HttpTransportMetricsImpl createTransportMetrics() {
+        return new HttpTransportMetricsImpl();
+    }
+
+    /**
+     * @since 4.1
+     */
+    protected HttpConnectionMetricsImpl createConnectionMetrics(
+            final HttpTransportMetrics inTransportMetric,
+            final HttpTransportMetrics outTransportMetric) {
+        return new HttpConnectionMetricsImpl(inTransportMetric, outTransportMetric);
+    }
+
     public int getStatus() {
         return this.status;
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java?rev=964559&r1=964558&r2=964559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/AbstractHttpClientConnection.java
Thu Jul 15 20:08:07 2010
@@ -47,6 +47,7 @@ import org.apache.http.impl.io.HttpRespo
 import org.apache.http.io.EofSensor;
 import org.apache.http.io.HttpMessageParser;
 import org.apache.http.io.HttpMessageWriter;
+import org.apache.http.io.HttpTransportMetrics;
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.io.SessionOutputBuffer;
 import org.apache.http.message.LineFormatter;
@@ -185,6 +186,15 @@ public abstract class AbstractHttpClient
     }
 
     /**
+     * @since 4.1
+     */
+    protected HttpConnectionMetricsImpl createConnectionMetrics(
+            final HttpTransportMetrics inTransportMetric,
+            final HttpTransportMetrics outTransportMetric) {
+        return new HttpConnectionMetricsImpl(inTransportMetric, outTransportMetric);
+    }
+
+    /**
      * Initializes this connection object with {@link SessionInputBuffer} and
      * {@link SessionOutputBuffer} instances to be used for sending and
      * receiving data. These session buffers can be bound to any arbitrary
@@ -221,7 +231,7 @@ public abstract class AbstractHttpClient
                 params);
         this.requestWriter = createRequestWriter(
                 outbuffer, params);
-        this.metrics = new HttpConnectionMetricsImpl(
+        this.metrics = createConnectionMetrics(
                 inbuffer.getMetrics(),
                 outbuffer.getMetrics());
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java?rev=964559&r1=964558&r2=964559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/AbstractHttpServerConnection.java
Thu Jul 15 20:08:07 2010
@@ -47,6 +47,7 @@ import org.apache.http.impl.io.HttpRespo
 import org.apache.http.io.EofSensor;
 import org.apache.http.io.HttpMessageParser;
 import org.apache.http.io.HttpMessageWriter;
+import org.apache.http.io.HttpTransportMetrics;
 import org.apache.http.io.SessionInputBuffer;
 import org.apache.http.io.SessionOutputBuffer;
 import org.apache.http.message.LineFormatter;
@@ -185,6 +186,15 @@ public abstract class AbstractHttpServer
     }
 
     /**
+     * @since 4.1
+     */
+    protected HttpConnectionMetricsImpl createConnectionMetrics(
+            final HttpTransportMetrics inTransportMetric,
+            final HttpTransportMetrics outTransportMetric) {
+        return new HttpConnectionMetricsImpl(inTransportMetric, outTransportMetric);
+    }
+
+    /**
      * Initializes this connection object with {@link SessionInputBuffer} and
      * {@link SessionOutputBuffer} instances to be used for sending and
      * receiving data. These session buffers can be bound to any arbitrary
@@ -221,7 +231,7 @@ public abstract class AbstractHttpServer
                 params);
         this.responseWriter = createResponseWriter(
                 outbuffer, params);
-        this.metrics = new HttpConnectionMetricsImpl(
+        this.metrics = createConnectionMetrics(
                 inbuffer.getMetrics(),
                 outbuffer.getMetrics());
     }

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java?rev=964559&r1=964558&r2=964559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionInputBuffer.java
Thu Jul 15 20:08:07 2010
@@ -102,7 +102,14 @@ public abstract class AbstractSessionInp
                      || this.charset.equalsIgnoreCase(HTTP.ASCII);
         this.maxLineLen = params.getIntParameter(CoreConnectionPNames.MAX_LINE_LENGTH, -1);
         this.minChunkLimit = params.getIntParameter(CoreConnectionPNames.MIN_CHUNK_LIMIT,
512);
-        this.metrics = new HttpTransportMetricsImpl();
+        this.metrics = createTransportMetrics();
+    }
+
+    /**
+     * @since 4.1
+     */
+    protected HttpTransportMetricsImpl createTransportMetrics() {
+        return new HttpTransportMetricsImpl();
     }
 
     /**

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java?rev=964559&r1=964558&r2=964559&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
Thu Jul 15 20:08:07 2010
@@ -94,12 +94,19 @@ public abstract class AbstractSessionOut
         this.ascii = this.charset.equalsIgnoreCase(HTTP.US_ASCII)
                      || this.charset.equalsIgnoreCase(HTTP.ASCII);
         this.minChunkLimit = params.getIntParameter(CoreConnectionPNames.MIN_CHUNK_LIMIT,
512);
-        this.metrics = new HttpTransportMetricsImpl();
+        this.metrics = createTransportMetrics();
     }
 
     /**
      * @since 4.1
      */
+    protected HttpTransportMetricsImpl createTransportMetrics() {
+        return new HttpTransportMetricsImpl();
+    }
+
+    /**
+     * @since 4.`1
+     */
     public int capacity() {
         return this.buffer.capacity();
     }



Mime
View raw message