Browse Source

Comment cleanup

combat-2
MagicBot 8 months ago
parent
commit
c2152432ce
  1. 11
      src/engine/net/MessageDispatcher.java

11
src/engine/net/MessageDispatcher.java

@ -30,13 +30,10 @@ import java.util.regex.Pattern;
public class MessageDispatcher implements Runnable { public class MessageDispatcher implements Runnable {
// Instance variables // Class variables
private static final ConcurrentLinkedQueue<Dispatch>[] _messageQueue = new ConcurrentLinkedQueue[DispatchChannel.values().length]; private static final ConcurrentLinkedQueue<Dispatch>[] _messageQueue = new ConcurrentLinkedQueue[DispatchChannel.values().length];
private static final LinkedBlockingQueue<Boolean> _blockingQueue = new LinkedBlockingQueue<>(); private static final LinkedBlockingQueue<Boolean> _blockingQueue = new LinkedBlockingQueue<>();
// Class variables
public static volatile long[] messageCount = new long[DispatchChannel.values().length]; public static volatile long[] messageCount = new long[DispatchChannel.values().length];
public static LongAdder[] dispatchCount = new LongAdder[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 final Pattern filterPattern; // Unused, but just in case
private Dispatch messageDispatch; private Dispatch messageDispatch;
// Thread constructor
public MessageDispatcher() { public MessageDispatcher() {
// Create new FIFO queues for this network thread // 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) { 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! // Don't queue up empty dispatches!
if (messageDispatch.player == null) if (messageDispatch.player == null)

Loading…
Cancel
Save