* Otherwise, we fall back to memory-only for both SIP and HTTP.
*/
public void initializeConfiguration() {
boolean isSipAppDistributable = false;
SipBundleDescriptor sbd = null;
if (_wbd instanceof SipBundleDescriptor) {
sbd = (SipBundleDescriptor) _wbd;
SipApplication sipApp = sbd.getSipApplication();
if (sipApp != null) {
isSipAppDistributable = ((SipApplication)sipApp).isDistributable();
}
if (sbd.isConverged()) {
// Determine persistence configuration for HTTP
super.initializeConfiguration();
}
}
// Determine persistence configuration for SIP
PersistenceType persistenceType = PersistenceType.MEMORY;
String persistenceFrequency = null;
String persistenceScope = null;
boolean isAvailabilityEnabled = lookup.calculateSipAvailabilityEnabledFromConfig(_ctx);
if (isAvailabilityEnabled) {
// These are the global defaults if nothing is set at
// domain.xml or sun-sip.xml
persistenceType = PersistenceType.REPLICATED;
persistenceFrequency = "sip-transaction";
persistenceScope = "session";
}
// If domain.xml default exists, then use that
PersistenceType domainPersistenceType = lookup.getSipPersistenceTypeFromConfig();
if (domainPersistenceType != null) {
persistenceType = domainPersistenceType;
persistenceFrequency = lookup.getSipPersistenceFrequencyFromConfig();
persistenceScope = lookup.getSipPersistenceScopeFromConfig();
}
// Consider persistence type, scope, and frequency from sun-sip.xml
if (sipSmBean != null) {
String pType = sipSmBean.getAttributeValue(
SessionManager.PERSISTENCE_TYPE);
persistenceType = PersistenceType.parseType(pType, persistenceType);
String sipAppLevelPersistenceFrequency =
getPersistenceFrequency(sipSmBean);
if(sipAppLevelPersistenceFrequency != null) {
persistenceFrequency = sipAppLevelPersistenceFrequency;
}
String sipAppLevelPersistenceScope =
getPersistenceScope(sipSmBean);
if(sipAppLevelPersistenceScope != null) {
persistenceScope = sipAppLevelPersistenceScope;
}
}
String frequency = null;
String scope = null;
// Deliberately leave frequency & scope null in memory-only case
if (persistenceType != PersistenceType.MEMORY) {
frequency = persistenceFrequency;
scope = persistenceScope;
}
// If sip app is not distributable, and non-memory option
// is attempted, log warning and set back to memory-only
if (!isSipAppDistributable &&
(persistenceType != PersistenceType.MEMORY)) {
String sipAppName = getApplicationId(_ctx);
// Suppress log warning for default-web-module
// Log message only if availabilityenabled = true is attempted
if (isAvailabilityEnabled &&
!sipAppName.equals(Constants.DEFAULT_WEB_MODULE_NAME) &&
!isSystemApp(sipAppName)) {
SIP_LOGGER.log(Level.WARNING, "sipstack.invalid_session_manager_config",
new Object[] { sipAppName, persistenceType.getType(),
frequency, scope });
}
// Fall back to memory option
persistenceType = PersistenceType.MEMORY;
frequency = null;
scope = null;
}
// If availability-enabled is false, reset to "memory"
if (!isAvailabilityEnabled) {
// Set back to memory option
persistenceType = PersistenceType.MEMORY;
frequency = null;
scope = null;
}
sipPersistenceType = persistenceType;
sipPersistenceFrequency = frequency;
sipPersistenceScope = scope;
// Make sure that if the app is converged (i.e., contains both
// a web.xml and sip.xml), and in-memory replication has been turned
// on for SIP, it must also have been turned on for HTTP, and vice
// versa.
// Otherwise, we fall back to memory-only for both SIP and HTTP.
if (sbd != null &&
sbd.isConverged() &&
(((sipPersistenceType == PersistenceType.REPLICATED) &&
(_persistence != PersistenceType.REPLICATED)) ||
((sipPersistenceType != PersistenceType.REPLICATED) &&
(_persistence == PersistenceType.REPLICATED)))) {
SIP_LOGGER.log(Level.WARNING, "sipstack.inconsistent_persistence_type", getApplicationId(_ctx));