/** * Computes the sip application session key from the input parameters. * The sip application session key will be of the form (UUID,APPNAME) * @param applicationName the name of the application that will be the second component of the key * @param id the Id composing the first component of the key * @return the computed key * @throws NullPointerException if one of the two parameters is null */ public static SipApplicationSessionKey getSipApplicationSessionKey(final String applicationName, final String id, final String appGeneratedKey) { if(applicationName == null) { throw new NullPointerException("the application name cannot be null for sip application session key creation"); } return new SipApplicationSessionKey( id, applicationName, appGeneratedKey); }
public String getHaId() { return key.getId(); } }
/** * */ public void dumpSipApplicationSessions() { if(logger.isDebugEnabled()) { logger.debug("sip application sessions present in the session manager"); Enumeration<SipApplicationSessionKey> keys = sipApplicationSessions.keys(); while(keys.hasMoreElements()) { SipApplicationSessionKey sipApplicationSessionKey = keys.nextElement(); logger.debug(sipApplicationSessionKey.toString() + "/hashed_app_name=" + sipFactoryImpl.getSipApplicationDispatcher().getHashFromApplicationName(sipApplicationSessionKey.getApplicationName())); } } }
Object sessionData = proxy_.getSipApplicationSessionData(key.getId()); if(sessionData != null) { if (session == null) { try { if (doTx) endTransaction(key.toString()); } finally { ConvergedSessionReplicationContext.finishSipCacheActivity(); unloadedSipApplicationSessions_.remove(key.toString()); stats_.updateLoadStats(key.toString(), elapsed); log_.debug("loadSession(): id= " + key.toString() + ", session=" + session); log_.debug("loadSession(): session " + key.toString() + " not found in distributed cache");
/** * {@inheritDoc} */ public String getId() { return key.toString(); }
public String getApplicationName() { return key.getApplicationName(); }
/** * Retrieve a sip application session from its key. If none exists, one can enforce * the creation through the create parameter to true. * @param key the key identifying the sip application session to retrieve * @param create if set to true, if no session has been found one will be created * @return the sip application session matching the key */ public MobicentsSipApplicationSession getSipApplicationSession(final SipApplicationSessionKey key, final boolean create) { MobicentsSipApplicationSession sipApplicationSessionImpl = null; //first we check if the app session can be found by its app generated key final String appGeneratedKey = key.getAppGeneratedKey(); if(appGeneratedKey != null) { if(logger.isDebugEnabled()) { logger.debug("trying to find sip application session with generated key " + appGeneratedKey); } sipApplicationSessionImpl = sipApplicationSessionsByAppGeneratedKey.get(appGeneratedKey); } if(sipApplicationSessionImpl == null) { if(logger.isDebugEnabled()) { logger.debug("trying to find sip application session with key " + key); } sipApplicationSessionImpl = sipApplicationSessions.get(key); } if(sipApplicationSessionImpl == null && create) { sipApplicationSessionImpl = createSipApplicationSession(key); } return sipApplicationSessionImpl; }
@Override public int hashCode() { return getKey().hashCode(); }
public void processRemoteSipApplicationSessionAttributeRemoval(SipApplicationSessionKey sipApplicationSessionKey, String attrKey) { ClusteredSipApplicationSession session = findLocalSipApplicationSession(sipApplicationSessionKey, false); if (session != null) { final String realId = sipApplicationSessionKey.toString(); boolean localCall = false; // call is due to remote event boolean localOnly = true; // don't call back into cache boolean notify = false; // SRV.10.7 gives us leeway // not to notify listeners, // which is safer // Ensure the correct TCL is in place ClassLoader prevTcl = Thread.currentThread() .getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(tcl_); synchronized (session) { session.removeAttributeInternal(attrKey, localCall, localOnly, notify); } if (logger.isDebugEnabled()) log_ .debug("processRemoteAttributeRemoval: removed attribute " + attrKey + " from " + realId); } finally { Thread.currentThread().setContextClassLoader(prevTcl); } } }
public void readExternal(ObjectInput arg0) throws IOException, ClassNotFoundException { String sipApplicationSessionId = arg0.readUTF(); SipApplicationSessionKey key = null; try { key = SessionManagerUtil.parseSipApplicationSessionKey(sipApplicationSessionId); } catch (ParseException e) { logger.error("Couldn't parse the following sip application session key " + sipApplicationSessionId, e); throw new IllegalArgumentException("Couldn't parse the following sip application session key " + sipApplicationSessionId, e); } SipContext sipContext = StaticServiceHolder.sipStandardService .getSipApplicationDispatcher().findSipApplication(key.getApplicationName()); this.sipApplicationSession = sipContext.getSipManager().getSipApplicationSession( key, false); }
final MobicentsSipApplicationSession newSipApplicationSessionImpl = getNewMobicentsSipApplicationSession(key, (SipContext) container); final String appGeneratedKey = key.getAppGeneratedKey();
public SipApplicationSession getApplicationSessionByKey(String applicationSessionKey, boolean create, boolean isContainerManaged) { if(applicationSessionKey == null) { throw new NullPointerException("the given key is null !"); } SipApplicationSessionKey sipApplicationSessionKey = new SipApplicationSessionKey(null, sipContext.getApplicationName(), applicationSessionKey); MobicentsSipApplicationSession sipApplicationSession = sipContext.getSipManager().getSipApplicationSession(sipApplicationSessionKey, create); if(sipApplicationSession == null) { return null; } else { // make sure to acquire this app session and add it to the set of app sessions we monitor in the context of the application // to release them all when we exit application code sipContext.enterSipApp(sipApplicationSession, null, true, isContainerManaged); return sipApplicationSession.getFacade(); } }
final String realId = sipApplicationSessionKey.toString(); if (session == null) {
SessionManagerUtil.getSipApplicationSessionKey(applicationName, getAppSessionId(), null).getId(), applicationName, message, false);
public void run() { final SipContext sipContext = sipFactoryImpl.getSipApplicationDispatcher().findSipApplication(key.getApplicationName()); if(sipContext != null) { SipManager sipManager = sipContext.getSipManager();
SipApplicationSessionKey sipApplicationSessionKey = new SipApplicationSessionKey(sessionKey.getApplicationSessionId(), sessionKey.getApplicationName(), null); MobicentsSipApplicationSession sipApplicationSession = sipContext.getSipManager().getSipApplicationSession(sipApplicationSessionKey, false); sipSession = sipContext.getSipManager().getSipSession(sessionKey, false, sipFactoryImpl, sipApplicationSession);
unloadedSipApplicationSessions_.remove(key.toString());
if(logger.isDebugEnabled()) { logger.debug("notifying sip application session listeners of context " + key.getApplicationName() + " of following event " + sipApplicationSessionEventType); if(logger.isDebugEnabled()) { logger.debug("notifying sip application session listener " + sipApplicationSessionListener.getClass().getName() + " of context " + key.getApplicationName() + " of following event " + sipApplicationSessionEventType);
SipApplicationSessionKey key = new SipApplicationSessionKey(sessId, sipApplicationName); ClusteredSipApplicationSession sipApplicationSession = manager_.findLocalSipApplicationSession(key, false); if (sipApplicationSession == null)
public SipApplicationSession getApplicationSessionById(String applicationSessionId, boolean isContainerManaged) { if(applicationSessionId == null) { throw new NullPointerException("the given id is null !"); } SipApplicationSessionKey applicationSessionKey; try { applicationSessionKey = SessionManagerUtil.parseSipApplicationSessionKey(applicationSessionId); } catch (ParseException e) { logger.error("the given application session id : " + applicationSessionId + " couldn't be parsed correctly ",e); return null; } if(applicationSessionKey.getApplicationName().equals(sipContext.getApplicationName())) { MobicentsSipApplicationSession sipApplicationSession = sipContext.getSipManager().getSipApplicationSession(applicationSessionKey, false); if(sipApplicationSession == null) { return null; } else { // make sure to acquire this app session and add it to the set of app sessions we monitor in the context of the application // to release them all when we exit application code sipContext.enterSipApp(sipApplicationSession, null, true, isContainerManaged); return sipApplicationSession.getFacade(); } } else { logger.warn("the given application session id : " + applicationSessionId + " tried to be retrieved from incorret application " + sipContext.getApplicationName()); return null; } }