Skip to content

Plurl creates ServiceLoader in Constructor which is not thread-safe #30

Description

@holgergrote

Current Behavior

In PlurlImpl the method ServiceLoader.load() is called which returns a ServiceLoader. A ServiceLoader is defined by documation as not thread-safe.
This PlurlImpl is stored in URLConnection.setContentHandlerFactory().
When working with URLConnections from different threads this can lead to failures.

Expected Behavior

no exception in concurrent calls from different threads

Steps To Reproduce

Attached a test to demonstrate the error:
ConcurrentRunTest.java

Version

org.eclipse.osgi-3.24.0

Are you interested in contributing a solution yourself?

None

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions