org.mobicents.servlet.sip.core.session
Class SipManagerDelegate

java.lang.Object
  extended by org.mobicents.servlet.sip.core.session.SipManagerDelegate
Direct Known Subclasses:
ClusteredSipManagerDelegate, SipStandardManagerDelegate

public abstract class SipManagerDelegate
extends java.lang.Object

This class handles the management of sip sessions and sip application sessions for a given container (context) It is a delegate since it is used by many manager implementations classes (Standard and clustered ones)

Author:
Jean Deruelle

Field Summary
protected  org.apache.catalina.Container container
           
protected  int expiredSipApplicationSessions
          Number of sip application sessions that have expired.
protected  int expiredSipSessions
          Number of sip sessions that have expired.
protected  int maxActiveSipApplicationSessions
          The maximum number of active Sip Application Sessions allowed, or -1 for no limit.
protected  int maxActiveSipSessions
          The maximum number of active Sip Sessions allowed, or -1 for no limit.
protected  int rejectedSipApplicationSessions
          Number of sip application session creations that failed due to maxActiveSipApplicationSessions.
protected  int rejectedSipSessions
          Number of sip session creations that failed due to maxActiveSipSessions.
protected  int sipApplicationSessionAverageAliveTime
          Average time (in seconds) that expired Sip Application Sessions had been alive.
protected  int sipApplicationSessionCounter
           
protected  int sipApplicationSessionMaxAliveTime
          The longest time (in seconds) that an expired Sip Application session had been alive.
protected  java.util.concurrent.ConcurrentHashMap<SipApplicationSessionKey,MobicentsSipApplicationSession> sipApplicationSessions
           
protected  SipFactoryImpl sipFactoryImpl
           
protected  int sipSessionAverageAliveTime
          Average time (in seconds) that expired sip sessions had been alive.
protected  int sipSessionCounter
           
protected  int sipSessionMaxAliveTime
          The longest time (in seconds) that an expired sip session had been alive.
protected  java.util.concurrent.ConcurrentHashMap<SipSessionKey,MobicentsSipSession> sipSessions
           
 
Constructor Summary
SipManagerDelegate()
           
 
Method Summary
 void changeSessionKey(SipSessionKey oldKey, SipSessionKey newKey)
           
protected  MobicentsSipSession createDerivedSipSession(MobicentsSipSession parentSipSession, SipSessionKey sessionKey)
          clone the parent sip session given in parameter except its attributes (they will be shared) and add it to the internal map of derived sessions identifying it by its ToTag
 void dumpSipApplicationSessions()
           
 void dumpSipSessions()
           
 MobicentsSipApplicationSession findSipApplicationSession(javax.servlet.http.HttpSession httpSession)
          Retrieves the sip application session holding the converged http session in parameter
 int getActiveSipApplicationSessions()
          Returns the number of active sessions
 int getActiveSipSessions()
          Returns the number of active sessions
 java.util.Iterator<MobicentsSipApplicationSession> getAllSipApplicationSessions()
          Retrieve all sip application sessions currently hold by the session manager
 java.util.Iterator<MobicentsSipSession> getAllSipSessions()
          Retrieve all sip sessions currently hold by the session manager
 org.apache.catalina.Container getContainer()
           
 int getExpiredSipApplicationSessions()
          Gets the number of sessions that have expired.
 int getExpiredSipSessions()
          Gets the number of sessions that have expired.
 int getMaxActiveSipApplicationSessions()
          Return the maximum number of active Sessions allowed, or -1 for no limit.
 int getMaxActiveSipSessions()
          Return the maximum number of active Sessions allowed, or -1 for no limit.
protected abstract  MobicentsSipApplicationSession getNewMobicentsSipApplicationSession(SipApplicationSessionKey key, SipContext sipContext)
           
