CVS update: JGroups/src/org/jgroups/protocols RELAY.java

"Bela Ban" <[email protected]>
Newsgroups gmane.comp.java.javagroups.cvs
Message-ID <[email protected]>
  User: belaban 
  Date: 10/08/18 12:42:09

  Modified:    src/org/jgroups/protocols RELAY.java
  Log:
  added 'relay' prop
  
  Revision  Changes    Path
  1.3       +9 -6      JGroups/src/org/jgroups/protocols/RELAY.java
  
  Index: RELAY.java
  ===================================================================
  RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/protocols/RELAY.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RELAY.java	18 Aug 2010 10:02:15 -0000	1.2
  +++ RELAY.java	18 Aug 2010 12:42:08 -0000	1.3
  @@ -2,6 +2,7 @@
   
   import org.jgroups.*;
   import org.jgroups.annotations.Experimental;
  +import org.jgroups.annotations.MBean;
   import org.jgroups.annotations.Property;
   import org.jgroups.annotations.Unsupported;
   import org.jgroups.stack.Protocol;
  @@ -16,9 +17,10 @@
    * Simple relaying protocol: RELAY is added to the top of the stack, creates a channel to a bridge cluster,
    * and - if coordinator - relays all multicast messages via the bridge cluster to the remote relay.  
    * @author Bela Ban
  - * @version $Id: RELAY.java,v 1.2 2010/08/18 10:02:15 belaban Exp $
  + * @version $Id: RELAY.java,v 1.3 2010/08/18 12:42:08 belaban Exp $
    */
   @Experimental @Unsupported
  +@MBean(description="RELAY protocol")
   public class RELAY extends Protocol {
   
       @Property(description="Properties of the bridge cluster (e.g. tcp.xml)")
  @@ -30,6 +32,10 @@
       @Property(description="If true, messages are relayed asynchronously, ie. via submission of a task to the timer thread pool")
       protected boolean async=false;
   
  +    @Property(description="If set to false, don't perform relaying. Used e.g. for backup clusters; " +
  +            "unidirectional replication from one cluster to another, but not back. Can be changed at runtime")
  +    protected boolean relay=true;
  +
       protected Address local_addr;
   
       protected volatile boolean is_coord=false;
  @@ -68,15 +74,13 @@
       public Object up(Event evt) {
           switch(evt.getType()) {
               case Event.MSG:
  -                if(is_coord && ch != null) {
  +                if(is_coord && relay && ch != null) {
                       Message msg=(Message)evt.getArg();
                       Address dest=msg.getDest();
                       RelayHeader hdr=(RelayHeader)msg.getHeader(getId());
                       boolean multicast=dest == null || dest.isMulticastAddress();
  -
  -                    if(multicast && hdr == null) {
  +                    if(multicast && hdr == null)
                           relay(msg);
  -                    }
                   }
                   break;
               case Event.VIEW_CHANGE:
  @@ -113,7 +117,6 @@
                       log.error("failed creating channel (props=" + props + ")", e);
                   }
               }
  -
           }
       }
   
  
  
  

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.