|
What are Thread priorities? Those of you on Windows have probably used the "Set Priority" feature in Task Manager before; it's pretty much the same thing. For those of you who haven't, heres how it works. You change the priority of a Thread by calling Thread.setPriority(int). Thread.MAX_PRIORITY, Thread.MIN_PRIORITY, and Thread.NORMAL_PRIORITY are all integers that can be used with this method. Thread.MAX_PRIORITY is 10, and Thread.MIN_PRIORITY is 0.
You still don't know what this could be used for though. You see, when a Thread has less priority than another Thread, the Thread with greater priority has priority access to system resources than the others.
How can this be applied in your server? In a Winterlove server, you could set the player processing thread to Thread.MAX_PRIORITY, and you could set each Clients Thread to (Thread.NORM_PRIORITY - 1), one less than normal. Now, you could set Threads to do things like autosaving to Thread.MIN_PRIORITY. This would give your processing Thread priority access over everything else in the server, and Client threads priority over autosave Threads.
Used correctly, Threading priority can be a real benefit. If you're interested, you may want to read this:
http://download.oracle.com/docs/cd/E...ng/Thread.html
gonna read that link sounds like it could do some good
I think I saw this in the 317 server palidino released (his netty one). Someone should see how this works (implement it into a delta server with players or something) and post the results.
Nice one Colby, wasn't thinking of this, I'm gonna implement it into my Animus framework.
very good idea, ive seen this in task manager but never thought of implements it into private servers, could come in handy in future thanks
u dont need to try and convince him hard, hes been begging for a solution to his lag lolI'll try and talk silabgarza into being the guinea pig lol
Thanks, I learned something by reading this.
Thanks, this is a really helpful post for me, because I always change priorities on task manager and I always wondered if we can do the same thing in java.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |