MUD-Dev
mailing list archive
[ Other Periods
| Other mailing lists
| Search
]
Date:
[ Previous
| Next
]
Thread:
[ Previous
| Next
]
Index:
[ Author
| Date
| Thread
]
Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??
On Sun, 22 Mar 1998, Chris Gray wrote:
> [Ben Greear:]
[Snip]
> :Also, as a java server, I don't think I can do a select on incomming
> :data. I think a thread for every player is a bit much...any suggestions
> :here?
>
> I have just started into the socket programming stuff of the current Java
> book I'm reading, but I just went and did some scanning. The technique
> he suggests for a server is to create some fixed number of threads, and
> re-use those threads throughout the lifetime of the server. He says that
> some Java implementations do not garbage collect threads at all, so having
> one per connection can result in an eventual crash due to lack of memory.
> Ick. Given the lack of a 'select' or 'poll' method in Java, the choices
> are quite limited. Double ick.
It is my understanding that (at least, according to the 1.1.x
specifications), a Thread is terminated when its stop() method is called.
Of course, some Java implementations may be buggy. :)
Reusing threads is probably desirable, by the way, especially if less work
will be done to re-use an existant thread than to create a new one, and
not hard to do.
Consider a model where you have a resizeable array (see the Vector class)
of Threads. You also maintain a list of available threads so you do not
have to recalulate it, and follow a procedure akin to:
New connection is made to the server:
Check list of available threads.
If null: extend the Vector and add a new thread to handle the
connection.
If not null: take the 'top' thread and re-assign it.
A connection closes:
Add that thread to the list of available threads.
Suspend and 'reset' the thread.
Seems interesting anyway. :)
--
Regards,
-Matt Chatterley
Spod: http://user.super.net.uk/~neddy/spod/spod.html
- Thread context:
- Re: [MUD-Dev] Jukebox, (continued)
- Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Sun 22 Mar 1998, 18:21 GMT
- Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??,
Greg Munt greg#uni-corn,demon.co.uk, Sun 22 Mar 1998, 19:02 GMT
- Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??,
Matt Chatterley matt#mpc,dyn.ml.org, Sun 22 Mar 1998, 19:19 GMT
- World Persistence, flat files v/s DB v/s ??,
s001gmu s001gmu#nova,wright.edu, Mon 23 Mar 1998, 19:51 GMT
- Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??,
Vadim Tkachenko vt#freehold,crocodile.org, Wed 25 Mar 1998, 05:26 GMT
[ Other Periods
| Other mailing lists
| Search
]