删除冗余代码
This commit is contained in:
@@ -25,7 +25,7 @@ package fun.asgc.neutrino.core.base;
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/9/29
|
||||
*/
|
||||
public interface Channel<D,R extends Receiver,Dis extends Dispatcher> {
|
||||
public interface Channel<D,R extends Receiver> {
|
||||
|
||||
/**
|
||||
* 注册接收者
|
||||
@@ -39,12 +39,6 @@ public interface Channel<D,R extends Receiver,Dis extends Dispatcher> {
|
||||
*/
|
||||
void unRegisterReceiver(R receiver);
|
||||
|
||||
/**
|
||||
* 设置调度器
|
||||
* @param dispatcher 调度器
|
||||
*/
|
||||
void setDispatcher(Dis dispatcher);
|
||||
|
||||
/**
|
||||
* 发布消息
|
||||
* @param msg 消息
|
||||
|
||||
-7
@@ -42,7 +42,6 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public class ApplicationEventChannel<D> implements EventChannel<D,ApplicationEventContext,ApplicationEvent<D>,ApplicationEventReceiver<D>,Dispatcher<ApplicationEventContext,ApplicationEvent<D>>>, ChannelConnector<ApplicationEventChannel<D>> {
|
||||
private List<ApplicationEventReceiver<D>> receiverList;
|
||||
private Dispatcher<ApplicationEventContext,ApplicationEvent<D>> dispatcher;
|
||||
private ThreadPoolExecutor threadPoolExecutor;
|
||||
private static final AntPathMatcher antPathMatcher = new AntPathMatcher();
|
||||
private List<ApplicationEventChannel<D>> channelList;
|
||||
@@ -72,12 +71,6 @@ public class ApplicationEventChannel<D> implements EventChannel<D,ApplicationEve
|
||||
this.receiverList.remove(receiver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDispatcher(Dispatcher<ApplicationEventContext, ApplicationEvent<D>> dispatcher) {
|
||||
Assert.notNull(dispatcher, "dispatcher不能为空!");
|
||||
this.dispatcher = dispatcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publish(ApplicationEvent<D> msg) {
|
||||
if (msg.context().channelList().contains(this)) {
|
||||
|
||||
@@ -28,6 +28,6 @@ import fun.asgc.neutrino.core.base.Dispatcher;
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/9/29
|
||||
*/
|
||||
public interface EventChannel<D,EC extends EventContext, E extends Event<EC,D>, R extends EventReceiver, Dis extends Dispatcher> extends Channel<E,R,Dis> {
|
||||
public interface EventChannel<D,EC extends EventContext, E extends Event<EC,D>, R extends EventReceiver, Dis extends Dispatcher> extends Channel<E,R> {
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class Test3 {
|
||||
simpleApplicationEventManager.registerReceiver(receiver1);
|
||||
simpleApplicationEventManager.registerReceiver(receiver2);
|
||||
|
||||
simpleApplicationEventManager.publish("/aaa", Sets.newHashSet("tag2"), new Student().setId("1").setName("张三").setAge(28).setSex("男"));
|
||||
simpleApplicationEventManager.publish("/aaa", Sets.newHashSet("tag1"), new Student().setId("1").setName("张三").setAge(28).setSex("男"));
|
||||
|
||||
SystemUtil.waitProcessDestroy().sync();
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.core.type;
|
||||
package fun.asgc.neutrino.core.base.type;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
+1
-2
@@ -19,9 +19,8 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.core.type;
|
||||
package fun.asgc.neutrino.core.base.type;
|
||||
|
||||
import fun.asgc.neutrino.core.base.type.ResolvableType;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
Reference in New Issue
Block a user