File tree Expand file tree Collapse file tree
core/src/main/java/com/github/jsonldjava/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,13 +111,14 @@ public static InputStream openStreamFromURL(java.net.URL url) throws IOException
111111 }
112112
113113 public static HttpClient getHttpClient () {
114- if (httpClient == null ) {
114+ HttpClient result = httpClient ;
115+ if (result == null ) {
115116 synchronized (JSONUtils .class ) {
116- if (httpClient == null ) {
117+ result = httpClient ;
118+ if (result == null ) {
117119 // Uses Apache SystemDefaultHttpClient rather than
118120 // DefaultHttpClient, thus the normal proxy settings for the
119- // JVM
120- // will be used
121+ // JVM will be used
121122
122123 final DefaultHttpClient client = new SystemDefaultHttpClient ();
123124 // Support compressed data
@@ -129,10 +130,11 @@ public static HttpClient getHttpClient() {
129130 cacheConfig .setMaxCacheEntries (1000 );
130131 // and allow caching
131132 httpClient = new CachingHttpClient (client , cacheConfig );
133+ result = httpClient ;
132134 }
133135 }
134136 }
135- return httpClient ;
137+ return result ;
136138 }
137139
138140 public static void setHttpClient (HttpClient nextHttpClient ) {
You can’t perform that action at this time.
0 commit comments