Hi, perhaps memcached-session-manager is an option for you: http://code.google.com/p/memcached-session-manager/
It has integration tests that show how to configure it programatically: https://github.com/magro/memcached-session-manager/blob/master/core/src/test/java/de/javakaffee/web/msm/integration/TestUtils.java#L440 Configuration options are described here: http://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration Cheers, Martin On 06/09/2011 03:15 PM, Rüdiger Herrmann wrote: > Hi all, > > I would like to programmatically set up two Tomcat engines and have > them form a basic cluster - all in the same VM. Creating and starting > the servlet engines already works > Tomcat tomcat = new Tomcat() > tomcat.setPort( 123 ); > // create context, add servlet, ... > tomcat.start(); > > What I am struggling with is setting up the cluster. My first attempt > was to use the PersistentManager with Store that uses a shared > directory. But it seems that it only persists session in time > intervals. To enable failover, a session would need to be persisted > after each request. However, I didn't find out how to configure or > trigger the PersistentManager to do so. > Still, the PersistenceManager setup was straightforward and if anyone > knows how to form a cluster with this approach I would be grateful to > know. > > I am aware of the SimpleTcpCluster, which I would try next. Just, > before transforming the XML configuration into API calls (without > known their meaning) I wanted to ask if there is an easier or even > pre-built solution. > > Background: > I work on enabling RAP [1], a web framework, to work in failover > cluster environments. To ensure cluster-support, I have a set of JUnit > tests that issue requests against an embeded cluster of servlet > engines and then examine the state of sessions of the respective > nodes, etc. > Performance isn't important, neither is any advanced clustering > feature (e.g. DeltaManager) needed. My focus is on finding a > lightweight and purely programmatic solution. > > Thanks in advance, > Rüdiger > > [1] http://eclipse.org/rap > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > -- Martin Grotzke http://twitter.com/martin_grotzke
signature.asc
Description: OpenPGP digital signature