Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport #10540 to jetty-10.0.x Fixed deadlock in class initialization. #10545

Merged
merged 2 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// ========================================================================
// 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.http;

import java.util.Collections;
import java.util.Iterator;
import java.util.function.Consumer;
import java.util.stream.Stream;

class EmptyHttpFields extends HttpFields.Immutable
{
public EmptyHttpFields()
{
super(new HttpField[0]);
}

@Override
public Iterator<HttpField> iterator()
{
return Collections.emptyIterator();
}

@Override
public void forEach(Consumer<? super HttpField> action)
{
// no-op
}

@Override
public Stream<HttpField> stream()
{
return Stream.empty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
*/
public interface HttpFields extends Iterable<HttpField>
{
HttpFields EMPTY = build().asImmutable();
/**
* <p>A constant for an immutable and empty {@link HttpFields}.</p>
*/
HttpFields EMPTY = new EmptyHttpFields();

static Mutable build()
{
Expand Down