Tapestry Training -- From The Source

Let me help you get your team up to speed in Tapestry ... fast. Visit howardlewisship.com for details on training, mentoring and support!

Sunday, July 04, 2004

HiveMind and automatic reloading

I gave this another thought yesterday while relaxing on the beach. HiveMind doesn't have a way to redeploy because a descriptor changed. That wasn't on e of the problems I wanted to solver with HiveMind initially.

It's a complicated problem, because the very nature of HiveMind is to intertwine services. Service A may use configuration B that includes a bean obtained from service C that is itself driven by configuration D. If a contribution to service D changes, how does that affect service A? I suppose, in theory, you could do some tricky forward chaining so that a change to configuration D will be identified a propagated forward, invalidating service C and configuration B and ultimately service A. You could then have the proxy for service A somehow obtain a new instance that reflects the change to configuration D.

What are you willing to pay for that? The CPU and memory expense of determining what has changed and what is affected looks prohibitive to me. Something would have to poll for changes to the modules, re-parse the module descriptors, rebuild the various module descriptors, and send notifications to proxies and other objects.

The thing is, HiveMind is supposed to be light and fast. I have always pictured HiveMind running inside an EAR. When the EAR is redployed, the old HiveMind Registry is shutdown and a new HiveMind Registry is created and started to replace it. During development, just bounce your application (i.e., restart Jetty). I'm doing this today on my current project, and it's not a great imposition ... just a couple of seconds to stop and restart. The Jetty Launcher plugin makes it a single click.

So I'm still filing this under YAGNI(You Aint Gonna Need It).

3 comments:

Rasman1978 said...

Sorry if this is the wrong place to post, but it's not clear where the best place to get hivemind support is.

I'm getting:

org.apache.hivemind.ApplicationRuntimeException: Unable to create class $SingletonProxy_fd94b50717_0: javassist.ClassPool.write(Ljava/lang/String;)[B
at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.createSingletonProxy(Unknown Source)
at org.apache.hivemind.impl.servicemodel.SingletonServiceModel.getService(Unknown Source)
at org.apache.hivemind.impl.ServicePointImpl.getService(Unknown Source)
at org.apache.hivemind.impl.ServicePointImpl.getService(Unknown Source)
at org.apache.hivemind.impl.RegistryImpl.getService(Unknown Source)
at org.apache.hivemind.impl.RegistryImpl.startup(Unknown Source)
at org.apache.hivemind.impl.RegistryBuilder.constructRegistry(Unknown Source)
at org.apache.hivemind.impl.RegistryBuilder.constructDefaultRegistry(Unknown Source)

And it's not at all obvious where the problem lies. Any suggestions?

Howard said...

The blog is the wrong place. hivemind-user@jakarta.apache.org is the right place. Details on subscribing on the web site.

Kevin Gilpin said...

A centralized way to re-deploy configuration information is a great benefit that HiveMind could provide. My particular application is used to search for and present scientific data. New results are continuously being added to the database, and the visual presentation of the data is forever being tweaked and adjusted to be scientist-friendly. I am externalizing all of the metadata that describes the database and that maps from experimental results to visual components (Tapestry components). I am definetely going to need to re-deploy the metadata without restarting the server.

The current version of this application achieves this by reading all its configuration from a database. A separate job can be kicked off to re-build the metadata in the database. Then, new user sessions automatically see the changes. But now I am moving to HiveMind because I can accomplish a lot more with less hassle.

I think the way that I'll do it is to deploy an MBean with my EAR file that we can use to tell the application when to reload the configuration.

Would it make sense for HiveMind to provide this? Probably not. But hot configuration reloading is important; I just wanted to give you a use case.