Revision: 15206
Author: [email protected]
Date: Mon Nov 15 03:34:52 2010
Log: Update Issue 1837

Hook up the dialog passivation into the sip session passivation
http://code.google.com/p/mobicents/source/detail?r=15206

Modified:
/trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/jboss/web/tomcat/service/session/ClusteredSipSession.java /trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/jboss/web/tomcat/service/session/JBossCacheSipManager.java /trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/mobicents/servlet/sip/core/timers/TimerServiceTask.java /trunk/servers/sip-servlets/sip-servlets-jboss5-ha-server-cache/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/DistributedCacheConvergedSipManagerDelegate.java

=======================================
--- /trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/jboss/web/tomcat/service/session/ClusteredSipSession.java Fri Oct 8 00:53:57 2010 +++ /trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/jboss/web/tomcat/service/session/ClusteredSipSession.java Mon Nov 15 03:34:52 2010
@@ -65,6 +65,7 @@
import org.jboss.web.tomcat.service.session.notification.ClusteredSessionManagementStatus; import org.jboss.web.tomcat.service.session.notification.ClusteredSessionNotificationCause; import org.jboss.web.tomcat.service.session.notification.ClusteredSipSessionNotificationPolicy;
+import org.mobicents.ha.javax.sip.ClusteredSipStack;
import org.mobicents.servlet.sip.core.session.MobicentsSipApplicationSession;
 import org.mobicents.servlet.sip.core.session.SessionManagerUtil;
 import org.mobicents.servlet.sip.core.session.SipApplicationSessionKey;
@@ -75,6 +76,7 @@
 import org.mobicents.servlet.sip.message.SipFactoryImpl;
 import org.mobicents.servlet.sip.proxy.ProxyImpl;
 import org.mobicents.servlet.sip.startup.SipService;
