01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.net.protocol.tcm;
05:
06: import com.tc.async.api.AbstractEventHandler;
07: import com.tc.async.api.EventContext;
08: import com.tc.logging.TCLogger;
09: import com.tc.logging.TCLogging;
10:
11: public class HydrateHandler extends AbstractEventHandler {
12: private static TCLogger logger = TCLogging
13: .getLogger(HydrateHandler.class);
14:
15: public void handleEvent(EventContext context) {
16: HydrateContext hc = (HydrateContext) context;
17: TCMessage message = hc.getMessage();
18:
19: final MessageChannel channel = message.getChannel();
20: final ChannelID channelID = channel.getChannelID();
21: try {
22: message.hydrate();
23: } catch (Throwable t) {
24: try {
25: logger.error("Error hydrating message of type "
26: + message.getMessageType() + " on channel "
27: + channelID, t);
28: } catch (Throwable t2) {
29: // oh well
30: }
31: message.getChannel().close();
32: return;
33: }
34: hc.getDestSink().add(message);
35: }
36:
37: }
|