protected abstract  MobicentsSipSession getNewMobicentsSipSession(SipSessionKey key, SipFactoryImpl sipFactoryImpl, MobicentsSipApplicationSession mobicentsSipApplicationSession)
           
 int getNumberOfSipApplicationSessions()
          Retrieve all sip application sessions currently hold by the session manager
 int getNumberOfSipSessions()
          Retrieve all sip sessions currently hold by the session manager
 int getRejectedSipApplicationSessions()
          Number of sip session creations that failed due to maxActiveSipSessions
 int getRejectedSipSessions()
          Number of sip session creations that failed due to maxActiveSipSessions
 MobicentsSipApplicationSession getSipApplicationSession(SipApplicationSessionKey key, boolean create)
          Retrieve a sip application session from its key.
 int getSipApplicationSessionAverageAliveTime()
          Gets the average time (in seconds) that expired sessions had been alive.
 int getSipApplicationSessionCounter()
          Total sessions created by this manager.
 int getSipApplicationSessionMaxAliveTime()
          Gets the longest time (in seconds) that an expired session had been alive.
 SipFactoryImpl getSipFactoryImpl()
           
 MobicentsSipSession getSipSession(SipSessionKey key, boolean create, SipFactoryImpl sipFactoryImpl, MobicentsSipApplicationSession sipApplicationSessionImpl)
          Retrieve a sip session from its key.
 int getSipSessionAverageAliveTime()
          Gets the average time (in seconds) that expired sessions had been alive.
 int getSipSessionCounter()
          Total sessions created by this manager.
 int getSipSessionMaxAliveTime()
          Gets the longest time (in seconds) that an expired session had been alive.
 void removeAllSessions()
          Remove the sip sessions and sip application sessions
 MobicentsSipApplicationSession removeSipApplicationSession(SipApplicationSessionKey key)
          Removes a sip application session from the manager by its key
 MobicentsSipSession removeSipSession(SipSessionKey key)
          Removes a sip session from the manager by its key
 void setContainer(org.apache.catalina.Container container)
           
 void setExpiredSipApplicationSessions(int expiredSipApplicationSessions)
          Sets the number of sessions that have expired.
 void setExpiredSipSessions(int expiredSipSessions)
          Sets the number of sessions that have expired.
 void setMaxActiveSipApplicationSessions(int max)
          Set the maximum number of actives Sip Application Sessions allowed, or -1 for no limit.
 void setMaxActiveSipSessions(int max)
          Set the maximum number of actives Sip Sessions allowed, or -1 for no limit.
 void setRejectedSipApplicationSessions(int rejectedSipApplicationSessions)
           
 void setRejectedSipSessions(int rejectedSipSessions)
           
 void setSipApplicationSessionAverageAliveTime(int sipApplicationSessionAverageAliveTime)
          Sets the average time (in seconds) that expired sessions had been alive.
 void setSipApplicationSessionCounter(int sipApplicationSessionCounter)
           
 void setSipApplicationSessionMaxAliveTime(int sipApplicationSessionMaxAliveTime)
          Sets the longest time (in seconds) that an expired session had been alive.
 void setSipFactoryImpl(SipFactoryImpl sipFactoryImpl)
           
 void setSipSessionAverageAliveTime(int sipSessionAverageAliveTime)
          Sets the average time (in seconds) that expired sessions had been alive.
 void setSipSessionCounter(int sipSessionCounter)
           
 void setSipSessionMaxAliveTime(int sipSessionMaxAliveTime)
          Sets the longest time (in seconds) that an expired session had been alive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sipApplicationSessions

protected java.util.concurrent.ConcurrentHashMap<SipApplicationSessionKey,MobicentsSipApplicationSession> sipApplicationSessions

sipSessions

protected java.util.concurrent.ConcurrentHashMap<SipSessionKey,MobicentsSipSession> sipSessions

sipFactoryImpl

protected SipFactoryImpl sipFactoryImpl

container

protected org.apache.catalina.Container container

maxActiveSipSessions

protected int maxActiveSipSessions
The maximum number of active Sip Sessions allowed, or -1 for no limit.


maxActiveSipApplicationSessions

protected int maxActiveSipApplicationSessions
The maximum number of active Sip Application Sessions allowed, or -1 for no limit.


rejectedSipSessions

protected int rejectedSipSessions
Number of sip session creations that failed due to maxActiveSipSessions.


rejectedSipApplicationSessions

protected int rejectedSipApplicationSessions
Number of sip application session creations that failed due to maxActiveSipApplicationSessions.


sipSessionMaxAliveTime

protected int sipSessionMaxAliveTime
The longest time (in seconds) that an expired sip session had been alive.


sipSessionAverageAliveTime

protected int sipSessionAverageAliveTime
Average time (in seconds) that expired sip sessions had been alive.


expiredSipSessions

protected int expiredSipSessions
Number of sip sessions that have expired.


sipApplicationSessionMaxAliveTime

protected int sipApplicationSessionMaxAliveTime
The longest time (in seconds) that an expired Sip Application session had been alive.


sipApplicationSessionAverageAliveTime

protected int sipApplicationSessionAverageAliveTime
Average time (in seconds) that expired Sip Application Sessions had been alive.


expiredSipApplicationSessions

protected int expiredSipApplicationSessions
Number of sip application sessions that have expired.


sipSessionCounter

protected int sipSessionCounter

sipApplicationSessionCounter

protected int sipApplicationSessionCounter
Constructor Detail

