Don't attempt to create a thread pool if there is nothing to do (fix crash)

This commit is contained in:
JFronny 2021-06-11 18:49:29 +02:00
parent 68e079c115
commit df80d2a152
No known key found for this signature in database
GPG Key ID: BEC5ACBBD4EE17E5
2 changed files with 11 additions and 81 deletions

View File

@ -15,78 +15,3 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "com.terraformersmc:modmenu:2.0.0-beta.7"
}
/*plugins {
id 'fabric-loom' version '0.7-SNAPSHOT'
id 'maven-publish'
id "com.modrinth.minotaur" version "1.1.0"
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
repositories {
maven { url = "https://maven.terraformersmc.com/"; name = "ModMenu" }
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.minecraft_version}+${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "com.terraformersmc:modmenu:1.16.9"
}
processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
expand "version": project.version
}
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this task, sources will not be generated.
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
jar {
from "LICENSE"
}
import com.modrinth.minotaur.TaskModrinthUpload
task publishModrinth (type: TaskModrinthUpload){
token = System.getenv("MODRINTH_API_TOKEN") // Use an environment property!
projectId = 'kVAQyCLX'
versionNumber = "${project.mod_version}"
uploadFile = remapJar // This is the java jar task
addGameVersion("${project.minecraft_version}")
addLoader('fabric')
versionName = "[${project.minecraft_version}] ${project.mod_version}"
afterEvaluate {
tasks.publishModrinth.dependsOn(remapJar)
tasks.publishModrinth.dependsOn(sourcesJar)
}
}
*/

View File

@ -95,13 +95,18 @@ public class Resclone implements ModInitializer, RescloneApi {
public void reload() {
Set<PackMetaLoaded> metas = new LinkedHashSet<>();
try {
ExecutorService pool = Executors.newFixedThreadPool(conf.size());
for (PackMetaUnloaded s : conf) {
pool.submit(generateTask(s, metas));
if (conf.isEmpty()) {
LOGGER.info("No resclone pack was specified, add one");
}
pool.shutdown();
if (!pool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS)) {
LOGGER.error("Download timed out. This shouldn't be possible");
else {
ExecutorService pool = Executors.newFixedThreadPool(conf.size());
for (PackMetaUnloaded s : conf) {
pool.submit(generateTask(s, metas));
}
pool.shutdown();
if (!pool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS)) {
LOGGER.error("Download timed out. This shouldn't be possible");
}
}
} catch (InterruptedException e) {
e.printStackTrace();