From f904b83af6870964510ed3810d221542a1e79a99 Mon Sep 17 00:00:00 2001 From: Jordan Halterman Date: Sun, 26 Jul 2015 14:54:48 -0700 Subject: [PATCH] Use classes in local connection handler registry. --- .../java/net/kuujo/copycat/transport/LocalConnection.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/local/src/main/java/net/kuujo/copycat/transport/LocalConnection.java b/local/src/main/java/net/kuujo/copycat/transport/LocalConnection.java index a3efe8a1bb..dc2df042af 100644 --- a/local/src/main/java/net/kuujo/copycat/transport/LocalConnection.java +++ b/local/src/main/java/net/kuujo/copycat/transport/LocalConnection.java @@ -37,7 +37,7 @@ public class LocalConnection implements Connection { private final Context context; private final Set connections; private LocalConnection connection; - private final Map handlers = new ConcurrentHashMap<>(); + private final Map handlers = new ConcurrentHashMap<>(); private final Listeners exceptionListeners = new Listeners<>(); private final Listeners closeListeners = new Listeners<>(); @@ -94,7 +94,7 @@ public CompletableFuture send(T message) { */ @SuppressWarnings("unchecked") private CompletableFuture receive(T message) { - HandlerHolder holder = handlers.get(message.getClass().getName()); + HandlerHolder holder = handlers.get(message.getClass()); if (holder != null) { MessageHandler handler = holder.handler; CompletableFuture future = new CompletableFuture<>(); @@ -115,7 +115,7 @@ private CompletableFuture receive(T message) { @Override public Connection handler(Class type, MessageHandler handler) { if (handler != null) { - handlers.put(type.getName(), new HandlerHolder(handler, getContext())); + handlers.put(type, new HandlerHolder(handler, getContext())); } else { handlers.remove(type); }