1 4 package com.tc.net.groups; 5 6 import com.tc.async.api.EventContext; 7 import com.tc.async.api.Sink; 8 import com.tc.util.Assert; 9 10 public class RouteGroupMessagesToSink implements GroupMessageListener { 11 12 private final String name; 13 private final Sink sink; 14 15 public RouteGroupMessagesToSink(String name, Sink sink) { 16 this.name = name; 17 this.sink = sink; 18 } 19 20 public void messageReceived(NodeID fromNode, GroupMessage msg) { 21 Assert.assertTrue(this.toString(), msg instanceof EventContext); 22 sink.add((EventContext) msg); 23 } 24 25 public String toString() { 26 return "MessageRouter [ " + name + " ] - > " + sink; 27 } 28 29 } 30 | Popular Tags |