org.mobicents.mgcp.stack
Class JainMgcpStackImpl

java.lang.Object
  extended by java.lang.Thread
      extended by org.mobicents.mgcp.stack.JainMgcpStackImpl
All Implemented Interfaces:
jain.protocol.ip.mgcp.JainMgcpStack, java.lang.Runnable, EndpointHandlerManager

public class JainMgcpStackImpl
extends java.lang.Thread
implements jain.protocol.ip.mgcp.JainMgcpStack, EndpointHandlerManager

Author:
Oleg Kulikov, Pavel Mitrenko

Nested Class Summary
protected  class JainMgcpStackImpl.EventSchedulerTask
           
protected  class JainMgcpStackImpl.StringComparator
           
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static java.lang.String _EXECUTOR_QUEUE_SIZE
          Defines how many message can be stored in queue before new ones are discarded.
static java.lang.String _EXECUTOR_TABLE_SIZE
          Defines how many executors will work on event delivery
static java.lang.String _MESSAGE_DISPATCHER_THREAD_PRIORITY
           
static java.lang.String _MESSAGE_EXECUTOR_THREAD_PRIORITY
           
static java.lang.String _MESSAGE_READER_THREAD_PRIORITY
           
protected  ThreadPoolQueueExecutor eventSchedulerExecutor
           
protected  MessageHandler messageHandler
           
protected  int port
           
 JainMgcpStackProviderImpl provider
           
protected  java.util.LinkedList<PacketRepresentation> rawQueue
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
JainMgcpStackImpl(java.net.InetAddress localAddress, int port)
          Creates a new instance of JainMgcpStackImpl
 
Method Summary
 void close()
          Closes the stack and it's underlying resources.
 jain.protocol.ip.mgcp.JainMgcpProvider createProvider()
           
 void deleteProvider(jain.protocol.ip.mgcp.JainMgcpProvider provider)
           
 java.net.InetAddress getAddress()
           
 java.util.Map<java.lang.Integer,TransactionHandler> getCompletedTransactions()
           
 EndpointHandler getEndpointHandler(java.lang.String endpointId, boolean useFakeOnWildcard)
           
 java.util.Map<java.lang.Integer,TransactionHandler> getLocalTransactions()
           
 ThreadPoolQueueExecutor getNextExecutor()
           
 int getPort()
           
 java.lang.String getProtocolVersion()
           
 java.util.Map<java.lang.Integer,java.lang.Integer> getRemoteTxToLocalTxMap()
           
 UtilsFactory getUtilsFactory()
           
 boolean isRequest(java.lang.String header)
           
 void removeEndpointHandler(java.lang.String endpointId)
           
 void run()
           
protected  void send(java.net.DatagramPacket packet)
           
 void setPort(int port)
           
 void setProtocolVersion(java.lang.String protocolVersion)
           
 void setUtilsFactory(UtilsFactory utilsFactory)
           
 EndpointHandler switchMapping(java.lang.String fakeId, java.lang.String specificEndpointId)
          This fnction switches mapping from fakeId to specificEndpointId.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_EXECUTOR_TABLE_SIZE

public static final java.lang.String _EXECUTOR_TABLE_SIZE
Defines how many executors will work on event delivery

See Also:
Constant Field Values

_EXECUTOR_QUEUE_SIZE

public static final java.lang.String _EXECUTOR_QUEUE_SIZE
Defines how many message can be stored in queue before new ones are discarded.

See Also:
Constant Field Values

_MESSAGE_READER_THREAD_PRIORITY

public static final java.lang.String _MESSAGE_READER_THREAD_PRIORITY
See Also:
Constant Field Values

_MESSAGE_DISPATCHER_THREAD_PRIORITY

public static final java.lang.String _MESSAGE_DISPATCHER_THREAD_PRIORITY
See Also:
Constant Field Values

_MESSAGE_EXECUTOR_THREAD_PRIORITY

public static final java.lang.String _MESSAGE_EXECUTOR_THREAD_PRIORITY
See Also:
Constant Field Values

port

protected int port

provider

public JainMgcpStackProviderImpl provider

rawQueue

protected java.util.LinkedList<PacketRepresentation> rawQueue

eventSchedulerExecutor

protected ThreadPoolQueueExecutor eventSchedulerExecutor

messageHandler

protected MessageHandler messageHandler
Constructor Detail

JainMgcpStackImpl

public JainMgcpStackImpl(java.net.InetAddress localAddress,
                         int port)
Creates a new instance of JainMgcpStackImpl

Method Detail

close

public void close()
Closes the stack and it's underlying resources.


createProvider

public jain.protocol.ip.mgcp.JainMgcpProvider createProvider()
                                                      throws jain.protocol.ip.mgcp.CreateProviderException
Specified by:
createProvider in interface jain.protocol.ip.mgcp.JainMgcpStack
Throws:
jain.protocol.ip.mgcp.CreateProviderException

deleteProvider

public void deleteProvider(jain.protocol.ip.mgcp.JainMgcpProvider provider)
                    throws jain.protocol.ip.mgcp.DeleteProviderException
Specified by:
deleteProvider in interface jain.protocol.ip.mgcp.JainMgcpStack
Throws:
jain.protocol.ip.mgcp.DeleteProviderException

setPort

public void setPort(int port)

getPort

public int getPort()
Specified by:
getPort in interface jain.protocol.ip.mgcp.JainMgcpStack

getUtilsFactory

public UtilsFactory getUtilsFactory()

setUtilsFactory

public void setUtilsFactory(UtilsFactory utilsFactory)

getAddress

public java.net.InetAddress getAddress()

getProtocolVersion

public java.lang.String getProtocolVersion()
Specified by:
getProtocolVersion in interface jain.protocol.ip.mgcp.JainMgcpStack

setProtocolVersion

public void setProtocolVersion(java.lang.String protocolVersion)
Specified by:
setProtocolVersion in interface jain.protocol.ip.mgcp.JainMgcpStack

send

protected void send(java.net.DatagramPacket packet)

isRequest

public boolean isRequest(java.lang.String header)

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getEndpointHandler

public EndpointHandler getEndpointHandler(java.lang.String endpointId,
                                          boolean useFakeOnWildcard)
Specified by:
getEndpointHandler in interface EndpointHandlerManager

removeEndpointHandler

public void removeEndpointHandler(java.lang.String endpointId)
Specified by:
removeEndpointHandler in interface EndpointHandlerManager

switchMapping

public EndpointHandler switchMapping(java.lang.String fakeId,
                                     java.lang.String specificEndpointId)
Description copied from interface: EndpointHandlerManager
This fnction switches mapping from fakeId to specificEndpointId. If endpoint handler bound to specific endpoint id exists it is returned without any modification otherwise return value is zero and endpoint handler mapping has been switched.

Specified by:
switchMapping in interface EndpointHandlerManager
Returns:

getNextExecutor

public ThreadPoolQueueExecutor getNextExecutor()
Specified by:
getNextExecutor in interface EndpointHandlerManager

getLocalTransactions

public java.util.Map<java.lang.Integer,TransactionHandler> getLocalTransactions()

getRemoteTxToLocalTxMap

public java.util.Map<java.lang.Integer,java.lang.Integer> getRemoteTxToLocalTxMap()

getCompletedTransactions

public java.util.Map<java.lang.Integer,TransactionHandler> getCompletedTransactions()


Copyright © 2009. All Rights Reserved.