SipManagerDelegate

public SipManagerDelegate()
Method Detail

getSipFactoryImpl

public SipFactoryImpl getSipFactoryImpl()
Returns:
the SipFactoryImpl

setSipFactoryImpl

public void setSipFactoryImpl(SipFactoryImpl sipFactoryImpl)
Parameters:
sipFactoryImpl - the SipFactoryImpl to set

getContainer

public org.apache.catalina.Container getContainer()
Returns:
the container

setContainer

public void setContainer(org.apache.catalina.Container container)
Parameters:
container - the container to set

removeSipSession

public MobicentsSipSession removeSipSession(SipSessionKey key)
Removes a sip session from the manager by its key

Parameters:
key - the identifier for this session
Returns:
the sip session that had just been removed, null otherwise

removeSipApplicationSession

public MobicentsSipApplicationSession removeSipApplicationSession(SipApplicationSessionKey key)
Removes a sip application session from the manager by its key

Parameters:
key - the identifier for this session
Returns:
the sip application session that had just been removed, null otherwise

getSipApplicationSession

public MobicentsSipApplicationSession getSipApplicationSession(SipApplicationSessionKey key,
                                                               boolean create)
Retrieve a sip application session from its key. If none exists, one can enforce the creation through the create parameter to true.

Parameters:
key - the key identifying the sip application session to retrieve
create - if set to true, if no session has been found one will be created
Returns:
the sip application session matching the key

getSipSession

public MobicentsSipSession getSipSession(SipSessionKey key,
                                         boolean create,
                                         SipFactoryImpl sipFactoryImpl,
                                         MobicentsSipApplicationSession sipApplicationSessionImpl)
Retrieve a sip session from its key. If none exists, one can enforce the creation through the create parameter to true. the sip factory cannot be null if create is set to true.

Parameters:
key - the key identifying the sip session to retrieve
create - if set to true, if no session has been found one will be created
sipFactoryImpl - needed only for sip session creation.
sipApplicationSessionImpl - to associate the SipSession with if create is set to true, if false it won't be used
Returns:
the sip session matching the key
Throws:
java.lang.IllegalArgumentException - if create is set to true and sip Factory is null

changeSessionKey

public void changeSessionKey(SipSessionKey oldKey,
                             SipSessionKey newKey)

createDerivedSipSession

protected MobicentsSipSession createDerivedSipSession(MobicentsSipSession parentSipSession,
                                                      SipSessionKey sessionKey)
clone the parent sip session given in parameter except its attributes (they will be shared) and add it to the internal map of derived sessions identifying it by its ToTag

Parameters:
parentSipSession - the parent sip session holding the newly created derived session
sessionKey - the key of the new derived session to create
Returns:
the newly created derived session

getAllSipSessions

public java.util.Iterator<MobicentsSipSession> getAllSipSessions()
Retrieve all sip sessions currently hold by the session manager

Returns:
an iterator on the sip sessions

getNumberOfSipApplicationSessions

public int getNumberOfSipApplicationSessions()
Retrieve all sip application sessions currently hold by the session manager

Returns:
an iterator on the sip sessions

getNumberOfSipSessions

public int getNumberOfSipSessions()
Retrieve all sip sessions currently hold by the session manager

Returns:
an iterator on the sip sessions

getAllSipApplicationSessions

public java.util.Iterator<MobicentsSipApplicationSession> getAllSipApplicationSessions()
Retrieve all sip application sessions currently hold by the session manager

Returns:
an iterator on the sip sessions

findSipApplicationSession

public MobicentsSipApplicationSession findSipApplicationSession(javax.servlet.http.HttpSession httpSession)
Retrieves the sip application session holding the converged http session in parameter

Parameters:
convergedHttpSession - the converged session to look up
Returns:
the sip application session holding a reference to it or null if none references it

dumpSipSessions

public void dumpSipSessions()

dumpSipApplicationSessions

public void dumpSipApplicationSessions()

removeAllSessions

public void removeAllSessions()
Remove the sip sessions and sip application sessions


getNewMobicentsSipSession

protected abstract MobicentsSipSession getNewMobicentsSipSession(SipSessionKey key,
                                                                 SipFactoryImpl sipFactoryImpl,
                                                                 MobicentsSipApplicationSession mobicentsSipApplicationSession)

getNewMobicentsSipApplicationSession

protected abstract MobicentsSipApplicationSession getNewMobicentsSipApplicationSession(SipApplicationSessionKey key,
                                                                                       SipContext sipContext)

getMaxActiveSipSessions

public int getMaxActiveSipSessions()
Return the maximum number of active Sessions allowed, or -1 for no limit.


