[
https://issues.apache.org/jira/browse/GOSSIP-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15995601#comment-15995601
]
ASF GitHub Bot commented on GOSSIP-85:
--------------------------------------
Github user edwardcapriolo commented on a diff in the pull request:
https://github.com/apache/incubator-gossip/pull/50#discussion_r114644980
--- Diff:
gossip-transport-udp/src/main/java/org/apache/gossip/transport/udp/UdpTransportManager.java
---
@@ -58,10 +62,35 @@ public UdpTransportManager(GossipManager gossipManager,
GossipCore gossipCore) {
LOGGER.warn(ex);
throw new RuntimeException(ex);
}
+ me = new Thread(this);
}
@Override
+ public void run() {
+ while (keepRunning.get()) {
+ try {
+ byte[] buf = read();
+ try {
+ Base message = gossipManager.getProtocolManager().read(buf);
+ gossipCore.receive(message);
+ //TODO this is suspect
+ gossipManager.getMemberStateRefresher().run();
+ } catch (RuntimeException ex) {//TODO trap json exception
+ LOGGER.error("Unable to process message", ex);
+ }
+ } catch (IOException e) {
+ // InterruptedException are completely normal here because of the
blocking lifecycle.
+ if (!(e.getCause() instanceof InterruptedException)) {
+ LOGGER.error(e);
+ }
+ keepRunning.set(false);
+ }
+ }
+ }
+
+ @Override
public void shutdown() {
+ keepRunning.set(false);
--- End diff --
If you think that is the right approach. Previously we have been simply
letting it fall out of the loop.
> UDP Server moved to sub module
> ------------------------------
>
> Key: GOSSIP-85
> URL: https://issues.apache.org/jira/browse/GOSSIP-85
> Project: Gossip
> Issue Type: Improvement
> Reporter: Edward Capriolo
>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)