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

public abstract class AsyncSipListener extends AbstractSipListener
异步SIP监听器 继承AbstractSipListener,提供异步消息处理能力 使用本地创建的默认线程池实现高性能消息处理
Author:
luna
  • 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 interface javax.sip.SipListener
      Overrides:
      processRequest in class AbstractSipListener
      Parameters:
      requestEvent - RequestEvent事件
    • processResponse

      @Async("sipMessageProcessor") public void processResponse(javax.sip.ResponseEvent responseEvent)
      异步处理ResponseEvent事件 重写父类方法,提供异步处理能力
      Specified by:
      processResponse in interface javax.sip.SipListener
      Overrides:
      processResponse in class AbstractSipListener
      Parameters:
      responseEvent - ResponseEvent事件
    • processTimeout

      @Async("sipMessageProcessor") public void processTimeout(javax.sip.TimeoutEvent timeoutEvent)
      异步处理TimeoutEvent事件 重写父类方法,提供异步处理能力
      Specified by:
      processTimeout in interface javax.sip.SipListener
      Overrides:
      processTimeout in class AbstractSipListener
      Parameters:
      timeoutEvent - TimeoutEvent事件
    • processIOException

      @Async("sipMessageProcessor") public void processIOException(javax.sip.IOExceptionEvent exceptionEvent)
      异步处理IOExceptionEvent事件 重写父类方法,提供异步处理能力
      Specified by:
      processIOException in interface javax.sip.SipListener
      Overrides:
      processIOException in class AbstractSipListener
      Parameters:
      exceptionEvent - IOExceptionEvent事件
    • processTransactionTerminated

      @Async("sipMessageProcessor") public void processTransactionTerminated(javax.sip.TransactionTerminatedEvent timeoutEvent)
      异步处理TransactionTerminatedEvent事件 重写父类方法,提供异步处理能力
      Specified by:
      processTransactionTerminated in interface javax.sip.SipListener
      Overrides:
      processTransactionTerminated in class AbstractSipListener
      Parameters:
      timeoutEvent - TransactionTerminatedEvent事件
    • processDialogTerminated

      @Async("sipMessageProcessor") public void processDialogTerminated(javax.sip.DialogTerminatedEvent dialogTerminatedEvent)
      异步处理DialogTerminatedEvent事件 重写父类方法,提供异步处理能力
      Specified by:
      processDialogTerminated in interface javax.sip.SipListener
      Overrides:
      processDialogTerminated in class AbstractSipListener
      Parameters:
      dialogTerminatedEvent - DialogTerminatedEvent事件
    • getProcessorStats

      public String getProcessorStats()
      获取异步监听器统计信息
      Overrides:
      getProcessorStats in class AbstractSipListener
      Returns:
      统计信息
    • destroy

      public void destroy()
      销毁线程池资源 在应用关闭时调用,确保资源正确释放