1 29 package jegg.impl; 30 31 import java.util.logging.Logger ; 32 33 import jegg.EggBase; 34 import jegg.timer.Timeout; 35 import jegg.timer.Timer; 36 37 40 public class MessageHandlerA extends EggBase 41 { 42 public static final Logger log = Logger.getLogger(MessageHandlerA.class.getName()); 43 public Throwable error = null; 44 public String _name = null; 45 public Timer _timer = null; 46 47 public MessageHandlerA(String s) throws Exception 48 { 49 _name = s + ":Port"; 50 } 51 52 public void handle(Init i) 53 { 54 _timer = getContext().createSingleShotTimer(2000); 55 } 56 57 60 public void handle(Object message) 61 { 62 System.err.println("EggClassA: got message ("+message.getClass().getName()+") - resending"); 63 getContext().respond(message); 64 } 65 66 public void handle(Timeout t) 67 { 68 log.info("EggClassA: publishing port"); 69 getContext().publishPort(_name); 70 getContext().publishPort(_name); } 72 76 public void handle(DuplicatePortException e) 77 { 78 System.err.println("EggClassA: got DuplicateNameException"); 79 error = e; 80 } 81 82 } 83 | Popular Tags |