Class HandlerRegistration

java.lang.Object
top.magstar.framework.events.models.HandlerRegistration

public class HandlerRegistration extends Object
处理器注册信息 - 封装事件处理器的注册详情
  • Constructor Details

    • HandlerRegistration

      public HandlerRegistration(Class<?> eventType, EventHandler<?> handler, int priority, boolean isAsync, String pluginName)
    • HandlerRegistration

      public HandlerRegistration(Class<?> eventType, EventHandler<?> handler, int priority, boolean isAsync, String pluginName, Object listenerInstance)
  • Method Details

    • getEventType

      public Class<?> getEventType()
      获取事件类型
    • getHandler

      public <T> EventHandler<T> getHandler()
      获取事件处理器
    • getPriority

      public int getPriority()
      获取优先级
    • isAsync

      public boolean isAsync()
      是否为异步处理器
    • getPluginName

      public String getPluginName()
      获取插件名称
    • getListenerInstance

      public Optional<Object> getListenerInstance()
      获取监听器实例
    • getRegistrationTime

      public long getRegistrationTime()
      获取注册时间
    • getHandlerId

      public String getHandlerId()
      获取处理器ID
    • getInvocationCount

      public long getInvocationCount()
      获取调用次数
    • getTotalExecutionTime

      public long getTotalExecutionTime()
      获取总执行时间
    • getAverageExecutionTime

      public double getAverageExecutionTime()
      获取平均执行时间
    • getLastInvocationTime

      public long getLastInvocationTime()
      获取最后调用时间
    • getLastException

      public Optional<Exception> getLastException()
      获取最后异常
    • getLifetime

      public long getLifetime()
      获取存活时间
    • recordInvocation

      public void recordInvocation(long executionTimeMs)
      记录成功调用
    • recordFailure

      public void recordFailure(long executionTimeMs, Exception exception)
      记录失败调用
    • belongsTo

      public boolean belongsTo(Object listener)
      检查是否属于指定的监听器实例
    • belongsToPlugin

      public boolean belongsToPlugin(String pluginName)
      检查是否属于指定的插件
    • hasHandler

      public boolean hasHandler(EventHandler<?> handler)
      检查处理器是否匹配
    • isHotspot

      public boolean isHotspot(long threshold)
      检查是否为热点处理器(高频调用)
    • isSlow

      public boolean isSlow(double thresholdMs)
      检查是否为慢处理器
    • getDescription

      public String getDescription()
      获取处理器描述
    • getPerformanceStats

      public HandlerRegistration.PerformanceStats getPerformanceStats()
      获取性能统计信息
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object