Commit ce17ec18 by Nepxion

优化事件机制

parent fafa773c
......@@ -41,4 +41,8 @@ public class PluginEventWapper {
pluginSubscriber.onVersionCleared(versionClearedEvent);
}
}
public void fireRegisterFailure(RegisterFailureEvent registerFailureEvent) {
pluginPublisher.asyncPublish(registerFailureEvent);
}
}
\ No newline at end of file
......@@ -14,7 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.nepxion.discovery.plugin.framework.adapter.PluginAdapter;
import com.nepxion.discovery.plugin.framework.cache.RuleCache;
import com.nepxion.discovery.plugin.framework.context.PluginContextAware;
import com.nepxion.discovery.plugin.framework.event.PluginPublisher;
import com.nepxion.discovery.plugin.framework.event.PluginEventWapper;
public class BasicListener implements Listener {
@Autowired
......@@ -27,5 +27,5 @@ public class BasicListener implements Listener {
protected PluginAdapter pluginAdapter;
@Autowired
protected PluginPublisher pluginPublisher;
protected PluginEventWapper pluginEventWapper;
}
\ No newline at end of file
......@@ -78,7 +78,7 @@ public class CountFilterRegisterListener extends AbstractRegisterListener {
Boolean registerFailureEventEnabled = pluginContextAware.getEnvironment().getProperty(PluginConstant.SPRING_APPLICATION_REGISTER_FAILURE_EVENT_ENABLED, Boolean.class, Boolean.FALSE);
if (registerFailureEventEnabled) {
pluginPublisher.asyncPublish(new RegisterFailureEvent(PluginConstant.REACH_MAX_LIMITED_COUNT, description, serviceId, host, port));
pluginEventWapper.fireRegisterFailure(new RegisterFailureEvent(PluginConstant.REACH_MAX_LIMITED_COUNT, description, serviceId, host, port));
}
throw new PluginException(description);
......
......@@ -102,7 +102,7 @@ public class HostFilterRegisterListener extends AbstractRegisterListener {
Boolean registerFailureEventEnabled = pluginContextAware.getEnvironment().getProperty(PluginConstant.SPRING_APPLICATION_REGISTER_FAILURE_EVENT_ENABLED, Boolean.class, Boolean.FALSE);
if (registerFailureEventEnabled) {
pluginPublisher.asyncPublish(new RegisterFailureEvent(filterType.toString(), description, serviceId, host, port));
pluginEventWapper.fireRegisterFailure(new RegisterFailureEvent(filterType.toString(), description, serviceId, host, port));
}
throw new PluginException(description);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment