String persistenceType = "replicated";
String persistenceFrequency = "web-method";
String persistenceScope = "session";
Object[] params = { ctx.getPath(), persistenceType, persistenceFrequency, persistenceScope };
_logger.log(Level.INFO, "webcontainer.haPersistence", params);
ReplicationWebEventPersistentManager mgr = new ReplicationWebEventPersistentManager();
ReplicaCache replicaCache = new ReplicaCache(mgr);
mgr.setReplicaCache(replicaCache);
mgr.setPassedInPersistenceType(getPassedInPersistenceType());
mgr.setIsConverged(isConverged());
mgr.setMaxActiveSessions(maxSessions); //FIXME: put this back
//mgr.setCheckInterval(reapInterval);
mgr.setMaxIdleBackup(0); // FIXME: Make configurable
mgr.setRelaxCacheVersionSemantics(relaxCacheVersionSemantics);
mgr.setSkipRollingUpgradeBackupRestore(skipRollingUpgradeBackupRestore);
mgr.setRollingUpgradeBackupDirectory(rollingUpgradeBackupDirectory);
ReplicationStore store = new ReplicationStore();
//store.setCheckInterval(storeReapInterval); //FIXME: put this back
mgr.setStore(store);
mgr.setDuplicateIdsSemanticsAllowed(false);
//in the future can set other implementations
//of UuidGenerator in server.xml
//even if not set it defaults to UuidGeneratorImpl
ServerConfigLookup lookup = new ServerConfigLookup();
UuidGenerator generator = lookup.getUuidGeneratorFromConfig();
mgr.setUuidGenerator(generator);
if(_logger.isLoggable(Level.FINEST)) {
_logger.finest("UUID_GENERATOR = " + generator);
}
//for intra-vm session locking
if(_logger.isLoggable(Level.FINEST)) {
_logger.finest("sctx.restrictedSetPipeline(new SessionLockingStandardPipeline(sctx))");
}
StandardContext sctx = (StandardContext) ctx;
sctx.restrictedSetPipeline(new SessionLockingStandardPipeline(sctx));
//special code for Java Server Faces
if(sctx.findParameter(JSF_HA_ENABLED) == null) {
sctx.addParameter(JSF_HA_ENABLED, "true");
}
ctx.setManager(mgr);
//this must be after ctx.setManager(mgr);
if(!sctx.isSessionTimeoutOveridden()) {
mgr.setMaxInactiveInterval(sessionMaxInactiveInterval);
}
//add SessionFactory
mgr.setSessionFactory(new FullSessionFactory());
//add HAStorePool
ServerConfigReader configReader = new ServerConfigReader();
int haStorePoolSize = configReader.getHAStorePoolSizeFromConfig();
int haStorePoolUpperSize = configReader.getHAStorePoolUpperSizeFromConfig();
int haStorePoolPollTime = configReader.getHAStorePoolPollTimeFromConfig();
StoreFactory haStoreFactory = new ReplicationFullSessionStoreFactory();
StorePool storePool =
new StorePool(haStorePoolSize, haStorePoolUpperSize,
haStorePoolPollTime, haStoreFactory);
mgr.setStorePool(storePool);
//add HASessionStoreValve
HASessionStoreValve hadbValve = new HASessionStoreValve();
StandardContext stdCtx = (StandardContext) ctx;
stdCtx.addValve(hadbValve);