Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:Fix error when adding two or more publishers #1507

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiFunction;
import java.util.function.Supplier;

/**
* Unified event notify center.
Expand All @@ -43,7 +44,7 @@ public class NotifyCenter {

private DefaultSharePublisher sharePublisher;

private static EventPublisher eventPublisher = new DefaultPublisher();
private static final Supplier<EventPublisher> publisherSupplier = DefaultPublisher::new;

private static BiFunction<Class<? extends AbstractEvent>, Integer, EventPublisher> publisherFactory;

Expand All @@ -52,7 +53,7 @@ public class NotifyCenter {
static {
publisherFactory = (cls, buffer) -> {
try {
EventPublisher publisher = eventPublisher;
EventPublisher publisher = publisherSupplier.get();
publisher.init(cls, buffer);
return publisher;
} catch (Throwable ex) {
Expand Down