forked from apache/dubbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows extension of DubboEventMulticaster
- Loading branch information
Showing
12 changed files
with
209 additions
and
25 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
dubbo-common/src/main/java/org/apache/dubbo/common/event/CompositeDubboEventMulticaster.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.dubbo.common.event; | ||
|
||
import java.util.List; | ||
|
||
public class CompositeDubboEventMulticaster implements DubboEventMulticaster { | ||
|
||
private final List<DubboEventMulticaster> multicasterList; | ||
|
||
public CompositeDubboEventMulticaster(List<DubboEventMulticaster> multicasterList) { | ||
this.multicasterList = multicasterList; | ||
} | ||
|
||
@Override | ||
public void addListener(DubboListener<?> listener) { | ||
for (DubboEventMulticaster dubboEventMulticaster : multicasterList) { | ||
dubboEventMulticaster.addListener(listener); | ||
} | ||
} | ||
|
||
@Override | ||
public void removeListener(DubboListener<?> listener) { | ||
for (DubboEventMulticaster dubboEventMulticaster : multicasterList) { | ||
dubboEventMulticaster.removeListener(listener); | ||
} | ||
} | ||
|
||
@Override | ||
public void publishEvent(DubboEvent event) { | ||
for (DubboEventMulticaster dubboEventMulticaster : multicasterList) { | ||
dubboEventMulticaster.publishEvent(event); | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
.../src/main/java/org/apache/dubbo/common/event/CompositeDubboLifecycleEventMulticaster.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.dubbo.common.event; | ||
|
||
import java.util.List; | ||
|
||
public class CompositeDubboLifecycleEventMulticaster implements DubboLifecycleEventMulticaster { | ||
|
||
private final List<DubboLifecycleEventMulticaster> multicasterList; | ||
|
||
public CompositeDubboLifecycleEventMulticaster(List<DubboLifecycleEventMulticaster> multicasterList) { | ||
this.multicasterList = multicasterList; | ||
} | ||
|
||
@Override | ||
public void publishBeforeEvent(DubboEvent event) { | ||
for (DubboLifecycleEventMulticaster multicaster : multicasterList) { | ||
multicaster.publishBeforeEvent(event); | ||
} | ||
} | ||
|
||
@Override | ||
public void publishErrorEvent(DubboEvent event) { | ||
for (DubboLifecycleEventMulticaster multicaster : multicasterList) { | ||
multicaster.publishErrorEvent(event); | ||
} | ||
} | ||
|
||
@Override | ||
public void addListener(DubboListener<?> listener) { | ||
for (DubboLifecycleEventMulticaster multicaster : multicasterList) { | ||
multicaster.addListener(listener); | ||
} | ||
} | ||
|
||
@Override | ||
public void removeListener(DubboListener<?> listener) { | ||
for (DubboLifecycleEventMulticaster multicaster : multicasterList) { | ||
multicaster.removeListener(listener); | ||
} | ||
} | ||
|
||
@Override | ||
public void publishEvent(DubboEvent event) { | ||
for (DubboLifecycleEventMulticaster multicaster : multicasterList) { | ||
multicaster.publishEvent(event); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ain/resources/META-INF/dubbo/internal/org.apache.dubbo.common.event.DubboEventMulticaster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
default=org.apache.dubbo.common.event.DefaultDubboLifecycleEventMulticaster |
2 changes: 1 addition & 1 deletion
2
...c/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.model.ScopeModelInitializer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
dubbo-common=org.apache.dubbo.common.CommonScopeModelInitializer | ||
application-multicaster-registry=org.apache.dubbo.common.event.DubboApplicationMulticasterRegistry | ||
dubbo-multicaster-init=org.apache.dubbo.common.event.DubboMulticasterScopeModelInitializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.