KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > net > protocol > tcm > HydrateHandler


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.net.protocol.tcm;
5
6 import com.tc.async.api.AbstractEventHandler;
7 import com.tc.async.api.EventContext;
8 import com.tc.logging.TCLogger;
9 import com.tc.logging.TCLogging;
10
11 public class HydrateHandler extends AbstractEventHandler {
12   private static TCLogger logger = TCLogging.getLogger(HydrateHandler.class);
13
14   public void handleEvent(EventContext context) {
15     HydrateContext hc = (HydrateContext) context;
16     TCMessage message = hc.getMessage();
17
18     final MessageChannel channel = message.getChannel();
19     final ChannelID channelID = channel.getChannelID();
20     try {
21       message.hydrate();
22     } catch (Throwable JavaDoc t) {
23       try {
24         logger.error("Error hydrating message of type " + message.getMessageType() + " on channel " + channelID, t);
25       } catch (Throwable JavaDoc t2) {
26         // oh well
27
}
28       message.getChannel().close();
29       return;
30     }
31     hc.getDestSink().add(message);
32   }
33
34 }
35
Popular Tags