Dynamic Class Reloading
robert at marcanoonline.com
Sat Jul 4 17:39:37 UTC 2009
On Sat, Jul 4, 2009 at 12:54 PM, Andrew Wiley<debio264 at gmail.com> wrote:
> I'm looking for something more general than that... let me just describe the
> functionality I'm trying to achieve.
> I'm writing a MUD (it's basically a text-based RPG), and I'm trying to come
> up with some equivalent for the "copyover" or "hot boot" functionality that
> MUDs written in C and C+ have. Basically, they write the state of the game
> out to a file, have the MUD execute itself, and then load the game back up.
> In this way, a MUD can reboot without disconnecting any of the players. The
> socket descriptors aren't closed during the reboot, which I believe cannot
> be replicated in Java.
> In Java, I was hoping I would just be able to reload classes without
> rebooting the MUD to come close to duplicating this functionality.
I think that still can be done with an standard JVM, use you own
classloader, be careful making you class serialization works when the
classes definitions change, the only problem you will have is that
released JVMs does not have a way to free the classloader you are
discarding, something that is being resolved with OpenJDK 7, so each
time you "reboot" you will not free the memory used by the previous
classloader (class definitions not instances data)
More information about the discuss