public void setApplicationSession(MobicentsSipApplicationSession sipApplicationSession) { if(sipApplicationSession != null) { synchronized (TIMER_LOCK) { this.appSessionKey = sipApplicationSession.getKey(); } } }
public MobicentsSipApplicationSessionKey getKey() { return this.sipApplicationSession.getKey(); }
@Override public boolean equals(Object obj) { if(obj instanceof MobicentsSipApplicationSession) { return ((MobicentsSipApplicationSession)obj).getKey().equals(getKey()); } return false; }
public SipApplicationSessionTimerTask schedule( SipApplicationSessionTimerTask expirationTimerTask, long delay, TimeUnit unit) { if(logger.isDebugEnabled()) { logger.debug("Scheduling sip application session "+ expirationTimerTask.getSipApplicationSession().getKey() +" to expire in " + (delay / (double) 1000 / (double) 60) + " minutes"); } super.schedule(((StandardSasTimerTask)expirationTimerTask), delay); return expirationTimerTask; }
/** * For debugging: return a list of all session ids currently active * */ public String listSipApplicationSessionIds() { StringBuffer sb=new StringBuffer(); Iterator<MobicentsSipApplicationSession> sipApplicationSessions = sipManagerDelegate.getAllSipApplicationSessions(); while (sipApplicationSessions.hasNext()) { sb.append(sipApplicationSessions.next().getKey()).append(" "); } return sb.toString(); }
protected void setSipApplicationSession( MobicentsSipApplicationSession sipApplicationSession) { if (sipApplicationSession != null) { this.sipApplicationSessionKey = sipApplicationSession.getKey(); sipApplicationSession.addSipSession(this); } }
/** * For debugging: return a list of all session ids currently active * */ public String listSipApplicationSessionIds() { StringBuffer sb=new StringBuffer(); Iterator<MobicentsSipApplicationSession> sipApplicationSessions = sipManagerDelegate.getAllSipApplicationSessions(); while (sipApplicationSessions.hasNext()) { sb.append(sipApplicationSessions.next().getKey()).append(" "); } return sb.toString(); }
public SipApplicationSessionTimerTask schedule( SipApplicationSessionTimerTask expirationTimerTask, long delay, TimeUnit unit) { if(logger.isDebugEnabled()) { logger.debug("Scheduling sip application session "+ expirationTimerTask.getSipApplicationSession().getKey() +" to expire in " + (delay / (double) 1000 / (double) 60) + " minutes"); } ((DefaultSasTimerTask)expirationTimerTask).setScheduledFuture((ScheduledFuture<MobicentsSipApplicationSession>)super.schedule(expirationTimerTask, delay, unit)); return expirationTimerTask; }
/** * Removes a sip application session from the manager by its key * @param key the identifier for this session * @return the sip application session that had just been removed, null otherwise */ public MobicentsSipApplicationSession removeSipApplicationSession(final MobicentsSipApplicationSessionKey key) { if(logger.isDebugEnabled()) { logger.debug("Removing a sip application session with the key : " + key); } MobicentsSipApplicationSession sipApplicationSession = sipApplicationSessions.remove(key); if(sipApplicationSession != null) { final String appGeneratedKey = sipApplicationSession.getKey().getAppGeneratedKey(); if(appGeneratedKey != null) { sipApplicationSessionsByAppGeneratedKey.remove(appGeneratedKey); } } return sipApplicationSession; }
public MobicentsSipSessionFacade(MobicentsSipSession sipSession) { this.sipSession = sipSession; this.sipSessionKey = sipSession.getKey(); this.sipAppSessionKey = sipSession.getSipApplicationSession().getKey(); }
/** * Constructor for repeating times * * @param info * Information about the timer * @param delay * Delay until first execution * @param fixedDelay * Whether fixed delay mode should be used * @param period * Period between execution * @param listener * Listener that will get timeout events. */ public ServletTimerImpl(Serializable info, long delay, boolean fixedDelay, long period, TimerListener listener, MobicentsSipApplicationSession appSession) { this.id = UUID.randomUUID().toString(); this.info = info; this.delay = delay; this.scheduledExecutionTime = delay + System.currentTimeMillis(); this.fixedDelay = fixedDelay; this.period = period; this.listener = listener; this.appSessionKey = appSession.getKey(); this.sipManager= appSession.getSipContext().getSipManager(); }
public boolean cancel(SipApplicationSessionTimerTask expirationTimerTask) { //CANCEL needs to remove the shceduled timer see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6602600 //to improve perf ScheduledFuture<MobicentsSipApplicationSession> future = ((DefaultSasTimerTask)expirationTimerTask).getScheduledFuture(); if(future != null) { boolean removed = super.remove((Runnable) future); if(logger.isDebugEnabled()) { logger.debug("expiration timer on sip application session " + expirationTimerTask.getSipApplicationSession().getKey() + " removed : " + removed); } boolean cancelled = future.cancel(true); if(logger.isDebugEnabled()) { logger.debug("expiration timer on sip application session " + expirationTimerTask.getSipApplicationSession().getKey() + " Cancelled : " + cancelled); } future = null; // Purge is expensive when called frequently, only call it every now and then. // We do not sync the numCancelled variable. We dont care about correctness of // the number, and we will still call purge rought once on every 25 cancels. numCancelled++; if(numCancelled % 100 == 0) { super.purge(); } return cancelled; } else { if(logger.isDebugEnabled()) { logger.debug("expiration timer future is null, thus cannot be Cancelled"); } return false; } }
public void putSipSession(String realId, ClusteredSipSession session) { Fqn fqn = getSipSessionFqn(session.getSipApplicationSession().getKey().getId(), realId); if (session.getReplicateSessionBody()) { if(log_.isDebugEnabled()) { log_.debug("Session is dirty or new and is being fully replicated " + session.toString()); } Map map = new HashMap(); // if (useTreeCacheMarshalling_) // map.put(realId, session); // else map.put(realId, externalizeSipSession(session)); // Put in (VERSION_KEY, version) after the real put for cache invalidation map.put(VERSION_KEY, new Integer(session.getVersion())); cacheWrapper_.put(fqn, map); } else { if(log_.isDebugEnabled()) { log_.debug("Session is not being replicated right now, but the version is being updated and remote nodes will pull it on demand when they notice or other event forces full replication. Only the version field is updated now. " + session.toString()); } // Invalidate the remote caches cacheWrapper_.put(fqn, VERSION_KEY, new Integer(session.getVersion())); } }
final String branch = JainSipUtils.createBranch(sipApplicationSession.getKey().getId(), sipFactoryImpl.getSipApplicationDispatcher().getHashFromApplicationName(session.getKey().getApplicationName())); viaHeader.setBranch(branch);
final String branch = JainSipUtils.createBranch(session.getSipApplicationSession().getKey().getId(), sipApplicationDispatcher.getHashFromApplicationName(session.getSipApplicationSession().getKey().getApplicationName())); ViaHeader viaHeader = JainSipUtils.createViaHeader( sipFactoryImpl.getSipNetworkInterfaceManager(), prackRequest, branch, session.getOutboundInterface());
sipApplicationSession.getKey()); sipApplicationSession.addHttpSession(httpSession);
httpSession.setAttribute(APPLICATION_SESSION_ID_ATTRIBUTE_NAME, sipApplicationSession.getKey()); sipApplicationSession.addHttpSession(httpSession);
public SipSession getSession(boolean create) { MobicentsSipSession session = getSipSession(); if (session == null && create) { MobicentsSipApplicationSession sipApplicationSessionImpl = (MobicentsSipApplicationSession)getSipApplicationSession(create); MobicentsSipSessionKey sessionKey = SessionManagerUtil.getSipSessionKey(sipApplicationSessionImpl.getKey().getId(), currentApplicationName, message, false); session = sipApplicationSessionImpl.getSipContext().getSipManager().getSipSession(sessionKey, create, sipFactoryImpl, sipApplicationSessionImpl); session.setSessionCreatingTransactionRequest(this); session.setOrphan(isOrphan()); sessionKey = session.getKey(); } if(session != null) { return session.getFacade(); } return null; }
httpSession.setAttribute(APPLICATION_SESSION_ID_ATTRIBUTE_NAME, sipApplicationSession.getKey()); sipApplicationSession.addHttpSession(httpSession);
sipApplicationSession.getKey()); sipApplicationSession.addHttpSession(httpSession);