List of usage examples for java.util.concurrent RecursiveAction RecursiveAction
RecursiveAction
From source file:caveworld.core.Config.java
public static void saveConfig(final Configuration config) { if (config.hasChanged()) { CaveUtils.getPool().execute(new RecursiveAction() { @Override//w w w .j a v a 2 s .c o m protected void compute() { config.save(); } }); } }
From source file:com.kegare.caveworld.client.config.GuiBiomesEntry.java
@Override public void setResult(final List<Integer> result) { new ForkJoinPool().execute(new RecursiveAction() { @Override//from w w w . j ava2 s .co m protected void compute() { BiomeGenBase biome; ICaveBiome entry; for (Integer id : result) { biome = BiomeGenBase.getBiome(id); if (biome != null) { for (ICaveBiome cave : biomeList.biomes) { if (cave.getBiome() == biome) { biome = null; biomeList.selected = cave; break; } } if (biome == null) { continue; } if (CaveBiomeManager.defaultMapping.containsKey(biome)) { entry = CaveBiomeManager.defaultMapping.get(biome); } else { entry = new CaveBiome(biome, 10); } if (biomeList.biomes.addIfAbsent(entry)) { biomeList.contents.addIfAbsent(entry); biomeList.selected = entry; } } } Comparator<ICaveBiome> comparator = new CaveBiomeComparator(); Collections.sort(biomeList.contents, comparator); Collections.sort(biomeList.biomes, comparator); biomeList.scrollToSelected(); } }); }