Merge remote-tracking branch 'origin/jetty-9.4.x'
This commit is contained in:
commit
873c3554e7
|
@ -37,8 +37,8 @@ node {
|
|||
{
|
||||
stage('Javadoc') {
|
||||
withEnv(mvnEnv) {
|
||||
timeout(time: 15, unit: 'MINUTES') {
|
||||
sh "mvn -B javadoc:javadoc"
|
||||
timeout(time: 20, unit: 'MINUTES') {
|
||||
sh "mvn --offline -B javadoc:javadoc"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -605,13 +605,20 @@ public class DeploymentManager extends ContainerLifeCycle
|
|||
xmlc.getIdMap().put("Server", getServer());
|
||||
Resource home = Resource.newResource(System.getProperty("jetty.home","."));
|
||||
xmlc.getProperties().put("jetty.home",home.toString());
|
||||
xmlc.getProperties().put("jetty.home.uri",home.getURI().toString());
|
||||
xmlc.getProperties().put("jetty.home.uri",normalizeURI(home.getURI().toString()));
|
||||
|
||||
Resource base = Resource.newResource(System.getProperty("jetty.base",home.toString()));
|
||||
xmlc.getProperties().put("jetty.base",base.toString());
|
||||
xmlc.getProperties().put("jetty.base.uri",base.getURI().toString());
|
||||
xmlc.getProperties().put("jetty.base.uri",normalizeURI(base.getURI().toString()));
|
||||
|
||||
xmlc.getProperties().put("jetty.webapp",webapp.toString());
|
||||
xmlc.getProperties().put("jetty.webapps",webapp.getFile().toPath().getParent().toString());
|
||||
}
|
||||
|
||||
private String normalizeURI(String uri)
|
||||
{
|
||||
if (uri.endsWith("/"))
|
||||
return uri.substring(0,uri.length()-1);
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -388,9 +388,13 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
|
|||
SelectableChannel channel = null;
|
||||
try
|
||||
{
|
||||
channel = _selectorManager.doAccept(server);
|
||||
if (channel!=null)
|
||||
while(true)
|
||||
{
|
||||
channel = _selectorManager.doAccept(server);
|
||||
if (channel==null)
|
||||
break;
|
||||
_selectorManager.accepted(channel);
|
||||
}
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
|
@ -534,7 +538,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
|
|||
{
|
||||
try
|
||||
{
|
||||
SelectionKey key = _channel.register(_selector, SelectionKey.OP_ACCEPT, null);
|
||||
SelectionKey key = _channel.register(_selector, SelectionKey.OP_ACCEPT, "Acceptor");
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} acceptor={}", this, key);
|
||||
}
|
||||
|
|
|
@ -148,17 +148,16 @@ public class CookieCutter
|
|||
tokenend=i;
|
||||
quoted=false;
|
||||
|
||||
// handle quote as last character specially
|
||||
if (i==last)
|
||||
if (invalue)
|
||||
value = hdr.substring(tokenstart+1, tokenend).replace("\\\"","\"");
|
||||
else
|
||||
{
|
||||
if (invalue)
|
||||
value = hdr.substring(tokenstart, tokenend+1);
|
||||
else
|
||||
{
|
||||
name = hdr.substring(tokenstart, tokenend+1);
|
||||
name = hdr.substring(tokenstart+1, tokenend).replace("\\\"","\"");
|
||||
if (i==last)
|
||||
value = "";
|
||||
}
|
||||
}
|
||||
tokenstart=-1;
|
||||
tokenend=-1;
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
|
@ -272,11 +271,7 @@ public class CookieCutter
|
|||
|
||||
// If after processing the current character we have a value and a name, then it is a cookie
|
||||
if (value!=null && name!=null)
|
||||
{
|
||||
|
||||
name=QuotedCSV.unquote(name);
|
||||
value=QuotedCSV.unquote(value);
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
if (name.startsWith("$"))
|
||||
|
|
|
@ -1240,14 +1240,14 @@ public class RequestTest
|
|||
response=_connector.getResponse(
|
||||
"GET / HTTP/1.1\n"+
|
||||
"Host: whatever\n"+
|
||||
"Cookie: name=quoted=\"\\\"value\\\"\"\n" +
|
||||
"Cookie: name=quoted=\"\\\"badly\\\"\"\n" +
|
||||
"Connection: close\n"+
|
||||
"\n"
|
||||
);
|
||||
assertTrue(response.startsWith("HTTP/1.1 200 OK"));
|
||||
assertEquals(1,cookies.size());
|
||||
assertEquals("name", cookies.get(0).getName());
|
||||
assertEquals("quoted=\"value\"", cookies.get(0).getValue());
|
||||
assertEquals("quoted=\"\\\"badly\\\"\"", cookies.get(0).getValue());
|
||||
|
||||
cookies.clear();
|
||||
response=_connector.getResponse(
|
||||
|
|
|
@ -299,13 +299,13 @@ public class Main
|
|||
if (!args.getProperties().containsKey(BaseHome.JETTY_HOME))
|
||||
args.getProperties().setProperty(home);
|
||||
args.getProperties().setProperty(BaseHome.JETTY_HOME+".uri",
|
||||
baseHome.getHomePath().toUri().toString(),
|
||||
normalizeURI(baseHome.getHomePath().toUri().toString()),
|
||||
home.origin);
|
||||
Props.Prop base = props.getProp(BaseHome.JETTY_BASE);
|
||||
if (!args.getProperties().containsKey(BaseHome.JETTY_BASE))
|
||||
args.getProperties().setProperty(base);
|
||||
args.getProperties().setProperty(BaseHome.JETTY_BASE+".uri",
|
||||
baseHome.getBasePath().toUri().toString(),
|
||||
normalizeURI(baseHome.getBasePath().toUri().toString()),
|
||||
base.origin);
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
@ -362,6 +362,13 @@ public class Main
|
|||
return args;
|
||||
}
|
||||
|
||||
private String normalizeURI(String uri)
|
||||
{
|
||||
if (uri.endsWith("/"))
|
||||
return uri.substring(0,uri.length()-1);
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void start(StartArgs args) throws IOException, InterruptedException
|
||||
{
|
||||
StartLog.debug("StartArgs: %s",args);
|
||||
|
|
|
@ -70,9 +70,9 @@ public class MainTest
|
|||
// baseHome.getConfigSources().getProps().forEach(p->System.err.println(p));
|
||||
|
||||
assertThat(args.getProperties().getString("jetty.home"),is(baseHome.getHome()));
|
||||
assertThat(args.getProperties().getString("jetty.home.uri"),is(baseHome.getHomePath().toUri().toString()));
|
||||
assertThat(args.getProperties().getString("jetty.home.uri")+"/",is(baseHome.getHomePath().toUri().toString()));
|
||||
assertThat(args.getProperties().getString("jetty.base"),is(baseHome.getBase()));
|
||||
assertThat(args.getProperties().getString("jetty.base.uri"),is(baseHome.getBasePath().toUri().toString()));
|
||||
assertThat(args.getProperties().getString("jetty.base.uri")+"/",is(baseHome.getBasePath().toUri().toString()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<dependency>
|
||||
<groupId>com.github.jnr</groupId>
|
||||
<artifactId>jnr-unixsocket</artifactId>
|
||||
<version>0.15</version>
|
||||
<version>0.18</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
|
|
|
@ -240,10 +240,13 @@ public class UnixSocketConnector extends AbstractConnector
|
|||
{
|
||||
if (_acceptChannel == null)
|
||||
{
|
||||
File file = new File(_unixSocket);
|
||||
file.deleteOnExit();
|
||||
SocketAddress bindAddress = new UnixSocketAddress(file);
|
||||
UnixServerSocketChannel serverChannel = UnixServerSocketChannel.open();
|
||||
SocketAddress bindAddress = new UnixSocketAddress(new File(_unixSocket));
|
||||
serverChannel.socket().bind(bindAddress, getAcceptQueueSize());
|
||||
|
||||
serverChannel.configureBlocking(getAcceptors()>0);
|
||||
serverChannel.socket().bind(bindAddress, getAcceptQueueSize());
|
||||
addBean(serverChannel);
|
||||
|
||||
LOG.debug("opened {}",serverChannel);
|
||||
|
@ -287,7 +290,7 @@ public class UnixSocketConnector extends AbstractConnector
|
|||
@Override
|
||||
public void accept(int acceptorID) throws IOException
|
||||
{
|
||||
LOG.warn("Blocking UnixSocket accept used. Cannot be interrupted!");
|
||||
LOG.debug("Blocking UnixSocket accept used. Might not be able to be interrupted!");
|
||||
UnixServerSocketChannel serverChannel = _acceptChannel;
|
||||
if (serverChannel != null && serverChannel.isOpen())
|
||||
{
|
||||
|
|
|
@ -19,11 +19,15 @@
|
|||
package org.eclipse.jetty.unixsocket;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
|
||||
import org.eclipse.jetty.toolchain.test.IO;
|
||||
|
||||
import jnr.unixsocket.UnixSocketAddress;
|
||||
import jnr.unixsocket.UnixSocketChannel;
|
||||
|
||||
|
@ -32,25 +36,51 @@ public class UnixSocketClient
|
|||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
java.io.File path = new java.io.File("/tmp/jetty.sock");
|
||||
String data = "GET / HTTP/1.1\r\nHost: unixsock\r\n\r\n";
|
||||
UnixSocketAddress address = new UnixSocketAddress(path);
|
||||
UnixSocketChannel channel = UnixSocketChannel.open(address);
|
||||
System.out.println("connected to " + channel.getRemoteSocketAddress());
|
||||
|
||||
PrintWriter w = new PrintWriter(Channels.newOutputStream(channel));
|
||||
InputStreamReader r = new InputStreamReader(Channels.newInputStream(channel));
|
||||
java.io.File content = new java.io.File("/tmp/data.txt");
|
||||
|
||||
String method = "GET";
|
||||
int content_length = 0;
|
||||
String body = null;
|
||||
if (content.exists())
|
||||
{
|
||||
method = "POST";
|
||||
body = IO.readToString(content);
|
||||
content_length = body.length();
|
||||
}
|
||||
String data = method+" / HTTP/1.1\r\n"
|
||||
+ "Host: unixsock\r\n"
|
||||
+ "Content-Length: "+content_length+"\r\n"
|
||||
+ "Connection: close\r\n"
|
||||
+ "\r\n";
|
||||
if (body!=null)
|
||||
data += body;
|
||||
|
||||
while (true)
|
||||
{
|
||||
UnixSocketAddress address = new UnixSocketAddress(path);
|
||||
UnixSocketChannel channel = UnixSocketChannel.open(address);
|
||||
System.out.println("connected to " + channel.getRemoteSocketAddress());
|
||||
|
||||
PrintWriter w = new PrintWriter(new OutputStreamWriter(Channels.newOutputStream(channel),StandardCharsets.ISO_8859_1));
|
||||
InputStreamReader r = new InputStreamReader(Channels.newInputStream(channel));
|
||||
|
||||
w.print(data);
|
||||
w.flush();
|
||||
|
||||
CharBuffer result = CharBuffer.allocate(4096);
|
||||
r.read(result);
|
||||
result.flip();
|
||||
System.out.println("read from server: " + result.toString());
|
||||
|
||||
Thread.sleep(1000);
|
||||
String total="";
|
||||
int l = 0;
|
||||
while (l>=0)
|
||||
{
|
||||
if (l>0)
|
||||
{
|
||||
result.flip();
|
||||
total += result.toString();
|
||||
}
|
||||
result.clear();
|
||||
l = r.read(result);
|
||||
}
|
||||
System.out.println("read from server: " + total);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.unixsocket;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.ProxyConnectionFactory;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
|
||||
public class UnixSocketProxyServer
|
||||
{
|
||||
public static void main (String... args) throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
|
||||
HttpConnectionFactory http = new HttpConnectionFactory();
|
||||
ProxyConnectionFactory proxy = new ProxyConnectionFactory(http.getProtocol());
|
||||
UnixSocketConnector connector = new UnixSocketConnector(server,proxy,http);
|
||||
server.addConnector(connector);
|
||||
|
||||
Path socket = Paths.get(connector.getUnixSocket());
|
||||
if (Files.exists(socket))
|
||||
Files.delete(socket);
|
||||
|
||||
server.setHandler(new AbstractHandler.ErrorDispatchHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
int l = 0;
|
||||
if (request.getContentLength()!=0)
|
||||
{
|
||||
InputStream in = request.getInputStream();
|
||||
byte[] buffer = new byte[4096];
|
||||
int r = 0;
|
||||
while (r>=0)
|
||||
{
|
||||
l += r;
|
||||
r = in.read(buffer);
|
||||
}
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
response.setStatus(200);
|
||||
response.getWriter().write("Hello World "+new Date() + "\r\n");
|
||||
response.getWriter().write("remote="+request.getRemoteAddr()+":"+request.getRemotePort()+"\r\n");
|
||||
response.getWriter().write("local ="+request.getLocalAddr()+":"+request.getLocalPort()+"\r\n");
|
||||
response.getWriter().write("read ="+l+"\r\n");
|
||||
}
|
||||
});
|
||||
|
||||
server.start();
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.sleep(5000);
|
||||
connector.dumpStdErr();
|
||||
}
|
||||
|
||||
// server.join();
|
||||
}
|
||||
}
|
|
@ -19,6 +19,11 @@
|
|||
package org.eclipse.jetty.unixsocket;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -37,26 +42,50 @@ public class UnixSocketServer
|
|||
Server server = new Server();
|
||||
|
||||
HttpConnectionFactory http = new HttpConnectionFactory();
|
||||
ProxyConnectionFactory proxy = new ProxyConnectionFactory(http.getProtocol());
|
||||
UnixSocketConnector connector = new UnixSocketConnector(server,proxy,http);
|
||||
UnixSocketConnector connector = new UnixSocketConnector(server,http);
|
||||
server.addConnector(connector);
|
||||
|
||||
Path socket = Paths.get(connector.getUnixSocket());
|
||||
if (Files.exists(socket))
|
||||
Files.delete(socket);
|
||||
|
||||
server.setHandler(new AbstractHandler.ErrorDispatchHandler()
|
||||
{
|
||||
@Override
|
||||
protected void doNonErrorHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
int l = 0;
|
||||
if (request.getContentLength()!=0)
|
||||
{
|
||||
InputStream in = request.getInputStream();
|
||||
byte[] buffer = new byte[4096];
|
||||
int r = 0;
|
||||
while (r>=0)
|
||||
{
|
||||
l += r;
|
||||
r = in.read(buffer);
|
||||
}
|
||||
}
|
||||
baseRequest.setHandled(true);
|
||||
response.setStatus(200);
|
||||
response.getWriter().write("Hello World\r\n");
|
||||
response.getWriter().write("Hello World "+new Date() + "\r\n");
|
||||
response.getWriter().write("remote="+request.getRemoteAddr()+":"+request.getRemotePort()+"\r\n");
|
||||
response.getWriter().write("local ="+request.getLocalAddr()+":"+request.getLocalPort()+"\r\n");
|
||||
response.getWriter().write("read ="+l+"\r\n");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
server.start();
|
||||
server.join();
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.sleep(5000);
|
||||
System.err.println();
|
||||
System.err.println("==============================");
|
||||
connector.dumpStdErr();
|
||||
}
|
||||
|
||||
// server.join();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,6 @@ org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
|
|||
#org.eclipse.jetty.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.client.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.proxy.LEVEL=DEBUG
|
||||
org.eclipse.jetty.unixsocket.LEVEL=DEBUG
|
||||
org.eclipse.jetty.io.LEVEL=DEBUG
|
||||
org.eclipse.jetty.server.ProxyConnectionFactory.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.unixsocket.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.io.LEVEL=DEBUG
|
||||
#org.eclipse.jetty.server.ProxyConnectionFactory.LEVEL=DEBUG
|
|
@ -51,7 +51,7 @@ public class DelayedStartClientTest
|
|||
assertThat("Container", container, notNullValue());
|
||||
|
||||
List<String> threadNames = getThreadNames();
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("SimpleContainerScope.Executor@"))));
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("WebSocketContainer@"))));
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("HttpClient@"))));
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.net.URI;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
|
@ -175,6 +176,19 @@ public class DelayedStartClientOnServerTest
|
|||
}
|
||||
}
|
||||
|
||||
private void assertNoHttpClientPoolThreads(List<String> threadNames)
|
||||
{
|
||||
for (String threadName : threadNames)
|
||||
{
|
||||
if (threadName.startsWith("HttpClient@") && !threadName.endsWith("-scheduler"))
|
||||
{
|
||||
throw new AssertionError("Found non-scheduler HttpClient thread in <" +
|
||||
threadNames.stream().collect(Collectors.joining("[", ", ", "]"))
|
||||
+ ">");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Using the Server specific techniques of JSR356, configure the WebSocketContainer.
|
||||
*/
|
||||
|
@ -212,8 +226,9 @@ public class DelayedStartClientOnServerTest
|
|||
{
|
||||
server.start();
|
||||
List<String> threadNames = getThreadNames();
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("SimpleContainerScope.Executor@"))));
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("HttpClient@"))));
|
||||
assertNoHttpClientPoolThreads(threadNames);
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("WebSocketContainer@"))));
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("WebSocketClient@"))));
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -221,6 +236,7 @@ public class DelayedStartClientOnServerTest
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testHttpClientThreads_AfterClientConnectTo() throws Exception
|
||||
{
|
||||
|
@ -237,8 +253,8 @@ public class DelayedStartClientOnServerTest
|
|||
String response = GET(server.getURI().resolve("/connect"));
|
||||
assertThat("Response", response, startsWith("Connected to ws://"));
|
||||
List<String> threadNames = getThreadNames();
|
||||
assertThat("Threads", threadNames, hasItem(containsString("SimpleContainerScope.Executor@")));
|
||||
assertThat("Threads", threadNames, hasItem(containsString("HttpClient@")));
|
||||
assertNoHttpClientPoolThreads(threadNames);
|
||||
assertThat("Threads", threadNames, hasItem(containsString("WebSocketContainer@")));
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -262,7 +278,8 @@ public class DelayedStartClientOnServerTest
|
|||
String response = GET(server.getURI().resolve("/connect"));
|
||||
assertThat("Response", response, startsWith("Connected to ws://"));
|
||||
List<String> threadNames = getThreadNames();
|
||||
assertThat("Threads", threadNames, hasItem(containsString("HttpClient@")));
|
||||
assertNoHttpClientPoolThreads(threadNames);
|
||||
assertThat("Threads", threadNames, hasItem(containsString("WebSocketClient@")));
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -286,8 +303,9 @@ public class DelayedStartClientOnServerTest
|
|||
String response = GET(server.getURI().resolve("/configure"));
|
||||
assertThat("Response", response, startsWith("Configured " + ClientContainer.class.getName()));
|
||||
List<String> threadNames = getThreadNames();
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("SimpleContainerScope.Executor@"))));
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("HttpClient@"))));
|
||||
assertNoHttpClientPoolThreads(threadNames);
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("WebSocketContainer@"))));
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("WebSocketClient@"))));
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -311,8 +329,8 @@ public class DelayedStartClientOnServerTest
|
|||
String response = GET(server.getURI().resolve("/configure"));
|
||||
assertThat("Response", response, startsWith("Configured " + ServerContainer.class.getName()));
|
||||
List<String> threadNames = getThreadNames();
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("SimpleContainerScope.Executor@"))));
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("HttpClient@"))));
|
||||
assertNoHttpClientPoolThreads(threadNames);
|
||||
assertThat("Threads", threadNames, not(hasItem(containsString("WebSocketContainer@"))));
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.eclipse.jetty.util.component.ContainerLifeCycle;
|
|||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
import org.eclipse.jetty.util.thread.Scheduler;
|
||||
import org.eclipse.jetty.util.thread.ShutdownThread;
|
||||
import org.eclipse.jetty.websocket.api.Session;
|
||||
|
@ -267,7 +268,17 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
sslContextFactory = new SslContextFactory();
|
||||
}
|
||||
this.httpClient = new HttpClient(sslContextFactory);
|
||||
this.httpClient.setExecutor(scope.getExecutor());
|
||||
Executor executor = scope.getExecutor();
|
||||
if (executor == null)
|
||||
{
|
||||
QueuedThreadPool threadPool = new QueuedThreadPool();
|
||||
String name = "WebSocketClient@" + hashCode();
|
||||
threadPool.setName(name);
|
||||
threadPool.setDaemon(true);
|
||||
executor = threadPool;
|
||||
}
|
||||
|
||||
this.httpClient.setExecutor(executor);
|
||||
addBean(this.httpClient);
|
||||
|
||||
this.extensionRegistry = new WebSocketExtensionFactory(containerScope);
|
||||
|
|
|
@ -55,7 +55,7 @@ public class SimpleContainerScope extends ContainerLifeCycle implements WebSocke
|
|||
this.objectFactory = objectFactory;
|
||||
|
||||
QueuedThreadPool threadPool = new QueuedThreadPool();
|
||||
String name = SimpleContainerScope.class.getSimpleName() + ".Executor@" + hashCode();
|
||||
String name = "WebSocketContainer@" + hashCode();
|
||||
threadPool.setName(name);
|
||||
threadPool.setDaemon(true);
|
||||
this.executor = threadPool;
|
||||
|
|
15
pom.xml
15
pom.xml
|
@ -445,8 +445,9 @@
|
|||
<docfilessubdirs>true</docfilessubdirs>
|
||||
<detectLinks>false</detectLinks>
|
||||
<detectJavaApiLink>false</detectJavaApiLink>
|
||||
<detectOfflineLinks>false</detectOfflineLinks>
|
||||
<show>protected</show>
|
||||
<!-- needed for Java 8+ -->
|
||||
<additionalparam>--allow-script-in-comments</additionalparam>
|
||||
<excludePackageNames>com.acme.*;org.slf4j.*;org.mortbay.*</excludePackageNames>
|
||||
<links>
|
||||
<link>http://docs.oracle.com/javase/8/docs/api/</link>
|
||||
|
@ -1453,18 +1454,6 @@
|
|||
<properties>
|
||||
<alpn.version>8.1.11.v20170118</alpn.version>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Required for Java 8u121 or later -->
|
||||
<additionalparam>--allow-script-in-comments</additionalparam>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>8u131</id>
|
||||
|
|
|
@ -13,25 +13,32 @@
|
|||
<url>http://www.eclipse.org/jetty</url>
|
||||
<packaging>pom</packaging>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- No Point running Findbugs on testing projects -->
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- No point deploying testing projects -->
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- No point building javadoc on testing projects -->
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- No Point running Findbugs on testing projects -->
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.neo4j.build.plugins</groupId>
|
||||
<artifactId>clirr-maven-plugin</artifactId>
|
||||
|
|
Loading…
Reference in New Issue