Change type of connection queue to a concurrent linked queue. Much more efficient, hopefully. Closes #189
This commit is contained in:
parent
b6d98f47a8
commit
afb18ee321
1 changed files with 31 additions and 1 deletions
|
@ -7,7 +7,37 @@
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
@@ -77,6 +78,7 @@
|
@@ -7,6 +8,11 @@
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
+import java.util.Queue;
|
||||||
|
+import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
+
|
||||||
|
+import com.google.common.collect.Queues;
|
||||||
|
+
|
||||||
|
import net.minecraft.logging.ILogAgent;
|
||||||
|
import net.minecraft.network.packet.NetHandler;
|
||||||
|
import net.minecraft.network.packet.Packet;
|
||||||
|
@@ -14,7 +20,7 @@
|
||||||
|
public class MemoryConnection implements INetworkManager
|
||||||
|
{
|
||||||
|
private static final SocketAddress field_74444_a = new InetSocketAddress("127.0.0.1", 0);
|
||||||
|
- private final List field_74442_b = Collections.synchronizedList(new ArrayList());
|
||||||
|
+ private final Queue<Packet> field_74442_b = Queues.newConcurrentLinkedQueue();
|
||||||
|
private final ILogAgent field_98214_c;
|
||||||
|
private MemoryConnection field_74443_c;
|
||||||
|
private NetHandler field_74440_d;
|
||||||
|
@@ -65,7 +71,7 @@
|
||||||
|
|
||||||
|
while (i-- >= 0 && !this.field_74442_b.isEmpty())
|
||||||
|
{
|
||||||
|
- Packet packet = (Packet)this.field_74442_b.remove(0);
|
||||||
|
+ Packet packet = field_74442_b.poll();
|
||||||
|
packet.func_73279_a(this.field_74440_d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -77,6 +83,7 @@
|
||||||
if (this.field_74441_e && this.field_74442_b.isEmpty())
|
if (this.field_74441_e && this.field_74442_b.isEmpty())
|
||||||
{
|
{
|
||||||
this.field_74440_d.func_72515_a(this.field_74438_f, this.field_74439_g);
|
this.field_74440_d.func_72515_a(this.field_74438_f, this.field_74439_g);
|
||||||
|
|
Loading…
Reference in a new issue