From 4c990fa2b7eb5405ab41ecde9825c9824e19d680 Mon Sep 17 00:00:00 2001 From: Richard Peter Date: Mon, 15 Oct 2012 20:15:39 -0500 Subject: [PATCH] Issue #1257: Update grib path keys to include hdf5 layout. Turn on TcpNoDelay Change-Id: I296d0d4b1c204a325c499b3aeb1f9d7f16de0c9b Former-commit-id: f5fe7cf872249d5243858488a475747bd1228dab [formerly e32d77c87fe18016d948dc62d1261745c97f0044] [formerly 68ac1abca4d0ad2acd47f73c9974dfa8fb97db17] [formerly c5e3b54caa3cc17f76c8877cef119c7290219b52 [formerly 68ac1abca4d0ad2acd47f73c9974dfa8fb97db17 [formerly 29b54f75013685f1bcd9ed3129c9ba3ddf629395]]] Former-commit-id: c5e3b54caa3cc17f76c8877cef119c7290219b52 Former-commit-id: a0fc10b28ef8f7a0ad614832eb3f6018b40d3685 [formerly a80db469b2a15afd8947cd054964e403d7cb65b4] Former-commit-id: 19797b90641de0762ab916a5fc11f75d9c2bf118 --- .../common_static/base/path/gribPathKeys.xml | 4 ++++ .../com/raytheon/uf/common/comm/HttpClient.java | 17 +++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/path/gribPathKeys.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/path/gribPathKeys.xml index aed0172f4d..3a3d4ebef6 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/path/gribPathKeys.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/path/gribPathKeys.xml @@ -4,5 +4,9 @@ modelInfo.modelName 0 + + modelInfo.level + 1 + diff --git a/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java b/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java index bdab97e071..12a718a8fb 100644 --- a/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java +++ b/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java @@ -109,20 +109,22 @@ public class HttpClient { private ThreadSafeClientConnManager connManager = null; - private NetworkStatistics stats = new NetworkStatistics(); + private final NetworkStatistics stats = new NetworkStatistics(); private boolean gzipRequests = false; private boolean handlingGzipResponses = false; /** number of requests currently in process by the application per host */ - private Map currentRequestsCount = new ConcurrentHashMap(); + private final Map currentRequestsCount = new ConcurrentHashMap(); private HttpClient() { connManager = new ThreadSafeClientConnManager(); DefaultHttpClient client = new DefaultHttpClient(connManager); + client.addRequestInterceptor(new HttpRequestInterceptor() { + @Override public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException { @@ -138,6 +140,7 @@ public class HttpClient { }); client.addResponseInterceptor(new HttpResponseInterceptor() { + @Override public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException { @@ -148,6 +151,8 @@ public class HttpClient { } } }); + HttpConnectionParams.setTcpNoDelay(client.getParams(), true); + this.client = client; previousConnectionFailed = false; } @@ -304,7 +309,7 @@ public class HttpClient { exc = e; } - if (errorMsg != null && exc != null) { + if ((errorMsg != null) && (exc != null)) { if (tries > retryCount) { previousConnectionFailed = true; // close/abort connection @@ -350,7 +355,7 @@ public class HttpClient { private void processResponse(HttpResponse resp, IStreamHandler handlerCallback) throws CommunicationException { InputStream is = null; - if (resp != null && resp.getEntity() != null) { + if ((resp != null) && (resp.getEntity() != null)) { try { is = resp.getEntity().getContent(); handlerCallback.handleStream(is); @@ -668,8 +673,8 @@ public class HttpClient { Header ceheader = entity.getContentEncoding(); if (ceheader != null) { HeaderElement[] codecs = ceheader.getElements(); - for (int i = 0; i < codecs.length; i++) { - if (codecs[i].getName().equalsIgnoreCase("gzip")) { + for (HeaderElement codec : codecs) { + if (codec.getName().equalsIgnoreCase("gzip")) { response.setEntity(new GzipDecompressingEntity(response .getEntity())); return;