Merge pull request #1776 from yueh/feature-1283

Closes #1283: Add custom Callable to prevent memory leaks
This commit is contained in:
yueh
2015-08-22 23:22:17 +02:00
10 changed files with 101 additions and 53 deletions
+3 -3
View File
@@ -25,7 +25,6 @@ import java.util.Deque;
import java.util.EnumSet;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Callable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@@ -52,6 +51,7 @@ import appeng.api.util.IReadOnlyCollection;
import appeng.core.worlddata.WorldData;
import appeng.hooks.TickHandler;
import appeng.me.pathfinding.IPathItem;
import appeng.util.IWorldCallable;
import appeng.util.ReadOnlyCollection;
@@ -669,7 +669,7 @@ public class GridNode implements IGridNode, IPathItem
return this.lastUsedChannels;
}
private static class MachineSecurityBreak implements Callable<Void>
private static class MachineSecurityBreak implements IWorldCallable<Void>
{
private final GridNode node;
@@ -679,7 +679,7 @@ public class GridNode implements IGridNode, IPathItem
}
@Override
public Void call() throws Exception
public Void call(World world) throws Exception
{
this.node.getMachine().securityBreak();
+5 -3
View File
@@ -20,13 +20,15 @@ package appeng.me.cache.helpers;
import java.util.HashMap;
import java.util.concurrent.Callable;
import net.minecraft.world.World;
import appeng.api.networking.IGridNode;
import appeng.parts.p2p.PartP2PTunnelME;
import appeng.util.IWorldCallable;
public class Connections implements Callable
public class Connections implements IWorldCallable<Void>
{
public final HashMap<IGridNode, TunnelConnection> connections = new HashMap<IGridNode, TunnelConnection>();
@@ -40,7 +42,7 @@ public class Connections implements Callable
}
@Override
public Object call() throws Exception
public Void call( World world ) throws Exception
{
this.me.updateConnections( this );