[MUD-Dev] Java Serialization

ceo at grexengine.com ceo at grexengine.com
Thu Dec 12 12:09:41 CET 2002


on Wed, Dec 11, 2002 at 07:51:10PM -0700, Kwon Ekstrom wrote:
> From: <ra-whiteside at attbi.com>
 
>> This is a replacement to normal database technology for managing
>> data in a persistent, reliable, crash-recoverable manner.  The
>> proponents of this seem to have benchmarks showing it to be a few
>> thousand times faster than MySQL, for example. (DAOC uses MySQL?)

> I don't know about any commercial MMORPG's but I can tell you that
> a home brewed MU* changes constantly (a good one anyway) and Java
> Serialization, while good at keeping an accurate image of an
> object is terrible for this sort of thing... Any change in a java
> object means you can't load previous versions of the same object
> (really bad news if you want to keep your data).  

Assuming you are referring to the problem of:

  1. Create class

  2. Instantiate Object from Class

  3. Serialize Object

  4. Alter Class, and attempt to de-serialize Object as instance of
  change Class.

Then sorry, but that's not merely inaccurate, its completely
untrue. Java explicitly and effortlessly (takes approx 30 seconds,
once) supports loading and saving of different versions of the same
Object.

It has been supported by Java ever since the start of Serialization
(AFAIAW, certainly from 1.2 onwards, and I believe in 1.1. also, but
I could well be wrong).

FYI, if you look at the documentation for serialization, you will
find you merely need to declare a "public static final String"
(IIRC) which you initialize to the hash assigned to objects of that
class by Serialization.

So, perform steps 1 (and possibly 2) above. Then use the appropriate
java tool (cannot remember the name, but it is described in the
serialization documentation somewhere) to examine (I think: check th
docs) the serialized file, and find out the hash that has been
assigned. Then modify the source code of your class so that it
explicitly identifies itself. Now you can effortlessly load and save
objects, and alter the Class as often as you like.

There are some obvious gotchas, but these are all described in the
docs,and can all be worked with pretty straightforwardly.

Adam M 

_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list