Packet Handling and the associated Plugins class only perform game logic via events
- (x) PluginHandler no longer spins up threads, but instead add a new subclass of GameTickEvent to the Server's EventHandler.
- (x) ServerEventHandler.addEvent will add GameStateEvents to a separate bucket and process that bucket first. This is to retain compatibility with current code, but does not necessarily need to be run before other types of Events.
- (x) EventHandler will use multiple threads (cores count) to process events from the queue. Both EventHandler queues will block until completion of all Events.
- (x) GameStateEvent and GameNotifyEvent add to profiling info generated by ServerEventHandler
- (x) GameLogger.java Thread.sleep() is converted to a thread executor service.
- (x) Thread.sleep() should not be called anywhere.
- (x) Move character creation, password change, recovery question change, and password recovery attempts to the LoginThread.
- (x) GameStateEvents should have a close down state that is invoked when stop() is called. This is to clean up things like setBusy()
- (x) getBankPinEvent needs to create a new Queue on the LoginExecutor that will perform password hashing on the login thread for the bank pins rather than the game logic threads.
- Menu class to do menu logic, Functions.message, Functions.npcTalk, Functions.playerTalk, Functions.doGate should all be replaced in plugin code.
- Functions.sleep() should not exist at all. Delays should be done by waiting until the next invocation of the event.
- Server.post() should be removed
- GameStateUpdate.executeWalkToActions may need to occur at the beginning of the tick rather than the end.
- Remove setBusyTimer from Mob/NPC/Player
Executor constructor to create the thread pools to perform Event work: new ThreadPoolExecutor(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(), new NamedThreadFactory(threadName)); Then call executor.prestartAllCoreThreads
Use executor.invokeAll to block until all tasks are completed.