01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.net.groups;
05:
06: import com.tc.async.api.EventContext;
07: import com.tc.async.api.Sink;
08: import com.tc.util.Assert;
09:
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: }
|