FileDocCategorySizeDatePackage
EVENT_TRACE.javaAPI DocJBoss 4.2.14853Fri Jul 13 20:52:34 BST 2007org.jboss.javagroups.protocols

EVENT_TRACE

public class EVENT_TRACE extends org.jgroups.stack.Protocol
A trival implementation of Protocol that traces all activity through it to its logger. This should be inserted between any two protocols you which to view the events between. Its supports a name property that allows you to insert the element multiple times in a stack to trace multiple protocols. An example config for the ClusterPartition for such a usage is:


JNDITestPartition

















author
Scott.Stark@jboss.org
version
$Revision: 57188 $

Fields Summary
private String
name
private Logger
log
Constructors Summary
Methods Summary
public voiddown(org.jgroups.Event event)

      if( log.isTraceEnabled() )
      {
         log.trace("down, event="+event);
         if( event.getType() == Event.MSG )
         {
            Message msg = (Message) event.getArg();
            log.trace("down, MsgHeader: "+printEventMsg(msg));
         }
      }
      // Pass down the protocol stack
      passDown(event);
   
public java.lang.StringgetName()


     
   
      return name;
   
public java.lang.StringprintEventMsg(org.jgroups.Message msg)

      StringBuffer sb = new StringBuffer();
      Map.Entry entry;
      Map headers = msg.getHeaders();
      if (headers != null)
      {
         Iterator iter = headers.entrySet().iterator();
         while( iter.hasNext() )
         {
            entry = (Map.Entry) iter.next();
            Object key = entry.getKey();
            Object value = entry.getValue();
            sb.append(key);
            sb.append(", value(");
            sb.append(value.getClass());
            sb.append("): ");
            sb.append(value.toString());
            sb.append("\n");
         }
      }
      return sb.toString();
   
public booleansetProperties(java.util.Properties props)

param
props
return

      super.setProperties(props);
      name = props.getProperty("name", name);
      log = Logger.getLogger("org.jboss.jgroups."+name);
      return true;
   
public voidup(org.jgroups.Event event)

      if( log.isTraceEnabled() )
      {
         log.trace("up, event="+event);
         if( event.getType() == Event.MSG )
         {
            Message msg = (Message) event.getArg();
            msg.getHeaders();
            log.trace("up, MsgHeader: "+printEventMsg(msg));
         }
      }
      // Pass up the protocol stack
      passUp(event);