Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x

This commit is contained in:
Joakim Erdfelt 2018-11-21 10:45:05 -06:00
commit 21f66bb972
5 changed files with 79 additions and 212 deletions

View File

@ -1,92 +1,51 @@
<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/maven-v4_0_0.xsd">
<groupId>org.eclipse.jetty</groupId>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-bom</artifactId>
<version>10.0.0-SNAPSHOT</version>
<name>Jetty :: Bom</name>
<description>Jetty BOM artifact</description>
<url>http://www.eclipse.org/jetty</url>
<inceptionYear>1995</inceptionYear>
<packaging>pom</packaging>
<issueManagement>
<system>github</system>
<url>https://github.com/eclipse/jetty.project/issues</url>
</issueManagement>
<licenses>
<license>
<name>Apache Software License - Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
</license>
<license>
<name>Eclipse Public License - Version 1.0</name>
<url>http://www.eclipse.org/org/documents/epl-v10.php</url>
</license>
</licenses>
<properties>
<jetty.url>http://www.eclipse.org/jetty</jetty.url>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<build-support.version>1.4</build-support.version>
</properties>
<scm>
<connection>scm:git:https://github.com/eclipse/jetty.project.git</connection>
<developerConnection>scm:git:git@github.com:eclipse/jetty.project.git</developerConnection>
<url>https://github.com/eclipse/jetty.project</url>
</scm>
<distributionManagement>
<repository>
<id>oss.sonatype.org</id>
<name>Jetty Staging Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<snapshotRepository>
<id>oss.sonatype.org</id>
<name>Jetty Snapshot Repository</name>
<url>https://oss.sonatype.org/content/repositories/jetty-snapshots/</url>
</snapshotRepository>
<site>
<id>jetty.eclipse.website</id>
<url>scp://build.eclipse.org:/home/data/httpd/download.eclipse.org/jetty/${project.version}/</url>
</site>
</distributionManagement>
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>10.0.0-SNAPSHOT</version>
</parent>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<goals>deploy</goals>
<arguments>-Peclipse-release</arguments>
<preparationGoals>clean install</preparationGoals>
<mavenExecutorId>forked-path</mavenExecutorId>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<skipSource>true</skipSource>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.0.1</version>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<flattenedPomFilename>flattened-pom.xml</flattenedPomFilename>
<flattenMode>bom</flattenMode>
<updatePomFile>true</updatePomFile>
<pomElements>
<build>remove</build>
<properties>remove</properties>
</pomElements>
</configuration>
<executions>
<execution>
<id>flatten</id>
<goals>
<goal>flatten</goal>
</goals>
<phase>process-resources</phase>
</execution>
<execution>
<id>flatten-clean</id>
<goals>
<goal>clean</goal>
</goals>
<phase>clean</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencyManagement>
@ -397,85 +356,4 @@
</dependency>
</dependencies>
</dependencyManagement>
<developers>
<developer>
<id>gregw</id>
<name>Greg Wilkins</name>
<email>gregw@webtide.com</email>
<organization>Webtide, LLC</organization>
<organizationUrl>https://webtide.com</organizationUrl>
<timezone>10</timezone>
</developer>
<developer>
<id>janb</id>
<name>Jan Bartel</name>
<email>janb@webtide.com</email>
<organization>Webtide, LLC</organization>
<organizationUrl>https://webtide.com</organizationUrl>
<timezone>10</timezone>
</developer>
<developer>
<id>jesse</id>
<name>Jesse McConnell</name>
<email>jesse.mcconnell@gmail.com</email>
<organization>Webtide, LLC</organization>
<organizationUrl>https://webtide.com</organizationUrl>
<timezone>-6</timezone>
</developer>
<developer>
<id>joakime</id>
<name>Joakim Erdfelt</name>
<email>joakim.erdfelt@gmail.com</email>
<organization>Webtide, LLC</organization>
<organizationUrl>https://webtide.com</organizationUrl>
<timezone>-6</timezone>
</developer>
<developer>
<id>sbordet</id>
<name>Simone Bordet</name>
<email>simone.bordet@gmail.com</email>
<organization>Webtide, LLC</organization>
<organizationUrl>https://webtide.com</organizationUrl>
<timezone>1</timezone>
</developer>
<developer>
<id>djencks</id>
<name>David Jencks</name>
<email>david.a.jencks@gmail.com</email>
<organization>IBM</organization>
<timezone>-8</timezone>
</developer>
</developers>
<profiles>
<profile>
<id>eclipse-release</id>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<updateReleaseInfo>true</updateReleaseInfo>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -20,7 +20,6 @@ package org.eclipse.jetty.client.http;
import java.io.EOFException;
import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.HttpExchange;
@ -40,7 +39,6 @@ import org.eclipse.jetty.util.CompletableCallback;
public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.ResponseHandler
{
private final AtomicReference<ContentState> handlingContent = new AtomicReference<>(ContentState.IDLE);
private final HttpParser parser;
private ByteBuffer buffer;
private boolean shutdown;
@ -265,18 +263,8 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
if (exchange == null)
return false;
handlingContent.set(ContentState.CONTENT);
CompletableCallback callback = new CompletableCallback()
{
@Override
public void succeeded()
{
boolean messageComplete = !handlingContent.compareAndSet(ContentState.CONTENT, ContentState.IDLE);
super.succeeded();
if (messageComplete)
messageComplete();
}
@Override
public void resume()
{
@ -316,9 +304,6 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
@Override
public boolean messageComplete()
{
if (handlingContent.compareAndSet(ContentState.CONTENT, ContentState.COMPLETE))
return false;
HttpExchange exchange = getHttpExchange();
if (exchange == null)
return false;
@ -390,6 +375,4 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
{
return String.format("%s[%s]", super.toString(), parser);
}
private enum ContentState { IDLE, CONTENT, COMPLETE }
}

View File

@ -1638,16 +1638,14 @@ public class HttpParser
_contentPosition += _contentChunk.remaining();
buffer.position(buffer.position()+_contentChunk.remaining());
boolean handle = _handler.content(_contentChunk);
if (_handler.content(_contentChunk))
return true;
if(_contentPosition == _contentLength)
{
setState(State.END);
boolean handleContent = handleContentMessage();
return handle || handleContent;
return handleContentMessage();
}
else if (handle)
return true;
}
break;
}

View File

@ -31,7 +31,6 @@ import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.thread.Invocable;
import org.eclipse.jetty.util.thread.Locker;
import org.eclipse.jetty.util.thread.Scheduler;
/**
@ -426,21 +425,11 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
public String toEndPointString()
{
// We do a best effort to print the right toString() and that's it.
try
{
boolean valid = _key != null && _key.isValid();
int keyInterests = valid ? _key.interestOps() : -1;
int keyReadiness = valid ? _key.readyOps() : -1;
return String.format("%s{io=%d/%d,kio=%d,kro=%d}",
super.toEndPointString(),
_currentInterestOps,
_desiredInterestOps,
keyInterests,
keyReadiness);
}
catch (Throwable x)
{
return String.format("%s{io=%s,kio=-2,kro=-2}", super.toString(), _desiredInterestOps);
}
return String.format("%s{io=%d/%d,kio=%d,kro=%d}",
super.toEndPointString(),
_currentInterestOps,
_desiredInterestOps,
ManagedSelector.safeInterestOps(_key),
ManagedSelector.safeReadyOps(_key));
}
}

View File

@ -272,6 +272,34 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
}
}
static int safeReadyOps(SelectionKey selectionKey)
{
try
{
return selectionKey.readyOps();
}
catch (Throwable x)
{
if (LOG.isDebugEnabled())
LOG.debug(x);
return -1;
}
}
static int safeInterestOps(SelectionKey selectionKey)
{
try
{
return selectionKey.interestOps();
}
catch (Throwable x)
{
if (LOG.isDebugEnabled())
LOG.debug(x);
return -1;
}
}
@Override
public void dump(Appendable out, String indent) throws IOException
{
@ -474,7 +502,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
{
Object attachment = key.attachment();
if (LOG.isDebugEnabled())
LOG.debug("selected {} {} {} ",key.readyOps(),key,attachment);
LOG.debug("selected {} {} {} ", safeReadyOps(key), key, attachment);
try
{
if (attachment instanceof Selectable)
@ -490,7 +518,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
}
else
{
throw new IllegalStateException("key=" + key + ", att=" + attachment + ", iOps=" + key.interestOps() + ", rOps=" + key.readyOps());
throw new IllegalStateException("key=" + key + ", att=" + attachment + ", iOps=" + safeInterestOps(key) + ", rOps=" + safeReadyOps(key));
}
}
catch (CancelledKeyException x)
@ -571,19 +599,10 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
List<String> list = new ArrayList<>(selector_keys.size());
for (SelectionKey key : selector_keys)
{
if (key==null)
continue;
try
{
list.add(String.format("SelectionKey@%x{i=%d}->%s", key.hashCode(), key.interestOps(), key.attachment()));
}
catch (Throwable x)
{
list.add(String.format("SelectionKey@%x[%s]->%s", key.hashCode(), x, key.attachment()));
}
if (key != null)
list.add(String.format("SelectionKey@%x{i=%d}->%s", key.hashCode(), safeInterestOps(key), key.attachment()));
}
keys = list;
latch.countDown();
}