Let me argue for why I am doing it and since I don't know of any other ways to be doing it better (Perhaps parallel-programming? Not familiar with it really, so I don't know.)
The BaseThread is a multithreading wrapper actually, however normal mobs does not have a thread for themself. Only the bosses, but there would only be a single boss in the map spawned at once. Normal mobs uses the thread the map has, since each map with mobs has a thread, rather than a global thread for the whole server.
The reason why the boss uses multiple threads is because each thread simply does different actions and if I was to use a single thread then one action may delay another action. It's not really a problem when it comes to deadlocks though, since there is not multiple threads accessing the same data they do. No locks is needed either since they just take care of the concurrent collections which already takes care of concurrency between threads.
If you know a better way to do it, I'd be more than interested in it, but as of now I do not know a better way.
Perhaps instead of giving each boss the threads then shared threads for the bosses, like with the mobs?
The BaseThread is a multithreading wrapper actually, however normal mobs does not have a thread for themself. Only the bosses, but there would only be a single boss in the map spawned at once. Normal mobs uses the thread the map has, since each map with mobs has a thread, rather than a global thread for the whole server.
The reason why the boss uses multiple threads is because each thread simply does different actions and if I was to use a single thread then one action may delay another action. It's not really a problem when it comes to deadlocks though, since there is not multiple threads accessing the same data they do. No locks is needed either since they just take care of the concurrent collections which already takes care of concurrency between threads.
If you know a better way to do it, I'd be more than interested in it, but as of now I do not know a better way.
Perhaps instead of giving each boss the threads then shared threads for the bosses, like with the mobs?