[Git][java-team/undertow][upstream] New upstream version 2.2.5
Markus Koschany
gitlab at salsa.debian.org
Sat Mar 13 21:50:17 GMT 2021
Markus Koschany pushed to branch upstream at Debian Java Maintainers / undertow
Commits:
4bf240b6 by Markus Koschany at 2021-03-13T22:38:05+01:00
New upstream version 2.2.5
- - - - -
23 changed files:
- benchmarks/pom.xml
- core/pom.xml
- core/src/main/java/io/undertow/Undertow.java
- core/src/main/java/io/undertow/UndertowLogger.java
- core/src/main/java/io/undertow/protocols/ssl/SslConduit.java
- core/src/main/java/io/undertow/protocols/ssl/UndertowAcceptingSslChannel.java
- core/src/main/java/io/undertow/protocols/ssl/UndertowSslConnection.java
- core/src/main/java/io/undertow/protocols/ssl/UndertowXnioSsl.java
- core/src/main/java/io/undertow/server/handlers/PathHandler.java
- core/src/main/java/io/undertow/server/protocol/framed/AbstractFramedChannel.java
- core/src/main/java/io/undertow/util/PathMatcher.java
- + core/src/test/java/io/undertow/server/ssl/DelegatedTaskExecutorTestCase.java
- coverage-report/pom.xml
- dist/pom.xml
- examples/pom.xml
- + jakartaee9/deploy-jakartaee9-artifacts.sh
- jakartaee9/pom.xml
- + karaf/pom.xml
- + karaf/src/main/resources/features.xml
- parser-generator/pom.xml
- pom.xml
- servlet/pom.xml
- websockets-jsr/pom.xml
Changes:
=====================================
benchmarks/pom.xml
=====================================
@@ -25,11 +25,11 @@
<parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-parent</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
</parent>
<artifactId>undertow-benchmarks</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
<name>Undertow Benchmarks</name>
=====================================
core/pom.xml
=====================================
@@ -25,12 +25,12 @@
<parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-parent</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
</parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
<name>Undertow Core</name>
@@ -174,6 +174,32 @@
</testResources>
<plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-manifest</id>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ io.undertow.*;version=${project.version};-noimport:=true
+ </Export-Package>
+ <Import-Package>
+ org.eclipse.jetty.*;resolution:=optional;version="[1,2)",
+ !org.xnio._private,
+ org.xnio.*;version="[3.8,4)",
+ !., !sun.*,
+ *
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@@ -188,6 +214,11 @@
</configuration>
</execution>
</executions>
+ <configuration>
+ <archive>
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
</plugin>
<plugin>
<groupId>org.bitstrings.maven.plugins</groupId>
=====================================
core/src/main/java/io/undertow/Undertow.java
=====================================
@@ -54,6 +54,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
/**
@@ -88,6 +89,7 @@ public final class Undertow {
private ByteBufferPool byteBufferPool;
private XnioWorker worker;
+ private Executor sslEngineDelegatedTaskExecutor;
private List<AcceptingChannel<? extends StreamConnection>> channels;
private Xnio xnio;
@@ -100,6 +102,7 @@ public final class Undertow {
this.listeners.addAll(builder.listeners);
this.rootHandler = builder.handler;
this.worker = builder.worker;
+ this.sslEngineDelegatedTaskExecutor = builder.sslEngineDelegatedTaskExecutor;
this.internalWorker = builder.worker == null;
this.workerOptions = builder.workerOptions.getMap();
this.socketOptions = builder.socketOptions.getMap();
@@ -213,14 +216,18 @@ public final class Undertow {
UndertowXnioSsl xnioSsl;
if (listener.sslContext != null) {
- xnioSsl = new UndertowXnioSsl(xnio, OptionMap.create(Options.USE_DIRECT_BUFFERS, true), listener.sslContext);
+ xnioSsl = new UndertowXnioSsl(xnio, OptionMap.create(Options.USE_DIRECT_BUFFERS, true), listener.sslContext, sslEngineDelegatedTaskExecutor);
} else {
OptionMap.Builder builder = OptionMap.builder()
.addAll(socketOptionsWithOverrides);
if (!socketOptionsWithOverrides.contains(Options.SSL_PROTOCOL)) {
builder.set(Options.SSL_PROTOCOL, "TLSv1.2");
}
- xnioSsl = new UndertowXnioSsl(xnio, OptionMap.create(Options.USE_DIRECT_BUFFERS, true), JsseSslUtils.createSSLContext(listener.keyManagers, listener.trustManagers, new SecureRandom(), builder.getMap()));
+ xnioSsl = new UndertowXnioSsl(
+ xnio,
+ OptionMap.create(Options.USE_DIRECT_BUFFERS, true),
+ JsseSslUtils.createSSLContext(listener.keyManagers, listener.trustManagers, new SecureRandom(), builder.getMap()),
+ sslEngineDelegatedTaskExecutor);
}
AcceptingChannel<? extends StreamConnection> sslServer;
@@ -420,6 +427,7 @@ public final class Undertow {
private final List<ListenerConfig> listeners = new ArrayList<>();
private HttpHandler handler;
private XnioWorker worker;
+ private Executor sslEngineDelegatedTaskExecutor;
private ByteBufferPool byteBufferPool;
private final OptionMap.Builder workerOptions = OptionMap.builder();
@@ -571,6 +579,11 @@ public final class Undertow {
return this;
}
+ public Builder setSslEngineDelegatedTaskExecutor(Executor sslEngineDelegatedTaskExecutor) {
+ this.sslEngineDelegatedTaskExecutor = sslEngineDelegatedTaskExecutor;
+ return this;
+ }
+
public <T> Builder setByteBufferPool(ByteBufferPool byteBufferPool) {
this.byteBufferPool = byteBufferPool;
return this;
=====================================
core/src/main/java/io/undertow/UndertowLogger.java
=====================================
@@ -43,6 +43,7 @@ import java.net.URI;
import java.nio.file.Path;
import java.util.Date;
import java.util.List;
+import java.util.concurrent.RejectedExecutionException;
import static org.jboss.logging.Logger.Level.DEBUG;
import static org.jboss.logging.Logger.Level.ERROR;
@@ -434,4 +435,8 @@ public interface UndertowLogger extends BasicLogger {
@LogMessage(level = DEBUG)
@Message(id = 5094, value = "Blocking write timed out")
void blockingWriteTimedOut(@Cause WriteTimeoutException rte);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 5095, value = "SSLEngine delegated task was rejected")
+ void sslEngineDelegatedTaskRejected(@Cause RejectedExecutionException ree);
}
=====================================
core/src/main/java/io/undertow/protocols/ssl/SslConduit.java
=====================================
@@ -25,6 +25,8 @@ import java.nio.channels.ClosedChannelException;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.Executor;
+import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLEngine;
@@ -132,6 +134,7 @@ public class SslConduit implements StreamSourceConduit, StreamSinkConduit {
private final UndertowSslConnection connection;
private final StreamConnection delegate;
+ private final Executor delegatedTaskExecutor;
private SSLEngine engine;
private final StreamSinkConduit sink;
private final StreamSourceConduit source;
@@ -196,13 +199,14 @@ public class SslConduit implements StreamSourceConduit, StreamSinkConduit {
}
};
- SslConduit(UndertowSslConnection connection, StreamConnection delegate, SSLEngine engine, ByteBufferPool bufferPool, Runnable handshakeCallback) {
+ SslConduit(UndertowSslConnection connection, StreamConnection delegate, SSLEngine engine, Executor delegatedTaskExecutor, ByteBufferPool bufferPool, Runnable handshakeCallback) {
this.connection = connection;
this.delegate = delegate;
this.handshakeCallback = handshakeCallback;
this.sink = delegate.getSinkChannel().getConduit();
this.source = delegate.getSourceChannel().getConduit();
this.engine = engine;
+ this.delegatedTaskExecutor = delegatedTaskExecutor;
this.bufferPool = bufferPool;
delegate.getSourceChannel().getConduit().setReadReadyHandler(readReadyHandler = new SslReadReadyHandler(null));
delegate.getSinkChannel().getConduit().setWriteReadyHandler(writeReadyHandler = new SslWriteReadyHandler(null));
@@ -596,6 +600,10 @@ public class SslConduit implements StreamSourceConduit, StreamSinkConduit {
return delegate.getWorker();
}
+ private Executor getDelegatedTaskExecutor() {
+ return delegatedTaskExecutor == null ? getWorker() : delegatedTaskExecutor;
+ }
+
void notifyWriteClosed() {
if(anyAreSet(state, FLAG_WRITE_CLOSED)) {
return;
@@ -1084,11 +1092,11 @@ public class SslConduit implements StreamSourceConduit, StreamSinkConduit {
}
/**
- * Execute all the tasks in the worker
+ * Execute all the delegated tasks on an executor which allows blocking, the worker executor by default.
*
* Once they are complete we notify any waiting threads and wakeup reads/writes as appropriate
*/
- private void runTasks() {
+ private void runTasks() throws IOException {
//don't run anything in the IO thread till the tasks are done
delegate.getSinkChannel().suspendWrites();
delegate.getSourceChannel().suspendReads();
@@ -1102,7 +1110,7 @@ public class SslConduit implements StreamSourceConduit, StreamSinkConduit {
synchronized (this) {
outstandingTasks += tasks.size();
for (final Runnable task : tasks) {
- getWorker().execute(new Runnable() {
+ Runnable wrappedTask = new Runnable() {
@Override
public void run() {
try {
@@ -1137,13 +1145,46 @@ public class SslConduit implements StreamSourceConduit, StreamSinkConduit {
}
}
}
-
}
- });
+ };
+ try {
+ getDelegatedTaskExecutor().execute(wrappedTask);
+ } catch (RejectedExecutionException e) {
+ UndertowLogger.REQUEST_IO_LOGGER.sslEngineDelegatedTaskRejected(e);
+ IoUtils.safeClose(connection);
+ throw DelegatedTaskRejectedClosedChannelException.INSTANCE;
+ }
}
}
}
+ /**
+ * A specialized {@link ClosedChannelException} which does not provide a stack trace. Tasks may be rejected
+ * when the server is overloaded, so it's important not to create more work than necessary.
+ */
+ private static final class DelegatedTaskRejectedClosedChannelException extends ClosedChannelException {
+
+ private static final DelegatedTaskRejectedClosedChannelException INSTANCE =
+ new DelegatedTaskRejectedClosedChannelException();
+
+ @Override
+ public Throwable fillInStackTrace() {
+ // Avoid the most expensive part of exception creation.
+ return this;
+ }
+
+ // Ignore mutations
+ @Override
+ public Throwable initCause(Throwable ignored) {
+ return this;
+ }
+
+ @Override
+ public void setStackTrace(StackTraceElement[] ignored) {
+ // no-op
+ }
+ }
+
public SSLEngine getSSLEngine() {
return engine;
}
=====================================
core/src/main/java/io/undertow/protocols/ssl/UndertowAcceptingSslChannel.java
=====================================
@@ -208,7 +208,7 @@ class UndertowAcceptingSslChannel implements AcceptingChannel<SslConnection> {
}
protected UndertowSslConnection accept(StreamConnection tcpServer, SSLEngine sslEngine) throws IOException {
- return new UndertowSslConnection(tcpServer, sslEngine, applicationBufferPool);
+ return new UndertowSslConnection(tcpServer, sslEngine, applicationBufferPool, ssl.getDelegatedTaskExecutor());
}
public ChannelListener.Setter<? extends AcceptingChannel<SslConnection>> getCloseSetter() {
=====================================
core/src/main/java/io/undertow/protocols/ssl/UndertowSslConnection.java
=====================================
@@ -32,6 +32,7 @@ import javax.net.ssl.SSLSession;
import java.io.IOException;
import java.net.SocketAddress;
import java.util.Set;
+import java.util.concurrent.Executor;
/**
* @author Stuart Douglas
@@ -50,11 +51,11 @@ class UndertowSslConnection extends SslConnection {
*
* @param delegate the underlying connection
*/
- UndertowSslConnection(StreamConnection delegate, SSLEngine engine, ByteBufferPool bufferPool) {
+ UndertowSslConnection(StreamConnection delegate, SSLEngine engine, ByteBufferPool bufferPool, Executor delegatedTaskExecutor) {
super(delegate.getIoThread());
this.delegate = delegate;
this.engine = engine;
- sslConduit = new SslConduit(this, delegate, engine, bufferPool, new HandshakeCallback());
+ sslConduit = new SslConduit(this, delegate, engine, delegatedTaskExecutor, bufferPool, new HandshakeCallback());
setSourceConduit(sslConduit);
setSinkConduit(sslConduit);
}
=====================================
core/src/main/java/io/undertow/protocols/ssl/UndertowXnioSsl.java
=====================================
@@ -33,6 +33,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SNIHostName;
@@ -78,6 +79,7 @@ public class UndertowXnioSsl extends XnioSsl {
private static final ByteBufferPool DEFAULT_BUFFER_POOL = new DefaultByteBufferPool(true, 17 * 1024, -1, 12);
private final ByteBufferPool bufferPool;
+ private final Executor delegatedTaskExecutor;
private volatile SSLContext sslContext;
/**
@@ -95,7 +97,7 @@ public class UndertowXnioSsl extends XnioSsl {
/**
* Construct a new instance.
- * @param xnio the XNIO instance to associate with
+ * @param xnio the XNIO instance to associate with
* @param optionMap the options for this provider
* @param sslContext the SSL context to use for this instance
*/
@@ -103,6 +105,17 @@ public class UndertowXnioSsl extends XnioSsl {
this(xnio, optionMap, DEFAULT_BUFFER_POOL, sslContext);
}
+ /**
+ * Construct a new instance.
+ * @param xnio the XNIO instance to associate with
+ * @param optionMap the options for this provider
+ * @param sslContext the SSL context to use for this instance
+ * @param delegatedTaskExecutor Executor instance used to run {@link SSLEngine#getDelegatedTask() delegated tasks}.
+ */
+ public UndertowXnioSsl(final Xnio xnio, final OptionMap optionMap, final SSLContext sslContext, final Executor delegatedTaskExecutor) {
+ this(xnio, optionMap, DEFAULT_BUFFER_POOL, sslContext, delegatedTaskExecutor);
+ }
+
/**
* Construct a new instance.
*
@@ -125,9 +138,22 @@ public class UndertowXnioSsl extends XnioSsl {
* @param sslContext the SSL context to use for this instance
*/
public UndertowXnioSsl(final Xnio xnio, final OptionMap optionMap, ByteBufferPool bufferPool, final SSLContext sslContext) {
+ this(xnio, optionMap, bufferPool, sslContext, null);
+ }
+
+ /**
+ * Construct a new instance.
+ * @param xnio the XNIO instance to associate with
+ * @param optionMap the options for this provider
+ * @param bufferPool
+ * @param sslContext the SSL context to use for this instance
+ * @param delegatedTaskExecutor Executor instance used to run {@link SSLEngine#getDelegatedTask() delegated tasks}.
+ */
+ public UndertowXnioSsl(final Xnio xnio, final OptionMap optionMap, ByteBufferPool bufferPool, final SSLContext sslContext, final Executor delegatedTaskExecutor) {
super(xnio, sslContext, optionMap);
this.bufferPool = bufferPool;
this.sslContext = sslContext;
+ this.delegatedTaskExecutor = delegatedTaskExecutor;
}
/**
@@ -140,6 +166,15 @@ public class UndertowXnioSsl extends XnioSsl {
return sslContext;
}
+ /**
+ * Get the {@link Executor} used to run delegated tasks or {@code null} if no executor is configured.
+ *
+ * @return the delegated task executor or null
+ */
+ Executor getDelegatedTaskExecutor() {
+ return delegatedTaskExecutor;
+ }
+
/**
* Get the SSL engine for a given connection.
*
@@ -200,11 +235,11 @@ public class UndertowXnioSsl extends XnioSsl {
}
public SslConnection wrapExistingConnection(StreamConnection connection, OptionMap optionMap) {
- return new UndertowSslConnection(connection, createSSLEngine(sslContext, optionMap, (InetSocketAddress) connection.getPeerAddress(), true), bufferPool);
+ return new UndertowSslConnection(connection, createSSLEngine(sslContext, optionMap, (InetSocketAddress) connection.getPeerAddress(), true), bufferPool, delegatedTaskExecutor);
}
public SslConnection wrapExistingConnection(StreamConnection connection, OptionMap optionMap, boolean clientMode) {
- return new UndertowSslConnection(connection, createSSLEngine(sslContext, optionMap, (InetSocketAddress) connection.getPeerAddress(), clientMode), bufferPool);
+ return new UndertowSslConnection(connection, createSSLEngine(sslContext, optionMap, (InetSocketAddress) connection.getPeerAddress(), clientMode), bufferPool, delegatedTaskExecutor);
}
public SslConnection wrapExistingConnection(StreamConnection connection, OptionMap optionMap, URI destinationURI) {
@@ -214,7 +249,7 @@ public class UndertowXnioSsl extends XnioSsl {
sslParameters.setServerNames(Collections.singletonList(new SNIHostName(destinationURI.getHost())));
sslEngine.setSSLParameters(sslParameters);
}
- return new UndertowSslConnection(connection, sslEngine, bufferPool);
+ return new UndertowSslConnection(connection, sslEngine, bufferPool, delegatedTaskExecutor);
}
private InetSocketAddress getPeerAddress(URI destinationURI) {
@@ -447,7 +482,7 @@ public class UndertowXnioSsl extends XnioSsl {
sslEngine.setSSLParameters(params);
- final SslConnection wrappedConnection = new UndertowSslConnection(connection, sslEngine, bufferPool);
+ final SslConnection wrappedConnection = new UndertowSslConnection(connection, sslEngine, bufferPool, delegatedTaskExecutor);
if (!futureResult.setResult(wrappedConnection)) {
IoUtils.safeClose(connection);
} else {
=====================================
core/src/main/java/io/undertow/server/handlers/PathHandler.java
=====================================
@@ -108,7 +108,7 @@ public class PathHandler implements HttpHandler {
* Adds a path prefix and a handler for that path. If the path does not start
* with a / then one will be prepended.
* <p>
- * The match is done on a prefix bases, so registering /foo will also match /bar. Exact
+ * The match is done on a prefix bases, so registering /foo will also match /foo/bar. Exact
* path matches are taken into account first.
* <p>
* If / is specified as the path then it will replace the default handler.
@@ -129,7 +129,7 @@ public class PathHandler implements HttpHandler {
* <p>
* The match is done on a prefix bases, so registering /foo will also match /foo/bar.
* Though exact path matches are taken into account before prefix path matches. So
- * if an exact path match exists it's handler will be triggered.
+ * if an exact path match exists its handler will be triggered.
* <p>
* If / is specified as the path then it will replace the default handler.
*
=====================================
core/src/main/java/io/undertow/server/protocol/framed/AbstractFramedChannel.java
=====================================
@@ -335,7 +335,7 @@ public abstract class AbstractFramedChannel<C extends AbstractFramedChannel<C, R
}
/**
- * receive method, returns null if no frame is ready. Otherwise returns a
+ * Receive method, returns null if no frame is ready. Otherwise returns a
* channel that can be used to read the frame contents.
* <p>
* Calling this method can also have the side effect of making additional data available to
@@ -948,7 +948,7 @@ public abstract class AbstractFramedChannel<C extends AbstractFramedChannel<C, R
if (listener == null) {
listener = DRAIN_LISTENER;
}
- UndertowLogger.REQUEST_IO_LOGGER.tracef("Invoking receive listener", receiver);
+ UndertowLogger.REQUEST_IO_LOGGER.tracef("Invoking receive listener: %s - receiver: %s", listener, receiver);
ChannelListeners.invokeChannelListener(AbstractFramedChannel.this, listener);
}
final boolean partialRead;
=====================================
core/src/main/java/io/undertow/util/PathMatcher.java
=====================================
@@ -112,7 +112,7 @@ public class PathMatcher<T> {
* Adds a path prefix and a handler for that path. If the path does not start
* with a / then one will be prepended.
* <p>
- * The match is done on a prefix bases, so registering /foo will also match /bar. Exact
+ * The match is done on a prefix bases, so registering /foo will also match /foo/bar. Exact
* path matches are taken into account first.
* <p>
* If / is specified as the path then it will replace the default handler.
=====================================
core/src/test/java/io/undertow/server/ssl/DelegatedTaskExecutorTestCase.java
=====================================
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2021 Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.undertow.server.ssl;
+
+
+import io.undertow.Undertow;
+import io.undertow.server.handlers.ResponseCodeHandler;
+import io.undertow.testutils.DefaultServer;
+import io.undertow.testutils.TestHttpClient;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.junit.Test;
+
+import javax.net.ssl.SSLHandshakeException;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * @author Carter Kozak
+ */
+public class DelegatedTaskExecutorTestCase {
+
+ @Test
+ public void testDelegatedTaskExecutorIsUsed() throws Exception {
+ ExecutorService delegatedTaskExecutor = Executors.newSingleThreadExecutor();
+ AtomicInteger counter = new AtomicInteger();
+ Undertow undertow = Undertow.builder()
+ .addHttpsListener(0, null, DefaultServer.getServerSslContext())
+ .setSslEngineDelegatedTaskExecutor(task -> {
+ counter.getAndIncrement();
+ delegatedTaskExecutor.execute(task);
+ })
+ .setHandler(ResponseCodeHandler.HANDLE_200)
+ .build();
+
+ TestHttpClient client = new TestHttpClient();
+ client.setSSLContext(DefaultServer.getClientSSLContext());
+ undertow.start();
+ int port = port(undertow);
+ try(CloseableHttpResponse response = client.execute(new HttpGet("https://localhost:" + port))) {
+ assertEquals(200, response.getStatusLine().getStatusCode());
+ assertTrue("expected interactions with the delegated task executor", counter.get() > 0);
+ } finally {
+ undertow.stop();
+ client.getConnectionManager().shutdown();
+ delegatedTaskExecutor.shutdownNow();
+ assertTrue(
+ "ExecutorService did not shut down in time",
+ delegatedTaskExecutor.awaitTermination(1, TimeUnit.SECONDS));
+ }
+ }
+
+ @Test
+ public void testRejection() {
+ Undertow undertow = Undertow.builder()
+ .addHttpsListener(0, null, DefaultServer.getServerSslContext())
+ .setSslEngineDelegatedTaskExecutor(ignoredTask -> {
+ throw new RejectedExecutionException();
+ })
+ .setHandler(ResponseCodeHandler.HANDLE_200)
+ .build();
+
+ TestHttpClient client = new TestHttpClient();
+ client.setSSLContext(DefaultServer.getClientSSLContext());
+ undertow.start();
+ try {
+ int port = port(undertow);
+ HttpGet request = new HttpGet("https://localhost:" + port);
+ try {
+ client.execute(request);
+ fail("Expected an exception");
+ } catch (SSLHandshakeException handshakeException) {
+ // expected one of:
+ // - Remote host closed connection during handshake
+ // - Remote host terminated the handshake
+ // This exception comes from the jvm and may change in future
+ // releases so we don't verify an exact match.
+ String message = handshakeException.getMessage();
+ System.out.println(message);
+ assertTrue(
+ "message was: " + message,
+ message != null && (message.contains("closed") || message.contains("terminated")));
+ } catch (IOException e) {
+ throw new AssertionError(e);
+ }
+ } finally {
+ undertow.stop();
+ client.getConnectionManager().shutdown();
+ }
+ }
+
+ private static int port(Undertow undertow) {
+ if (undertow.getListenerInfo().size() != 1) {
+ throw new IllegalStateException("Expected exactly one listener");
+ }
+ InetSocketAddress address = (InetSocketAddress) undertow.getListenerInfo().get(0).getAddress();
+ return address.getPort();
+ }
+}
=====================================
coverage-report/pom.xml
=====================================
@@ -3,7 +3,7 @@
<parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-parent</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
</parent>
<artifactId>undertow-coverage-report</artifactId>
<name>Undertow Test Coverage Report</name>
=====================================
dist/pom.xml
=====================================
@@ -25,12 +25,12 @@
<parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-parent</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
</parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-dist</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
<name>Undertow: Distribution</name>
=====================================
examples/pom.xml
=====================================
@@ -25,12 +25,12 @@
<parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-parent</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
</parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-examples</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
<name>Undertow Examples</name>
=====================================
jakartaee9/deploy-jakartaee9-artifacts.sh
=====================================
@@ -0,0 +1,55 @@
+#!/bin/sh
+# file: deploy-jakartaee9-artifacts.sh
+#
+# JBoss, Home of Professional Open Source.
+# Copyright 2021 Red Hat, Inc., and individual contributors
+# as indicated by the @author tags.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+deploy_artifact(){
+ version=$1
+ module=$2
+
+ jakarta_dir=$(pwd)
+ jar_file=$jakarta_dir/target/output/undertow-$module-jakartaee9-$version.jar
+ pom_file=$jakarta_dir/target/output/undertow-$module-jakartaee9-$version.pom
+ if [ -e $jakarta_dir/../$module/target/undertow-$module-sources.jar ]
+ then
+ sources_file=$jakarta_dir/../$module/target/undertow-$module-sources.jar
+ else
+ sources_file=$jakarta_dir/../$module/target/undertow-$module-$version-sources.jar
+ fi
+
+ check_file_exists $jar_file
+ check_file_exists $pom_file
+ check_file_exists $sources_file
+
+ mvn deploy:deploy-file -DrepositoryId=jboss-releases-repository -Durl=https://repository.jboss.org/nexus/service/local/staging/deploy/maven2 -DaltDeploymentRepository=jboss-releases-repository::default::https://repository.jboss.org/nexus/service/local/staging/deploy/maven2 -Pjboss-release -Drelease -Dfile=$jar_file -DpomFile=$pom_file -Dsources=$sources_file
+}
+
+check_file_exists(){
+ if ! [ -e $1 ]
+ then
+ echo "ERROR: File $1 not found"
+ exit 1
+ fi
+}
+
+version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
+deploy_artifact $version "servlet"
+deploy_artifact $version "websockets-jsr"
+deploy_artifact $version "examples"
+
+
=====================================
jakartaee9/pom.xml
=====================================
@@ -25,12 +25,12 @@
<parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-parent</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
</parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-jakartaee9</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
<name>Undertow Jakarta EE9</name>
=====================================
karaf/pom.xml
=====================================
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2012 Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>io.undertow</groupId>
+ <artifactId>undertow-parent</artifactId>
+ <version>2.2.5.Final</version>
+ </parent>
+
+ <groupId>io.undertow</groupId>
+ <artifactId>karaf</artifactId>
+ <version>2.2.5.Final</version>
+
+ <name>Undertow Karaf feature</name>
+
+ <packaging>pom</packaging>
+
+ <properties>
+ <version.karaf.plugin>4.2.10</version.karaf.plugin>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.karaf.features</groupId>
+ <artifactId>framework</artifactId>
+ <type>kar</type>
+ <scope>provided</scope>
+ <version>${version.karaf.plugin}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <version>${version.karaf.plugin}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>verify</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>mvn:org.apache.karaf.features/framework/${version.karaf.plugin}/xml/features</descriptor>
+ <descriptor>mvn:org.apache.karaf.features/standard/${version.karaf.plugin}/xml/features</descriptor>
+ <descriptor>file:${project.build.directory}/classes/features.xml</descriptor>
+ </descriptors>
+ <distribution>org.apache.karaf.features:framework</distribution>
+ <javase>1.8</javase>
+ <framework>
+ <feature>framework</feature>
+ </framework>
+ <features>
+ <feature>undertow</feature>
+ </features>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>target/classes/features.xml</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
=====================================
karaf/src/main/resources/features.xml
=====================================
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2012 Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<features name="io.undertow-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
+
+ <feature name="undertow" version="${project.version}">
+ <bundle dependency="true">mvn:org.jboss.spec.javax.annotation/jboss-annotations-api_1.3_spec/${version.org.jboss.spec.javax.annotation.jboss-annotations-api_1.3_spec}</bundle>
+ <bundle dependency="true">mvn:org.jboss.spec.javax.servlet/jboss-servlet-api_4.0_spec/${version.org.jboss.spec.javax.servlet.jboss-servlet-api_4.0_spec}</bundle>
+ <bundle dependency="true">mvn:org.jboss.spec.javax.websocket/jboss-websocket-api_1.1_spec/${version.org.jboss.spec.javax.websockets}</bundle>
+
+ <bundle>mvn:org.jboss.xnio/xnio-api/${version.xnio}</bundle>
+ <bundle>mvn:org.jboss.xnio/xnio-nio/${version.xnio}</bundle>
+ <bundle>mvn:io.undertow/undertow-core/${project.version}</bundle>
+ <bundle>mvn:io.undertow/undertow-servlet/${project.version}</bundle>
+ <bundle>mvn:io.undertow/undertow-websockets-jsr/${project.version}</bundle>
+
+ <bundle dependency="true">wrap:mvn:org.jboss.threads/jboss-threads/${version.org.jboss.threads}</bundle>
+ <bundle dependency="true">wrap:mvn:org.wildfly.common/wildfly-common/${version.org.wildfly.common}$Export-Package=org.wildfly.common.*;-noimport:=true;version="${version.org.wildfly.common}"</bundle>
+ <bundle dependency="true">mvn:org.wildfly.client/wildfly-client-config/${version.org.wildfly.client-config}</bundle>
+ </feature>
+
+</features>
=====================================
parser-generator/pom.xml
=====================================
@@ -25,12 +25,12 @@
<parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-parent</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
</parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-parser-generator</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
<name>Undertow Parser Generator</name>
<description>An annotation processor that is used to generate the HTTP parser</description>
=====================================
pom.xml
=====================================
@@ -28,7 +28,7 @@
<groupId>io.undertow</groupId>
<artifactId>undertow-parent</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
<name>Undertow</name>
<description>Undertow</description>
@@ -77,6 +77,7 @@
<!-- TODO remove this dependency once xnio upgrades to latest jboss threads -->
<version.org.jboss.threads>3.1.0.Final</version.org.jboss.threads>
<version.org.wildfly.common>1.5.4.Final</version.org.wildfly.common>
+ <version.org.wildfly.client-config>1.0.1.Final</version.org.wildfly.client-config>
<!-- jacoco -->
<version.org.jacoco>0.7.9</version.org.jacoco>
@@ -99,6 +100,7 @@
<!-- Non-default maven plugin versions and configuration -->
<version.org.wildfly.openssl>1.0.4.Final</version.org.wildfly.openssl>
<version.checkstyle>7.1</version.checkstyle>
+ <version.bundle.plugin>5.1.1</version.bundle.plugin>
<version.jmh>1.21</version.jmh>
@@ -267,6 +269,11 @@
</lifecycleMappingMetadata>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${version.bundle.plugin}</version>
+ </plugin>
</plugins>
</pluginManagement>
</build>
@@ -651,6 +658,18 @@
<test.categories>NOT io.undertow.testutils.category.UnitTest</test.categories>
</properties>
</profile>
+
+ <profile>
+ <id>osgi</id>
+ <activation>
+ <property>
+ <name>osgi</name>
+ </property>
+ </activation>
+ <modules>
+ <module>karaf</module>
+ </modules>
+ </profile>
</profiles>
</project>
=====================================
servlet/pom.xml
=====================================
@@ -25,12 +25,12 @@
<parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-parent</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
</parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-servlet</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
<name>Undertow Servlet</name>
@@ -154,6 +154,30 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-manifest</id>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ io.undertow.servlet*;version=${project.version};-noimport:=true
+ </Export-Package>
+ <Import-Package>
+ javax.annotation.security;version="[1.2,3)",
+ !sun.*,
+ *
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
@@ -168,6 +192,11 @@
</configuration>
</execution>
</executions>
+ <configuration>
+ <archive>
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
=====================================
websockets-jsr/pom.xml
=====================================
@@ -25,12 +25,12 @@
<parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-parent</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
</parent>
<groupId>io.undertow</groupId>
<artifactId>undertow-websockets-jsr</artifactId>
- <version>2.2.4.Final</version>
+ <version>2.2.5.Final</version>
<name>Undertow WebSockets JSR356 implementations</name>
@@ -128,6 +128,38 @@
</testResources>
<plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-manifest</id>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ io.undertow.websockets.jsr*;version=${project.version};-noimport:=true
+ </Export-Package>
+ <Import-Package>
+ !sun.*,
+ *
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
View it on GitLab: https://salsa.debian.org/java-team/undertow/-/commit/4bf240b6da6d7b391589fc44acfbdf3eb829b428
--
View it on GitLab: https://salsa.debian.org/java-team/undertow/-/commit/4bf240b6da6d7b391589fc44acfbdf3eb829b428
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20210313/298333d0/attachment.htm>
More information about the pkg-java-commits
mailing list