|
|
|
@ -30,13 +30,10 @@ import java.util.regex.Pattern;
@@ -30,13 +30,10 @@ import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
public class MessageDispatcher implements Runnable { |
|
|
|
|
|
|
|
|
|
// Instance variables
|
|
|
|
|
// Class variables
|
|
|
|
|
|
|
|
|
|
private static final ConcurrentLinkedQueue<Dispatch>[] _messageQueue = new ConcurrentLinkedQueue[DispatchChannel.values().length]; |
|
|
|
|
private static final LinkedBlockingQueue<Boolean> _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 {
@@ -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 {
@@ -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) |
|
|
|
|