GitHub user makrusak opened a pull request:
https://github.com/apache/incubator-gossip/pull/34
GOSSIP-56 GossipCore should allow registration of handlers
Current solution is:
`for (Map.Entry<Class, MessageHandler> handler : handlers.entrySet()) {
Class messageClass = handler.getKey();
MessageHandler messageHandler = handler.getValue();
if (messageClass.isAssignableFrom(base.getClass())){
messageHandler.invoke(this, gossipManager, base);
break;
}`
It's thread-safe and it's not just handlers.get(base.getClass()) because,
for example, UdpActiveGossipMessage extends ActiveGossipMessage and this type
of message have to be handled as ActiveGossipMessage, but getClass() returns
UdpActiveGossipMessage.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/makrusak/incubator-gossip GOSSIP-56
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-gossip/pull/34.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #34
----
commit 2b9dae138953ce561ecba51d145c4720e208e3ba
Author: Maxim Rusak <[email protected]>
Date: 2017-02-16T09:35:56Z
GOSSIP-56 GossipCore should allow registration of handlers
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---