From c2152432ce5d1f4311943ae6cd47796a56a8633f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 26 Apr 2024 15:00:03 -0400 Subject: [PATCH] Comment cleanup --- src/engine/net/MessageDispatcher.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/engine/net/MessageDispatcher.java b/src/engine/net/MessageDispatcher.java index 5242e6c0..e397d3fa 100644 --- a/src/engine/net/MessageDispatcher.java +++ b/src/engine/net/MessageDispatcher.java @@ -30,13 +30,10 @@ import java.util.regex.Pattern; public class MessageDispatcher implements Runnable { - // Instance variables + // Class variables private static final ConcurrentLinkedQueue[] _messageQueue = new ConcurrentLinkedQueue[DispatchChannel.values().length]; private static final LinkedBlockingQueue _blockingQueue = new LinkedBlockingQueue<>(); - - // Class variables - public static volatile long[] messageCount = new long[DispatchChannel.values().length]; public static LongAdder[] dispatchCount = new LongAdder[DispatchChannel.values().length]; @@ -47,8 +44,6 @@ public class MessageDispatcher implements Runnable { private final Pattern filterPattern; // Unused, but just in case private Dispatch messageDispatch; - // Thread constructor - public MessageDispatcher() { // Create new FIFO queues for this network thread @@ -94,6 +89,10 @@ public class MessageDispatcher implements Runnable { public static void send(Dispatch messageDispatch, DispatchChannel dispatchChannel) { + // A Dispatch should be borrowed from the local cache. + // They will automatically be released back to the queue + // once delivered. + // Don't queue up empty dispatches! if (messageDispatch.player == null)