geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject cvs commit: incubator-geronimo/sandbox/messaging/src/java/org/apache/geronimo/messaging/cluster/topology RingTopologyManager.java
Date Sat, 17 Jul 2004 03:33:34 GMT
gdamour     2004/07/16 20:33:34

  Modified:    sandbox/messaging/src/java/org/apache/geronimo/messaging/cluster/topology
                        RingTopologyManager.java
  Log:
  RingTopologyManager does not need to be thread-safe.
  
  Revision  Changes    Path
  1.3       +17 -16    incubator-geronimo/sandbox/messaging/src/java/org/apache/geronimo/messaging/cluster/topology/RingTopologyManager.java
  
  Index: RingTopologyManager.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/sandbox/messaging/src/java/org/apache/geronimo/messaging/cluster/topology/RingTopologyManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RingTopologyManager.java	5 Jul 2004 07:03:50 -0000	1.2
  +++ RingTopologyManager.java	17 Jul 2004 03:33:34 -0000	1.3
  @@ -20,6 +20,7 @@
   import java.util.ArrayList;
   import java.util.Collections;
   import java.util.HashSet;
  +import java.util.Iterator;
   import java.util.List;
   import java.util.Set;
   
  @@ -43,31 +44,21 @@
       public RingTopologyManager() {
           nodes = new ArrayList();
       }
  -
  +    
       public Set getNodes() {
  -        synchronized (nodes) {
  -            return new HashSet(nodes);
  -        }
  +        return new HashSet(nodes);
       }
   
       public void addNode(NodeInfo aNode) {
  -        synchronized(nodes) {
  -            nodes.add(aNode);
  -        }
  +        nodes.add(aNode);
       }
   
       public void removeNode(NodeInfo aNode) {
  -        synchronized(nodes) {
  -            nodes.remove(aNode);
  -        }
  +        nodes.remove(aNode);
       }
   
       public NodeTopology factoryTopology() {
  -        List tmpNodes;
  -        synchronized(nodes) {
  -            tmpNodes = new ArrayList(nodes);
  -        }
  -        return new RingTopology(tmpNodes);
  +        return new RingTopology(nodes);
       }
   
       private static class RingTopology implements NodeTopology {
  @@ -156,6 +147,16 @@
               return version;
           }
   
  +        public String toString() {
  +            StringBuffer buffer = new StringBuffer();
  +            buffer.append("Topology type:Ring; \nMembers: ");
  +            for (Iterator iter = nodeSet.iterator(); iter.hasNext();) {
  +                NodeInfo nodeInfo = (NodeInfo) iter.next();
  +                buffer.append("\n  " + nodeInfo + "");
  +            }
  +            return buffer.toString();
  +        }
  +        
       }
       
   }
  
  
  

Mime
View raw message