1 3 package org.jgroups.protocols; 4 5 import org.jgroups.Event; 6 import org.jgroups.Message; 7 import org.jgroups.stack.Protocol; 8 9 10 13 public class HDRS extends Protocol { 14 public String getName() {return "HDRS";} 15 16 17 private void printMessage(Message msg, String label) { 18 System.out.println("------------------------- " + label + " ----------------------"); 19 System.out.println(msg); 20 msg.printObjectHeaders(); 21 System.out.println("--------------------------------------------------------------"); 22 } 23 24 25 public void up(Event evt) { 26 if(evt.getType() == Event.MSG) { 27 Message msg=(Message)evt.getArg(); 28 printMessage(msg, "up"); 29 } 30 passUp(evt); } 32 33 34 35 public void down(Event evt) { 36 if(evt.getType() == Event.MSG) { 37 Message msg=(Message)evt.getArg(); 38 printMessage(msg, "down"); 39 } 40 41 passDown(evt); } 43 44 45 } 46 | Popular Tags |