+import org.mobicents.servlet.sip.startup.StaticServiceHolder;

 /**
* Abstract base class for sip session clustering based on SipSessionImpl. Different session
@@ -887,7 +889,7 @@
                                        SipService sipService = (SipService) 
service;
                                        SipStack sipStack = 
sipService.getSipStack();
                                        if(sipStack != null) {
- sessionCreatingDialog = ((SipStackImpl)sipStack).getDialog(sessionCreatingDialogId); + sessionCreatingDialog = ((ClusteredSipStack)sipStack).getDialog(sessionCreatingDialogId);
                                                if(logger.isDebugEnabled()) {
                                                        logger.debug("dialog 
injected " + sessionCreatingDialog);
                                                }
@@ -1597,4 +1599,8 @@
        public String getHaId() {
                return haId;
        }
-}
+
+       public void processDialogPassivation() {
+ ((ClusteredSipStack)StaticServiceHolder.sipStandardService.getSipStack()).passivateDialog(sessionCreatingDialogId);
+       }
+}
=======================================
--- /trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/jboss/web/tomcat/service/session/JBossCacheSipManager.java Fri Nov 5 14:20:46 2010 +++ /trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/jboss/web/tomcat/service/session/JBossCacheSipManager.java Mon Nov 15 03:34:52 2010
@@ -1537,7 +1537,7 @@
                   // JBAS-2403. Check for outdated sessions where we think
                   // the local copy has timed out.  If found, refresh the
// session from the cache in case that might change the timeout - if (this.outdatedSipSessionChecker.isSessionOutdated(session) && session.isValid()) + if (this.outdatedSipSessionChecker.isSessionOutdated(session) && session.isValidInternal())
                   {
// FIXME in AS 5 every time we get a notification from the distributed
                      // cache of an update, we get the latest timestamp. So
@@ -1556,7 +1556,7 @@
// expire() are meant to be multi-threaded and synchronize
                   // properly internally; synchronizing externally can lead
                   // to deadlocks!!
-                  if (!session.isValid()) continue;
+                  if (!session.isValidInternal()) continue;
                }

// we now have a valid session; store it so we can check later
@@ -1712,7 +1712,7 @@
// expire() are meant to be multi-threaded and synchronize
                   // properly internally; synchronizing externally can lead
                   // to deadlocks!!
-                  if (!session.isValid()) continue;
+                  if (!session.isValidInternal()) continue;
                }

// we now have a valid session; store it so we can check later
@@ -1791,11 +1791,11 @@
       if (trace_)
       {
log_.trace("processSipApplicationSessionExpirationPassivation(): Completed ..."); - log_.trace("processSipApplicationSessionExpirationPassivation(): active sessions = " + calcActiveSessions()); - log_.trace("processSipApplicationSessionExpirationPassivation(): expired sessions = " + expiredCounter_); + log_.trace("processSipApplicationSessionExpirationPassivation(): active sessions = " + calcActiveSipApplicationSessions()); + log_.trace("processSipApplicationSessionExpirationPassivation(): expired sessions = " + expiredSipApplicationSessionCounter_);
          if (passivate)
          {
- log_.trace("processSipApplicationSessionExpirationPassivation(): passivated count = " + getPassivatedSessionCount()); + log_.trace("processSipApplicationSessionExpirationPassivation(): passivated count = " + getPassivatedSipApplicationSessionCount());
          }
       }
    }
@@ -2808,18 +2808,19 @@
                // if it's already unloaded session (session == null) don't do 
anything,
                if (session != null) {
                        synchronized (session) {
-                               if (trace_) {
-                                       log_.trace("Passivating session with id: 
" + key);
+                               if (logger.isDebugEnabled()) {
+                                       logger.debug("Passivating session with id: 
" + key);
                                }

                                session
                                                
.notifyWillPassivate(ClusteredSessionNotificationCause.PASSIVATION);
+                               session.processDialogPassivation();
getDistributedCacheConvergedSipManager().evictSipSession(session.getSipApplicationSession().getKey().getId(), SessionManagerUtil.getSipSessionHaKey(key));
                                sipSessionPassivated();
                                sipManagerDelegate.removeSipSession(key);
                        }
-               } else if (trace_) {
- log_.trace("processSipSessionPassivation(): could not find sip session "
+               } else if (logger.isDebugEnabled()) {
+ logger.debug("processSipSessionPassivation(): could not find sip session "
                                        + key);
                }
        }
@@ -2837,8 +2838,8 @@
                // if it's already unloaded session (session == null) don't do 
anything,
                if (session != null) {
                        synchronized (session) {
-                               if (trace_) {
-                                       log_.trace("Passivating session with id: 
" + key);
+                               if (logger.isDebugEnabled()) {
+                                       logger.debug("Passivating session with id: 
" + key);
                                }

                                session
@@ -2847,8 +2848,8 @@
                                sipApplicationSessionPassivated();
                                
sipManagerDelegate.removeSipApplicationSession(key);
                        }
-               } else if (trace_) {
- log_.trace("processSipApplicationSessionPassivation(): could not find sip application session "
+               } else if (logger.isDebugEnabled()) {
+ logger.debug("processSipApplicationSessionPassivation(): could not find sip application session "
                                        + key);
                }
        }
=======================================
--- /trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/mobicents/servlet/sip/core/timers/TimerServiceTask.java Mon Jul 12 11:58:14 2010 +++ /trunk/servers/sip-servlets/sip-servlets-jboss5/src/main/java/org/mobicents/servlet/sip/core/timers/TimerServiceTask.java Mon Nov 15 03:34:52 2010
@@ -58,7 +58,9 @@
                                }
this.servletTimer = new ServletTimerImpl(data.getData(), data.getDelay(), sipApplicationSession.getSipContext().getListeners().getTimerListener(), sipApplicationSession);
                        } else {
- logger.debug("sip application session for key " + data.getKey() + " was not found neither locally or in the cache, sip servlet timer recreation will be problematic");
+                               if(logger.isDebugEnabled()) {
+ logger.debug("sip application session for key " + data.getKey() + " was not found neither locally or in the cache, sip servlet timer recreation will be problematic");
+                               }
                        }
                } else {
                        this.servletTimer = servletTimerImpl;
=======================================
--- /trunk/servers/sip-servlets/sip-servlets-jboss5-ha-server-cache/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/DistributedCacheConvergedSipManagerDelegate.java Wed Aug 4 14:38:10 2010 +++ /trunk/servers/sip-servlets/sip-servlets-jboss5-ha-server-cache/src/main/java/org/jboss/web/tomcat/service/session/distributedcache/impl/jbc/DistributedCacheConvergedSipManagerDelegate.java Mon Nov 15 03:34:52 2010
@@ -114,9 +114,9 @@
Fqn<String> fqn = dataOwner == null ? getSipSessionFqn(jBossCacheService.combinedPath_, sipAppSessionKey, key) : getBuddyBackupSipSessionFqn(dataOwner, jBossCacheService.combinedPath_,
                                sipAppSessionKey, key);
-               if (log_.isTraceEnabled()) {
+               if (log_.isDebugEnabled()) {
                        log_
- .trace("evictSession(): evicting session from my distributed store. Fqn: " + .debug("evictSession(): evicting sip session from my distributed store. Fqn: "
                                                        + fqn);
                }
                jBossCacheService.cacheWrapper_.evictSubtree(fqn);
@@ -126,9 +126,9 @@
Fqn<String> fqn = dataOwner == null ? getSipApplicationSessionFqn(jBossCacheService.combinedPath_, key) : getBuddyBackupSipApplicationSessionFqn(dataOwner, jBossCacheService.combinedPath_,
                                                key);
-               if (log_.isTraceEnabled()) {
+               if (log_.isDebugEnabled()) {
                        log_
- .trace("evictSession(): evicting session from my distributed store. Fqn: " + .debug("evictSession(): evicting sip application session from my distributed store. Fqn: "
                                                        + fqn);
                }
                jBossCacheService.cacheWrapper_.evictSubtree(fqn);

Reply via email to