Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2014-02-24 22:44:08 +0000
committerSimone Bordet2014-02-24 22:44:21 +0000
commit4031bc7f3ba70dc1d9b43823336b98760d410ab0 (patch)
tree14140c305b4096c5545927c91d0bf57b41bfcd5c /jetty-websocket/websocket-api/src
parent41230011588f33e239cbf0149a9f671866691637 (diff)
downloadorg.eclipse.jetty.project-4031bc7f3ba70dc1d9b43823336b98760d410ab0.tar.gz
org.eclipse.jetty.project-4031bc7f3ba70dc1d9b43823336b98760d410ab0.tar.xz
org.eclipse.jetty.project-4031bc7f3ba70dc1d9b43823336b98760d410ab0.zip
Reduced websocket memory footprint by releasing the HTTP machinery
(request and response) after the upgrade.
Diffstat (limited to 'jetty-websocket/websocket-api/src')
-rw-r--r--jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java23
1 files changed, 8 insertions, 15 deletions
diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java
index c76dd5419a..81059efbc3 100644
--- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java
+++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/UpgradeRequest.java
@@ -34,16 +34,16 @@ import org.eclipse.jetty.websocket.api.util.QuoteUtil;
public class UpgradeRequest
{
private URI requestURI;
- private List<String> subProtocols = new ArrayList<>();
- private List<ExtensionConfig> extensions = new ArrayList<>();
- private List<HttpCookie> cookies = new ArrayList<>();
+ private List<String> subProtocols = new ArrayList<>(1);
+ private List<ExtensionConfig> extensions = new ArrayList<>(1);
+ private List<HttpCookie> cookies = new ArrayList<>(1);
private Map<String, List<String>> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
- private Map<String, List<String>> parameters = new HashMap<>();
+ private Map<String, List<String>> parameters = new HashMap<>(1);
private Object session;
private String httpVersion;
private String method;
private String host;
- private boolean secure = false;
+ private boolean secure;
protected UpgradeRequest()
{
@@ -57,16 +57,12 @@ public class UpgradeRequest
public UpgradeRequest(URI requestURI)
{
- this();
setRequestURI(requestURI);
}
public void addExtensions(ExtensionConfig... configs)
{
- for (ExtensionConfig config : configs)
- {
- extensions.add(config);
- }
+ Collections.addAll(extensions, configs);
}
public void addExtensions(String... configs)
@@ -357,10 +353,7 @@ public class UpgradeRequest
*/
public void setSubProtocols(String... protocols)
{
- this.subProtocols.clear();
- for (String protocol : protocols)
- {
- this.subProtocols.add(protocol);
- }
+ subProtocols.clear();
+ Collections.addAll(subProtocols, protocols);
}
}

Back to the top