hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1778410 - /httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/
Date Thu, 12 Jan 2017 10:07:41 GMT
Author: olegk
Date: Thu Jan 12 10:07:41 2017
New Revision: 1778410

URL: http://svn.apache.org/viewvc?rev=1778410&view=rev
Log:
HTTPCLIENT-1777: fixed binary compatibility with 4.4

Added:
    httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingHttpClientBuilderFactory.java
  (contents, props changed)
      - copied, changed from r1778409, httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingClientBuilderFactory.java
    httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiHttpClientBuilderFactory.java
      - copied, changed from r1778409, httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiClientBuilderFactory.java
Removed:
    httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingClientBuilderFactory.java
Modified:
    httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/HttpProxyConfigurationActivator.java
    httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiClientBuilderFactory.java

Modified: httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/HttpProxyConfigurationActivator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/HttpProxyConfigurationActivator.java?rev=1778410&r1=1778409&r2=1778410&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/HttpProxyConfigurationActivator.java
(original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/HttpProxyConfigurationActivator.java
Thu Jan 12 10:07:41 2017
@@ -100,7 +100,7 @@ public final class HttpProxyConfiguratio
         props.put(Constants.SERVICE_VENDOR, context.getBundle().getHeaders().get(Constants.BUNDLE_VENDOR));
         props.put(Constants.SERVICE_DESCRIPTION, BUILDER_FACTORY_SERVICE_NAME);
         clientFactory = context.registerService(HttpClientBuilderFactory.class.getName(),
-                                                new OSGiClientBuilderFactory(configurator,
httpClientTracker),
+                                                new OSGiHttpClientBuilderFactory(configurator,
httpClientTracker),
                                                 props);
 
         props.clear();
@@ -108,7 +108,7 @@ public final class HttpProxyConfiguratio
         props.put(Constants.SERVICE_VENDOR, context.getBundle().getHeaders().get(Constants.BUNDLE_VENDOR));
         props.put(Constants.SERVICE_DESCRIPTION, CACHEABLE_BUILDER_FACTORY_SERVICE_NAME);
         cachingClientFactory = context.registerService(CachingHttpClientBuilderFactory.class.getName(),
-                                                       new OSGiCachingClientBuilderFactory(configurator,
httpClientTracker),
+                                                       new OSGiCachingHttpClientBuilderFactory(configurator,
httpClientTracker),
                                                        props);
     }
 

Copied: httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingHttpClientBuilderFactory.java
(from r1778409, httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingClientBuilderFactory.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingHttpClientBuilderFactory.java?p2=httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingHttpClientBuilderFactory.java&p1=httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingClientBuilderFactory.java&r1=1778409&r2=1778410&rev=1778410&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingClientBuilderFactory.java
(original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingHttpClientBuilderFactory.java
Thu Jan 12 10:07:41 2017
@@ -30,16 +30,13 @@ import org.apache.http.impl.client.Close
 import org.apache.http.impl.client.cache.CachingHttpClientBuilder;
 import org.apache.http.osgi.services.CachingHttpClientBuilderFactory;
 
-/**
- * @since 4.3
- */
-final class OSGiCachingClientBuilderFactory implements CachingHttpClientBuilderFactory {
+final class OSGiCachingHttpClientBuilderFactory implements CachingHttpClientBuilderFactory
{
 
     private final HttpClientBuilderConfigurator configurator;
 
     private final HttpProxyConfigurationActivator.HttpClientTracker httpClientTracker;
 
-    OSGiCachingClientBuilderFactory(
+    OSGiCachingHttpClientBuilderFactory(
             final HttpClientBuilderConfigurator configurator,
             final HttpProxyConfigurationActivator.HttpClientTracker httpClientTracker) {
         this.configurator = configurator;

Propchange: httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingHttpClientBuilderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingHttpClientBuilderFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiCachingHttpClientBuilderFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiClientBuilderFactory.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiClientBuilderFactory.java?rev=1778410&r1=1778409&r2=1778410&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiClientBuilderFactory.java
(original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiClientBuilderFactory.java
Thu Jan 12 10:07:41 2017
@@ -26,35 +26,50 @@
  */
 package org.apache.http.osgi.impl;
 
+import java.util.List;
+import java.util.Map;
+
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.osgi.services.HttpClientBuilderFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
 
 /**
  * @since 4.3
+ *
+ * @deprecated (4.5). No longer used.
  */
-final class OSGiClientBuilderFactory implements HttpClientBuilderFactory {
+@Deprecated
+public final class OSGiClientBuilderFactory implements HttpClientBuilderFactory {
+
+    private final BundleContext bundleContext;
 
-    private final HttpClientBuilderConfigurator configurator;
+    private final Map<String, ServiceRegistration> registeredConfigurations;
 
-    private final HttpProxyConfigurationActivator.HttpClientTracker httpClientTracker;
+    private final List<CloseableHttpClient> trackedHttpClients;
 
-    OSGiClientBuilderFactory(
-            final HttpClientBuilderConfigurator configurator,
-            final HttpProxyConfigurationActivator.HttpClientTracker httpClientTracker) {
-        this.configurator = configurator;
-        this.httpClientTracker = httpClientTracker;
+    public OSGiClientBuilderFactory(
+            final BundleContext bundleContext,
+            final Map<String, ServiceRegistration> registeredConfigurations,
+            final List<CloseableHttpClient> trackedHttpClients) {
+        this.bundleContext = bundleContext;
+        this.registeredConfigurations = registeredConfigurations;
+        this.trackedHttpClients = trackedHttpClients;
     }
 
     @Override
     public HttpClientBuilder newBuilder() {
-        return configurator.configure(new HttpClientBuilder() {
+        return new HttpClientBuilder() {
             @Override
             public CloseableHttpClient build() {
-                final CloseableHttpClient client = super.build();
-                httpClientTracker.track(client);
-                return client;
+                final CloseableHttpClient httpClient = super.build();
+                synchronized (trackedHttpClients) {
+                    trackedHttpClients.add(httpClient);
+                }
+                return httpClient;
             }
-        });
+        };
     }
+
 }

Copied: httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiHttpClientBuilderFactory.java
(from r1778409, httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiClientBuilderFactory.java)
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiHttpClientBuilderFactory.java?p2=httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiHttpClientBuilderFactory.java&p1=httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiClientBuilderFactory.java&r1=1778409&r2=1778410&rev=1778410&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiClientBuilderFactory.java
(original)
+++ httpcomponents/httpclient/branches/4.5.x/httpclient-osgi/src/main/java/org/apache/http/osgi/impl/OSGiHttpClientBuilderFactory.java
Thu Jan 12 10:07:41 2017
@@ -30,16 +30,13 @@ import org.apache.http.impl.client.Close
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.osgi.services.HttpClientBuilderFactory;
 
-/**
- * @since 4.3
- */
-final class OSGiClientBuilderFactory implements HttpClientBuilderFactory {
+final class OSGiHttpClientBuilderFactory implements HttpClientBuilderFactory {
 
     private final HttpClientBuilderConfigurator configurator;
 
     private final HttpProxyConfigurationActivator.HttpClientTracker httpClientTracker;
 
-    OSGiClientBuilderFactory(
+    OSGiHttpClientBuilderFactory(
             final HttpClientBuilderConfigurator configurator,
             final HttpProxyConfigurationActivator.HttpClientTracker httpClientTracker) {
         this.configurator = configurator;



Mime
View raw message