2016-03-01 00:23:45 +00:00
|
|
|
From 0eeaa450168028e4e727629c01492611aa91095a Mon Sep 17 00:00:00 2001
|
2015-04-19 10:20:50 +00:00
|
|
|
From: md_5 <git@md-5.net>
|
|
|
|
Date: Sun, 19 Apr 2015 09:19:39 +1000
|
|
|
|
Subject: [PATCH] Use CLQ for main thread tasks.
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2016-03-01 00:23:45 +00:00
|
|
|
index 32290a0..89e6ad3 100644
|
2015-04-19 10:20:50 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -98,7 +98,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
|
|
|
private final GameProfileRepository W;
|
|
|
|
private final UserCache X;
|
|
|
|
private long Y = 0L;
|
2015-04-19 10:20:50 +00:00
|
|
|
- protected final Queue<FutureTask<?>> j = Queues.newArrayDeque();
|
|
|
|
+ protected final Queue<FutureTask<?>> j = new java.util.concurrent.ConcurrentLinkedQueue<FutureTask<?>>(); // Spigot, PAIL: Rename
|
|
|
|
private Thread serverThread;
|
2016-02-29 21:33:06 +00:00
|
|
|
private long aa = av();
|
2015-04-19 10:20:50 +00:00
|
|
|
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -709,11 +709,13 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
2015-04-19 10:20:50 +00:00
|
|
|
this.methodProfiler.a("jobs");
|
|
|
|
Queue queue = this.j;
|
|
|
|
|
|
|
|
- synchronized (this.j) {
|
|
|
|
- while (!this.j.isEmpty()) {
|
|
|
|
- SystemUtils.a((FutureTask) this.j.poll(), MinecraftServer.LOGGER);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
+ // Spigot start
|
|
|
|
+ FutureTask<?> entry;
|
|
|
|
+ int count = this.j.size();
|
2015-04-20 09:11:52 +00:00
|
|
|
+ while (count-- > 0 && (entry = this.j.poll()) != null) {
|
2015-04-19 10:20:50 +00:00
|
|
|
+ SystemUtils.a(entry, MinecraftServer.LOGGER);
|
|
|
|
+ }
|
|
|
|
+ // Spigot end
|
|
|
|
|
|
|
|
this.methodProfiler.c("levels");
|
|
|
|
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -1476,10 +1478,10 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
2015-04-19 10:20:50 +00:00
|
|
|
ListenableFutureTask listenablefuturetask = ListenableFutureTask.create(callable);
|
|
|
|
Queue queue = this.j;
|
|
|
|
|
|
|
|
- synchronized (this.j) {
|
|
|
|
- this.j.add(listenablefuturetask);
|
|
|
|
- return listenablefuturetask;
|
|
|
|
- }
|
|
|
|
+ // Spigot start
|
|
|
|
+ this.j.add(listenablefuturetask);
|
|
|
|
+ return listenablefuturetask;
|
|
|
|
+ // Spigot end
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
return Futures.immediateFuture(callable.call());
|
|
|
|
--
|
2016-02-29 21:33:06 +00:00
|
|
|
2.5.0
|
2015-04-19 10:20:50 +00:00
|
|
|
|