KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgroups > protocols > PRINTMETHODS


1 // $Id: PRINTMETHODS.java,v 1.3 2004/03/30 06:47:21 belaban Exp $
2

3 package org.jgroups.protocols;
4
5
6 import org.jgroups.Event;
7 import org.jgroups.Message;
8 import org.jgroups.blocks.MethodCall;
9 import org.jgroups.stack.Protocol;
10
11
12 public class PRINTMETHODS extends Protocol {
13
14     public PRINTMETHODS() {}
15
16     public String JavaDoc getName() {return "PRINTMETHODS";}
17
18
19     public void up(Event evt) {
20     Object JavaDoc obj=null;
21     byte[] buf;
22         Message msg;
23
24     if(evt.getType() == Event.MSG) {
25         msg=(Message)evt.getArg();
26         if(msg.getLength() > 0) {
27         try {
28             obj=msg.getObject();
29             if(obj != null && obj instanceof MethodCall)
30             System.out.println("--> PRINTMETHODS: received " + obj);
31         }
32         catch(ClassCastException JavaDoc cast_ex) {}
33         catch(Exception JavaDoc e) {}
34         }
35     }
36
37     passUp(evt);
38     }
39     
40
41
42     public void down(Event evt) {
43     Object JavaDoc obj=null;
44     byte[] buf;
45     Message msg;
46
47     if(evt.getType() == Event.MSG) {
48
49     }
50     passDown(evt);
51     }
52
53
54
55
56 }
57
Popular Tags