Friday, June 03, 2005

Hivemind support for Hibernate Long-Session-Pattern

Finally I got around to dig into HiveMind's concept of service-models. Not much digging, actually it's amazingly simple and intuitive. I've implemented a new service-model called "stateful" which attaches service instances to a User-Session. "Stateful" actually is a bit of a misnomer since threaded and pooled services also hold state for the duration of one request.
Basically all one needs is
  • a persistence service I called ClientStateStorage, which can be provided with an http session for production. Otherwise it uses a simple Map for testing.
  • a service-model extending AbstractServiceModelImpl which works much like the PooledServiceModel
  • six (!) lines of xml to configure the stuff
And the best thing: Deployment by jar-dropping - I really love the way, HiveMind collects its config-data from all visible jars. I won't write another Springish application-context.xml.
Cluster-Failover-Safety is of course an issue because, as I understood it, HiveMind serialises services in a stateless manner (just writing its Id and, upon reading, creating a fresh instance with that id). For my Apps, however, that's not a big enough problem to trouble me much. Server-crashes happen so seldomly ...