-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Call ServletChannelState.asyncFailure from error listener. Fix #10933 * Separate invokers for read side and write side * document async error issues * updates from review * updates from review
- Loading branch information
Showing
12 changed files
with
169 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
jetty-core/jetty-util/src/test/java/org/eclipse/jetty/util/thread/InvocableTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
package org.eclipse.jetty.util.thread; | ||
|
||
import java.util.Queue; | ||
import java.util.concurrent.ConcurrentLinkedQueue; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.eclipse.jetty.util.thread.Invocable.InvocationType.BLOCKING; | ||
import static org.eclipse.jetty.util.thread.Invocable.InvocationType.EITHER; | ||
import static org.eclipse.jetty.util.thread.Invocable.InvocationType.NON_BLOCKING; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.contains; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.hamcrest.Matchers.nullValue; | ||
import static org.hamcrest.Matchers.sameInstance; | ||
|
||
public class InvocableTest | ||
{ | ||
@Test | ||
public void testCombineType() | ||
{ | ||
assertThat(Invocable.combine(null, null), is(BLOCKING)); | ||
assertThat(Invocable.combine(null, BLOCKING), is(BLOCKING)); | ||
assertThat(Invocable.combine(null, NON_BLOCKING), is(BLOCKING)); | ||
assertThat(Invocable.combine(null, EITHER), is(BLOCKING)); | ||
|
||
assertThat(Invocable.combine(BLOCKING, null), is(BLOCKING)); | ||
assertThat(Invocable.combine(BLOCKING, BLOCKING), is(BLOCKING)); | ||
assertThat(Invocable.combine(BLOCKING, NON_BLOCKING), is(BLOCKING)); | ||
assertThat(Invocable.combine(BLOCKING, EITHER), is(BLOCKING)); | ||
|
||
assertThat(Invocable.combine(NON_BLOCKING, null), is(BLOCKING)); | ||
assertThat(Invocable.combine(NON_BLOCKING, BLOCKING), is(BLOCKING)); | ||
assertThat(Invocable.combine(NON_BLOCKING, NON_BLOCKING), is(NON_BLOCKING)); | ||
assertThat(Invocable.combine(NON_BLOCKING, EITHER), is(NON_BLOCKING)); | ||
|
||
assertThat(Invocable.combine(EITHER, null), is(BLOCKING)); | ||
assertThat(Invocable.combine(EITHER, BLOCKING), is(BLOCKING)); | ||
assertThat(Invocable.combine(EITHER, NON_BLOCKING), is(NON_BLOCKING)); | ||
assertThat(Invocable.combine(EITHER, EITHER), is(EITHER)); | ||
} | ||
|
||
@Test | ||
public void testCombineRunnable() | ||
{ | ||
Queue<String> history = new ConcurrentLinkedQueue<>(); | ||
|
||
assertThat(Invocable.combine(), nullValue()); | ||
assertThat(Invocable.combine((Runnable)null), nullValue()); | ||
assertThat(Invocable.combine(null, (Runnable)null), nullValue()); | ||
|
||
Runnable r1 = () -> history.add("R1"); | ||
Runnable r2 = () -> history.add("R2"); | ||
Runnable r3 = () -> history.add("R3"); | ||
|
||
assertThat(Invocable.combine(r1, null, null), sameInstance(r1)); | ||
assertThat(Invocable.combine(null, r2, null), sameInstance(r2)); | ||
assertThat(Invocable.combine(null, null, r3), sameInstance(r3)); | ||
|
||
Runnable r13 = Invocable.combine(r1, null, r3); | ||
history.clear(); | ||
r13.run(); | ||
assertThat(history, contains("R1", "R3")); | ||
|
||
Runnable r123 = Invocable.combine(r1, r2, r3); | ||
history.clear(); | ||
r123.run(); | ||
assertThat(history, contains("R1", "R2", "R3")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.