1998Q1/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] World Persistence, flat files v/s DB v/s ?? -->
<!--X-From-R13: Hnqvz Fxnpuraxb <igNserrubyq.pebpbqvyr.bet> -->
<!--X-Date: Wed, 25 Mar 1998 05:26:04 +0000 -->
<!--X-Message-Id: 35185F7C.9A26F985#freehold,crocodile.org -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: Pine.LNX.3.96.980322191104.1367A&#45;100000#mpc,dyn.ml.org -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:vt#freehold,crocodile.org">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00884.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00886.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00884.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00894.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00885">Author</A>
&nbsp;|&nbsp;<A HREF="#00885">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00885">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</LI>
<LI><em>From</em>: Vadim Tkachenko &lt;<A HREF="mailto:vt#freehold,crocodile.org">vt#freehold,crocodile.org</A>&gt;</LI>
<LI><em>Date</em>: Tue, 24 Mar 1998 19:35:56 -0600</LI>
<LI><em>Sender</em>: <A HREF="mailto:vt#freehold,crocodile.org">vt#freehold,crocodile.org</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
Matt Chatterley wrote:
&gt; 
&gt; On Sun, 22 Mar 1998, Chris Gray wrote:
&gt; &gt; [Ben Greear:]
&gt; 
&gt; [Snip]
&gt; 
&gt; &gt; :Also, as a java server, I don't think I can do a select on incomming
&gt; &gt; :data.        I think a thread for every player is a bit much...any suggestions
&gt; &gt; :here?
&gt; &gt;
&gt; &gt; I have just started into the socket programming stuff of the current Java
&gt; &gt; book I'm reading, but I just went and did some scanning. The technique
&gt; &gt; he suggests for a server is to create some fixed number of threads, and
&gt; &gt; re-use those threads throughout the lifetime of the server. He says that
&gt; &gt; some Java implementations do not garbage collect threads at all, so having
&gt; &gt; one per connection can result in an eventual crash due to lack of memory.
&gt; &gt; Ick. Given the lack of a 'select' or 'poll' method in Java, the choices
&gt; &gt; are quite limited. Double ick.
&gt; 
&gt; It is my understanding that (at least, according to the 1.1.x
&gt; specifications), a Thread is terminated when its stop() method is called.
&gt; Of course, some Java implementations may be buggy. :)

Surprisingly, they are :-))

Some things worth mentioning:

JDK 1.0.2: Thread.interrupt() doesn't work. Thread.stop() doesn't work
as expected if called from within the thread you want to stop.

Netscape Enterprise 3.* JVM: the same. BEWARE: it advertises itself as
JDK 1.1 compliant, but in fact hopelessly broken - apparently, these are
not the only things which don't work - my package which had been tested
on JDK 1.0.2 from different vendors for almost two years choke and died
at once.

JDK 1.2: Thread.stop() is deprecated - and let it rest in peace,
Thread.interrupt() is quite enough.

&gt; Consider a model where you have a resizeable array (see the Vector class)
&gt; of Threads. You also maintain a list of available threads so you do not
&gt; have to recalulate it, and follow a procedure akin to:
&gt; 
&gt; New connection is made to the server:
&gt;         Check list of available threads.
&gt;                 If null: extend the Vector and add a new thread to handle the
&gt;                         connection.
&gt;                 If not null: take the 'top' thread and re-assign it.
&gt; 
&gt; A connection closes:
&gt;         Add that thread to the list of available threads.
&gt;         Suspend and 'reset' the thread.
&gt; 
&gt; Seems interesting anyway. :)

I wouldn't recommend messing with stopping and resuming threads, though
:-)

The better solution will be probably if you have some Thread-derived
class which works like this:

while ( isEnabled() )
{
 Runnable
	r = waitForRunRequest();	// blocking wait
 r.run();
}

Of course, this is an extremely simplified scenario, which, BTW, fits
into the ChannelSwitcher concept I described in the previous message.

&gt;         -Matt Chatterley

-- 
Still alive and smile stays on,
Vadim Tkachenko &lt;vt#freehold,crocodile.org&gt;
--
UNIX _is_ user friendly, he's just very picky about who his friends are

</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00894" HREF="msg00894.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></strong>
<ul compact><li><em>From:</em> Matt Chatterley &lt;matt#mpc,dyn.ml.org&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00823" HREF="msg00823.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></STRONG>
<UL><LI><EM>From:</EM> Matt Chatterley &lt;matt#mpc,dyn.ml.org&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00884.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00886.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00884.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00894.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00885"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00885"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</STRONG>, <EM>(continued)</EM>
<ul compact>
<LI><strong><A NAME="00822" HREF="msg00822.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></strong>, 
Greg Munt <a href="mailto:greg#uni-corn,demon.co.uk">greg#uni-corn,demon.co.uk</a>, Sun 22 Mar 1998, 19:02 GMT
</LI>
<LI><strong><A NAME="00823" HREF="msg00823.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></strong>, 
Matt Chatterley <a href="mailto:matt#mpc,dyn.ml.org">matt#mpc,dyn.ml.org</a>, Sun 22 Mar 1998, 19:19 GMT
<UL>
<LI><strong><A NAME="00852" HREF="msg00852.html">World Persistence, flat files v/s DB v/s ??</A></strong>, 
s001gmu <a href="mailto:s001gmu#nova,wright.edu">s001gmu#nova,wright.edu</a>, Mon 23 Mar 1998, 19:51 GMT
<UL>
<LI><strong><A NAME="00884" HREF="msg00884.html">Re: [MUD-Dev]  World Persistence, flat files v/s DB v/s ??</A></strong>, 
Vadim Tkachenko <a href="mailto:vt#freehold,crocodile.org">vt#freehold,crocodile.org</a>, Wed 25 Mar 1998, 05:23 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00885" HREF="msg00885.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></strong>, 
Vadim Tkachenko <a href="mailto:vt#freehold,crocodile.org">vt#freehold,crocodile.org</a>, Wed 25 Mar 1998, 05:26 GMT
<UL>
<LI><strong><A NAME="00894" HREF="msg00894.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></strong>, 
Matt Chatterley <a href="mailto:matt#mpc,dyn.ml.org">matt#mpc,dyn.ml.org</a>, Wed 25 Mar 1998, 08:47 GMT
<UL>
<LI><strong><A NAME="00899" HREF="msg00899.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></strong>, 
Vadim Tkachenko <a href="mailto:vt#freehold,crocodile.org">vt#freehold,crocodile.org</a>, Thu 26 Mar 1998, 01:59 GMT
<UL>
<LI><strong><A NAME="00904" HREF="msg00904.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></strong>, 
Joel Dillon <a href="mailto:emily#cornholio,new.ox.ac.uk">emily#cornholio,new.ox.ac.uk</a>, Thu 26 Mar 1998, 15:52 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
<LI><strong><A NAME="00830" HREF="msg00830.html">Re: [MUD-Dev] World Persistence, flat files v/s DB v/s ??</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Sun 22 Mar 1998, 21:10 GMT
</LI>
</ul>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>