setMaxActiveSipSessions

public void setMaxActiveSipSessions(int max)
Set the maximum number of actives Sip Sessions allowed, or -1 for no limit.

Parameters:
max - The new maximum number of sip sessions

getMaxActiveSipApplicationSessions

public int getMaxActiveSipApplicationSessions()
Return the maximum number of active Sessions allowed, or -1 for no limit.


setMaxActiveSipApplicationSessions

public void setMaxActiveSipApplicationSessions(int max)
Set the maximum number of actives Sip Application Sessions allowed, or -1 for no limit.

Parameters:
max - The new maximum number of sip application sessions

getRejectedSipSessions

public int getRejectedSipSessions()
Number of sip session creations that failed due to maxActiveSipSessions

Returns:
The count

setRejectedSipSessions

public void setRejectedSipSessions(int rejectedSipSessions)

getRejectedSipApplicationSessions

public int getRejectedSipApplicationSessions()
Number of sip session creations that failed due to maxActiveSipSessions

Returns:
The count

setRejectedSipApplicationSessions

public void setRejectedSipApplicationSessions(int rejectedSipApplicationSessions)

setSipSessionCounter

public void setSipSessionCounter(int sipSessionCounter)

getSipSessionCounter

public int getSipSessionCounter()
Total sessions created by this manager.

Returns:
sessions created

getActiveSipSessions

public int getActiveSipSessions()
Returns the number of active sessions

Returns:
number of sessions active

getSipSessionMaxAliveTime

public int getSipSessionMaxAliveTime()
Gets the longest time (in seconds) that an expired session had been alive.

Returns:
Longest time (in seconds) that an expired session had been alive.

setSipSessionMaxAliveTime

public void setSipSessionMaxAliveTime(int sipSessionMaxAliveTime)
Sets the longest time (in seconds) that an expired session had been alive.

Parameters:
sessionMaxAliveTime - Longest time (in seconds) that an expired session had been alive.

getSipSessionAverageAliveTime

public int getSipSessionAverageAliveTime()
Gets the average time (in seconds) that expired sessions had been alive.

Returns:
Average time (in seconds) that expired sessions had been alive.

setSipSessionAverageAliveTime

public void setSipSessionAverageAliveTime(int sipSessionAverageAliveTime)
Sets the average time (in seconds) that expired sessions had been alive.

Parameters:
sessionAverageAliveTime - Average time (in seconds) that expired sessions had been alive.

setSipApplicationSessionCounter

public void setSipApplicationSessionCounter(int sipApplicationSessionCounter)

getSipApplicationSessionCounter

public int getSipApplicationSessionCounter()
Total sessions created by this manager.

Returns:
sessions created

getActiveSipApplicationSessions

public int getActiveSipApplicationSessions()
Returns the number of active sessions

Returns:
number of sessions active

getSipApplicationSessionMaxAliveTime

public int getSipApplicationSessionMaxAliveTime()
Gets the longest time (in seconds) that an expired session had been alive.

Returns:
Longest time (in seconds) that an expired session had been alive.

setSipApplicationSessionMaxAliveTime

public void setSipApplicationSessionMaxAliveTime(int sipApplicationSessionMaxAliveTime)
Sets the longest time (in seconds) that an expired session had been alive.

Parameters:
sessionMaxAliveTime - Longest time (in seconds) that an expired session had been alive.

getSipApplicationSessionAverageAliveTime

public int getSipApplicationSessionAverageAliveTime()
Gets the average time (in seconds) that expired sessions had been alive.

Returns:
Average time (in seconds) that expired sessions had been alive.

setSipApplicationSessionAverageAliveTime

public void setSipApplicationSessionAverageAliveTime(int sipApplicationSessionAverageAliveTime)
Sets the average time (in seconds) that expired sessions had been alive.

Parameters:
sessionAverageAliveTime - Average time (in seconds) that expired sessions had been alive.

getExpiredSipSessions

public int getExpiredSipSessions()
Gets the number of sessions that have expired.

Returns:
Number of sessions that have expired

setExpiredSipSessions

public void setExpiredSipSessions(int expiredSipSessions)
Sets the number of sessions that have expired.

Parameters:
expiredSessions - Number of sessions that have expired

getExpiredSipApplicationSessions

public int getExpiredSipApplicationSessions()
Gets the number of sessions that have expired.

Returns:
Number of sessions that have expired

setExpiredSipApplicationSessions

public void setExpiredSipApplicationSessions(int expiredSipApplicationSessions)
Sets the number of sessions that have expired.

Parameters:
expiredSessions - Number of sessions that have expired


Copyright © 2008. All Rights Reserved.