Skip to content

Creates an executor for respecting the user script loader threads configuration #8011

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

Open
wants to merge 8 commits into
base: dev/feature
Choose a base branch
from

Conversation

TheLimeGlass
Copy link
Contributor

Problem

Being able to submit runnables on the script loader configuration pool through an Executor.

Solution

Use Java's Executor to be able to submit runnables based on the users config.sk setting. Helpful for addon developers and Skript.
Also added support in Skript's Task util class.

Useful for things that needs to be submitted like streams.

Stream<String> testStream = Stream.of("test1", "test2", "test3");

// Take advantage of parallel and/or multiple threads configuration setting in a single call.
ScriptLoader.getExecutor().execute(() -> {
	(isParallel() ? testStream.parallel() : testStream).forEach(System.out::println);
});

See Pickle's comment at #7962 (comment)

Since my other Task util pull request got closed for some reason, I re-added my javadoc comments.

@TheLimeGlass TheLimeGlass requested a review from a team as a code owner July 5, 2025 23:18
@TheLimeGlass TheLimeGlass requested review from Burbulinis and TheMug06 and removed request for a team July 5, 2025 23:18
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jul 5, 2025
@TheLimeGlass TheLimeGlass changed the title Creates an executor for syncing tasks to the script loader threads Creates an executor for respecting the user script loader threads configuration Jul 5, 2025
@skriptlang-automation skriptlang-automation bot added feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. and removed needs reviews A PR that needs additional reviews labels Jul 15, 2025
@sovdeeth sovdeeth moved this to Awaiting Merge in 2.13 Release Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version.
Projects
Status: Awaiting Merge
Development

Successfully merging this pull request may close these issues.

3 participants