public void onSipSessionReadyToInvalidate(MobicentsSipSession mobicentsSipSession) { removeSipSession(mobicentsSipSession); updateReadyToInvalidateState(); }
@Override protected MobicentsSipApplicationSession getNewMobicentsSipApplicationSession( SipApplicationSessionKey key, SipContext sipContext) { if ((maxActiveSipApplicationSessions >= 0) && (sipApplicationSessions.size() >= maxActiveSipApplicationSessions)) { rejectedSipApplicationSessions++; throw new IllegalStateException ("could not create a new sip application session because there is currently too many active sip application sessions"); } sipApplicationSessionCounter++; MobicentsSipApplicationSession sipApplicationSession = new SipApplicationSessionImpl(key, sipContext); return sipApplicationSession; }
@Override public boolean addHttpSession(HttpSession httpSession) { boolean wasNotPresent = super.addHttpSession(httpSession); if(wasNotPresent) { httpSessionsMapModified = true; } return wasNotPresent; }
/** * {@inheritDoc} */ public Object getAttribute(String name) { if(!isValid()) { throw new IllegalStateException("SipApplicationSession already invalidated !"); } return this.getAttributeMap().get(name); }
/** * {@inheritDoc} */ public Object getSession(String id, Protocol protocol) { if(!isValid()) { throw new IllegalStateException("SipApplicationSession already invalidated !"); } if(id == null) { throw new NullPointerException("id is null"); } if(protocol == null) { throw new NullPointerException("protocol is null"); } switch (protocol) { case SIP : return getSipSession(id); case HTTP : return findHttpSession(id); default : break; } return null; }
for(MobicentsSipSession session: getSipSessions(true)) { if(session.isValidInternal()) { boolean lockSession = false; for(HttpSession session: getHttpSessions()) { if(session instanceof ConvergedSession) { ConvergedSession convergedSession = (ConvergedSession) session; for (String key : getAttributeMap().keySet()) { removeAttribute(key, true); cancelExpirationTimer(); notifySipApplicationSessionListeners(SipApplicationSessionEventType.DELETION);
@Override public SipSessionKey removeSipSession( MobicentsSipSession mobicentsSipSession) { SipSessionKey sessionKey = super.removeSipSession(mobicentsSipSession); if(sessionKey != null) { sipSessionsMapModified = true; } return sessionKey; }
public SipSession getSipSession(String id) { if(!isValid()) { throw new IllegalStateException("SipApplicationSession already invalidated !"); } if(logger.isDebugEnabled()) { logger.debug("Trying to find a session with the id " + id); dumpSipSessions(); } boolean isPresent = false; SipSessionKey sipSessionKey = null; try { sipSessionKey = SessionManagerUtil.parseSipSessionKey(id); isPresent = sipSessions.contains(sipSessionKey); } catch (ParseException e) { //can happen if the id passed is invalid } if(isPresent) { return sipContext.getSipManager().getSipSession(sipSessionKey, false, null, this).getFacade(); } else { return null; } }
@SuppressWarnings(value="unchecked") public int setExpires(int deltaMinutes) { if(!isValid()) { throw new IllegalStateException("Impossible to change the sip application " + "session timeout when it has been invalidated !"); cancelExpirationTimer(); cancelExpirationTimer();
@Override public boolean addSipSession(MobicentsSipSession mobicentsSipSession) { boolean wasNotPresent = super.addSipSession(mobicentsSipSession); if(wasNotPresent) { sipSessionsMapModified = true; } return wasNotPresent; }
public void cancelAllTimers() { cancelExpirationTimer(); if(this.servletTimers != null) { for(ServletTimer timer:this.servletTimers.values()) { ((MobicentsServletTimer)timer).cancel(false, false); } } }
/** * Perform the internal processing required to passivate * this session. */ public void passivate() { // Notify ActivationListeners SipApplicationSessionEvent event = null; if(this.sipApplicationSessionAttributeMap != null) { Set<String> keySet = getAttributeMap().keySet(); for (String key : keySet) { Object attribute = getAttributeMap().get(key); if (attribute instanceof SipApplicationSessionActivationListener) { if (event == null) event = new SipApplicationSessionActivationEvent(this, SessionActivationNotificationCause.PASSIVATION); try { ((SipApplicationSessionActivationListener)attribute) .sessionWillPassivate(event); } catch (Throwable t) { logger.error("SipApplicationSessionActivationListener threw exception", t); } } } } }
public void access() { super.access(); ConvergedSessionReplicationContext.bindSipApplicationSession(this, ((JBossCacheSipManager)sipContext.getSipManager()).getSnapshotManager()); // JBAS-3528. If it's not the first access, make sure // the 'new' flag is correct //SipSession doesn't have the isNew flag // if (!firstAccess && isNew) { // setNew(false); // } if (invalidationPolicy == WebMetaData.SESSION_INVALIDATE_ACCESS) { this.sessionMetadataDirty(); } }
ClassLoader oldClassLoader = java.lang.Thread.currentThread().getContextClassLoader(); sipContext.enterSipContext(); SipApplicationSessionEvent event = new SipApplicationSessionEvent(this.getFacade()); if(logger.isDebugEnabled()) { logger.debug("notifying sip application session listeners of context " +
public Iterator<String> getAttributeNames() { if(!isValid()) { throw new IllegalStateException("SipApplicationSession already invalidated !"); } return this.getAttributeMap().keySet().iterator(); }
public void removeAttribute(String name, boolean byPassValidCheck) { if (!byPassValidCheck && !isValid()) throw new IllegalStateException( "Can not bind object to session that has been invalidated!!"); Object value = this.getAttributeMap().remove(name);
public void setAttribute(String key, Object attribute) { if (!isValid()) throw new IllegalStateException( "Can not bind object to session that has been invalidated!!"); Object oldValue = getAttributeMap().get(key); if (attribute != oldValue) { event = new SipApplicationSessionBindingEvent(this, key); Object previousValue = this.getAttributeMap().put(key, attribute);