-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38069 from mkouba/issue-37982-36
[3.6] ArC: fix and optimize the ContextInstances abstraction
- Loading branch information
Showing
10 changed files
with
361 additions
and
133 deletions.
There are no files selected for viewing
258 changes: 151 additions & 107 deletions
258
...jects/arc/processor/src/main/java/io/quarkus/arc/processor/ContextInstancesGenerator.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
28 changes: 27 additions & 1 deletion
28
independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/ContextInstances.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 |
---|---|---|
@@ -1,20 +1,46 @@ | ||
package io.quarkus.arc.impl; | ||
|
||
import java.util.Set; | ||
import java.util.function.Consumer; | ||
import java.util.function.Supplier; | ||
|
||
import io.quarkus.arc.ContextInstanceHandle; | ||
|
||
public interface ContextInstances { | ||
|
||
/** | ||
* | ||
* @param id | ||
* @param supplier | ||
* @return the instance handle | ||
*/ | ||
ContextInstanceHandle<?> computeIfAbsent(String id, Supplier<ContextInstanceHandle<?>> supplier); | ||
|
||
/** | ||
* | ||
* @param id | ||
* @return the instance handle if present, {@code null} otherwise | ||
*/ | ||
ContextInstanceHandle<?> getIfPresent(String id); | ||
|
||
/** | ||
* | ||
* @param id | ||
* @return the removed instance handle, or {@code null} | ||
*/ | ||
ContextInstanceHandle<?> remove(String id); | ||
|
||
/** | ||
* | ||
* @return all instance handles | ||
*/ | ||
Set<ContextInstanceHandle<?>> getAllPresent(); | ||
|
||
void clear(); | ||
/** | ||
* Removes all instance handles and performs the given action (if present) for each handle. | ||
* | ||
* @param action | ||
*/ | ||
void removeEach(Consumer<? super ContextInstanceHandle<?>> action); | ||
|
||
} |
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.