-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces an ExecutorServices implementation to Helidon's repackaged…
… Weld implementation to ensure context classloaders are never null (#2269) * Introduces an ExecutorServices implementation to Helidon's repackaged Weld implementation to ensure context classloaders are never null. Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
- Loading branch information
Showing
3 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
microprofile/cdi/src/main/java/io/helidon/microprofile/cdi/ExecutorServices.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,63 @@ | ||
/* | ||
* Copyright (c) 2020 Oracle and/or its affiliates. | ||
* | ||
* 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.helidon.microprofile.cdi; | ||
|
||
import java.util.Collection; | ||
import java.util.concurrent.Callable; | ||
|
||
import org.jboss.weld.executor.CommonForkJoinPoolExecutorServices; | ||
|
||
/** | ||
* A {@link CommonForkJoinPoolExecutorServices} whose {@link | ||
* #wrap(Collection)} method simply returns the supplied {@link | ||
* Collection} of {@link Callable}s unchanged. | ||
* | ||
* <p>This class exists to work around <a | ||
* href="https://issues.redhat.com/browse/WELD-2494" | ||
* target="_parent">WELD-2494</a>, which, in turn, was working around | ||
* <a href="https://bugs.openjdk.java.net/browse/JDK-8184335" | ||
* target="_parent">JDK-8184335</a>.</p> | ||
* | ||
* @see #wrap(Collection) | ||
*/ | ||
public final class ExecutorServices extends CommonForkJoinPoolExecutorServices { | ||
|
||
/** | ||
* Creates a new {@link ExecutorServices}. | ||
* | ||
* <p>There is no reason for users to call this constructor.</p> | ||
*/ | ||
public ExecutorServices() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Returns the supplied {@code tasks} argument unchanged when invoked. | ||
* | ||
* @param tasks a {@link Collection} of {@link Callable}s | ||
* representing tasks that Weld needs to do; may be {@code null} | ||
* | ||
* @return the supplied {@code tasks} argument | ||
* | ||
* @see <a href="https://issues.redhat.com/browse/WELD-2494" | ||
* target="_parent">WELD-2494</a> | ||
*/ | ||
@Override | ||
public <T> Collection<? extends Callable<T>> wrap(Collection<? extends Callable<T>> tasks) { | ||
return tasks; | ||
} | ||
|
||
} |
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
17 changes: 17 additions & 0 deletions
17
microprofile/cdi/src/main/resources/META-INF/services/org.jboss.weld.bootstrap.api.Service
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,17 @@ | ||
# | ||
# Copyright (c) 2020 Oracle and/or its affiliates. | ||
# | ||
# 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. | ||
# | ||
|
||
io.helidon.microprofile.weld.ExecutorServices |