Class AsyncSipListener
java.lang.Object
io.github.lunasaw.sip.common.transmit.AbstractSipListener
io.github.lunasaw.sip.common.transmit.AsyncSipListener
- All Implemented Interfaces:
EventListener
,javax.sip.SipListener
- Direct Known Subclasses:
DefaultSipListener
,TransactionAwareAsyncSipListener
异步SIP监听器
继承AbstractSipListener,提供异步消息处理能力
使用本地创建的默认线程池实现高性能消息处理
- Author:
- luna
-
Field Summary
Fields inherited from class io.github.lunasaw.sip.common.transmit.AbstractSipListener
REQUEST_PROCESSOR_MAP, RESPONSE_PROCESSOR_MAP, sipMetrics, TIMEOUT_PROCESSOR_MAP
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
创建默认线程池 使用本地创建的线程池,不依赖Spring注入 注意:方法为protected以支持测试时通过反射调用(CGLIB代理需要)void
destroy()
销毁线程池资源 在应用关闭时调用,确保资源正确释放获取异步监听器统计信息void
processDialogTerminated
(javax.sip.DialogTerminatedEvent dialogTerminatedEvent) 异步处理DialogTerminatedEvent事件 重写父类方法,提供异步处理能力void
processIOException
(javax.sip.IOExceptionEvent exceptionEvent) 异步处理IOExceptionEvent事件 重写父类方法,提供异步处理能力void
processRequest
(javax.sip.RequestEvent requestEvent) 异步处理RequestEvent事件 重写父类方法,提供异步处理能力void
processResponse
(javax.sip.ResponseEvent responseEvent) 异步处理ResponseEvent事件 重写父类方法,提供异步处理能力void
processTimeout
(javax.sip.TimeoutEvent timeoutEvent) 异步处理TimeoutEvent事件 重写父类方法,提供异步处理能力void
processTransactionTerminated
(javax.sip.TransactionTerminatedEvent timeoutEvent) 异步处理TransactionTerminatedEvent事件 重写父类方法,提供异步处理能力Methods inherited from class io.github.lunasaw.sip.common.transmit.AbstractSipListener
addRequestProcessor, addResponseProcessor, addTimeoutProcessor, getRequestProcessors, getResponseProcessors, getTimeoutProcessors, handleIOException, handleRequestException, handleResponseException, handleUnsupportedRequest, removeRequestProcessor, removeResponseProcessor, removeTimeoutProcessor, shouldCreateTransaction
-
Constructor Details
-
AsyncSipListener
public AsyncSipListener()
-
-
Method Details
-
createDefaultThreadPool
protected org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor createDefaultThreadPool()创建默认线程池 使用本地创建的线程池,不依赖Spring注入 注意:方法为protected以支持测试时通过反射调用(CGLIB代理需要)- Returns:
- 默认线程池
-
processRequest
public void processRequest(javax.sip.RequestEvent requestEvent) 异步处理RequestEvent事件 重写父类方法,提供异步处理能力- Specified by:
processRequest
in interfacejavax.sip.SipListener
- Overrides:
processRequest
in classAbstractSipListener
- Parameters:
requestEvent
- RequestEvent事件
-
processResponse
@Async("sipMessageProcessor") public void processResponse(javax.sip.ResponseEvent responseEvent) 异步处理ResponseEvent事件 重写父类方法,提供异步处理能力- Specified by:
processResponse
in interfacejavax.sip.SipListener
- Overrides:
processResponse
in classAbstractSipListener
- Parameters:
responseEvent
- ResponseEvent事件
-
processTimeout
@Async("sipMessageProcessor") public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) 异步处理TimeoutEvent事件 重写父类方法,提供异步处理能力- Specified by:
processTimeout
in interfacejavax.sip.SipListener
- Overrides:
processTimeout
in classAbstractSipListener
- Parameters:
timeoutEvent
- TimeoutEvent事件
-
processIOException
@Async("sipMessageProcessor") public void processIOException(javax.sip.IOExceptionEvent exceptionEvent) 异步处理IOExceptionEvent事件 重写父类方法,提供异步处理能力- Specified by:
processIOException
in interfacejavax.sip.SipListener
- Overrides:
processIOException
in classAbstractSipListener
- Parameters:
exceptionEvent
- IOExceptionEvent事件
-
processTransactionTerminated
@Async("sipMessageProcessor") public void processTransactionTerminated(javax.sip.TransactionTerminatedEvent timeoutEvent) 异步处理TransactionTerminatedEvent事件 重写父类方法,提供异步处理能力- Specified by:
processTransactionTerminated
in interfacejavax.sip.SipListener
- Overrides:
processTransactionTerminated
in classAbstractSipListener
- Parameters:
timeoutEvent
- TransactionTerminatedEvent事件
-
processDialogTerminated
@Async("sipMessageProcessor") public void processDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent) 异步处理DialogTerminatedEvent事件 重写父类方法,提供异步处理能力- Specified by:
processDialogTerminated
in interfacejavax.sip.SipListener
- Overrides:
processDialogTerminated
in classAbstractSipListener
- Parameters:
dialogTerminatedEvent
- DialogTerminatedEvent事件
-
getProcessorStats
获取异步监听器统计信息- Overrides:
getProcessorStats
in classAbstractSipListener
- Returns:
- 统计信息
-
destroy
public void destroy()销毁线程池资源 在应用关闭时调用,确保资源正确释放
-