Testing moving the EmcRegistry initialization to its own thread

This commit is contained in:
pahimar 2013-12-30 23:51:15 -05:00
parent 56d24ef958
commit 5e9a29123d
4 changed files with 27 additions and 5 deletions

View file

@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableSortedMap;
import com.pahimar.ee3.api.OreStack;
import com.pahimar.ee3.api.WrappedStack;
import com.pahimar.ee3.helper.EmcHelper;
import com.pahimar.ee3.helper.LogHelper;
import com.pahimar.ee3.item.crafting.RecipeRegistry;
import com.pahimar.ee3.lib.Compare;
import net.minecraft.item.ItemStack;
@ -36,7 +35,6 @@ public class EmcRegistry
private void init()
{
LogHelper.debug("Init-ing");
HashMap<WrappedStack, EmcValue> stackValueMap = new HashMap<WrappedStack, EmcValue>();
/*

View file

@ -1,6 +1,6 @@
package com.pahimar.ee3.handler;
import com.pahimar.ee3.emc.EmcRegistry;
import com.pahimar.ee3.helper.EmcInitializationHelper;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.world.WorldEvent;
@ -9,6 +9,6 @@ public class WorldEventHandler
@ForgeSubscribe
public void onWorldLoaded(WorldEvent.Load event)
{
EmcRegistry.getInstance();
EmcInitializationHelper.initEmcRegistry();
}
}

View file

@ -0,0 +1,25 @@
package com.pahimar.ee3.helper;
import com.pahimar.ee3.emc.EmcRegistry;
public class EmcInitializationHelper implements Runnable
{
private static EmcInitializationHelper instance = new EmcInitializationHelper();
@Override
public void run()
{
long startTime = System.currentTimeMillis();
EmcRegistry.getInstance();
long duration = System.currentTimeMillis() - startTime;
if (duration > 10)
{
LogHelper.info(String.format("DynEmc system initialized after %s ms", duration));
}
}
public static void initEmcRegistry()
{
new Thread(instance).start();
}
}

View file

@ -235,7 +235,6 @@ public class VersionHelper implements Runnable
public static void execute()
{
new Thread(instance).start();
}
}