CVS update: JGroups/src/org/jgroups/protocols UNICAST.java UFC.java UNICAST2.java TP.java

"Bela Ban" <[email protected]> Fri, 17 Sep 2010 12:05:09 +0000
Newsgroups gmane.comp.java.javagroups.cvs
Message-ID <[email protected]>
  User: belaban 
  Date: 10/09/17 12:05:09

  Modified:    src/org/jgroups/protocols UNICAST.java UFC.java
                        UNICAST2.java TP.java
  Log:
  use of Util.createConcurrentMap() instead of new ConcurrentHashMap()
  
  Revision  Changes    Path
  1.167     +6 -5      JGroups/src/org/jgroups/protocols/UNICAST.java
  
  Index: UNICAST.java
  ===================================================================
  RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/protocols/UNICAST.java,v
  retrieving revision 1.166
  retrieving revision 1.167
  diff -u -r1.166 -r1.167
  --- UNICAST.java	12 Mar 2010 09:07:44 -0000	1.166
  +++ UNICAST.java	17 Sep 2010 12:05:09 -0000	1.167
  @@ -12,9 +12,10 @@
   import org.jgroups.util.Tuple;
   import org.jgroups.util.Util;
   
  -import java.io.*;
  +import java.io.DataInputStream;
  +import java.io.DataOutputStream;
  +import java.io.IOException;
   import java.util.*;
  -import java.util.concurrent.ConcurrentHashMap;
   import java.util.concurrent.ConcurrentMap;
   import java.util.concurrent.atomic.AtomicBoolean;
   import java.util.concurrent.locks.Lock;
  @@ -38,7 +39,7 @@
    * whenever a message is received: the new message is added and then we try to remove as many messages as
    * possible (until we stop at a gap, or there are no more messages).
    * @author Bela Ban
  - * @version $Id: UNICAST.java,v 1.166 2010/03/12 09:07:44 belaban Exp $
  + * @version $Id: UNICAST.java,v 1.167 2010/09/17 12:05:09 belaban Exp $
    */
   @MBean(description="Reliable unicast layer")
   @DeprecatedProperty(names={"immediate_ack", "use_gms", "enabled_mbrs_timeout", "eager_lock_release"})
  @@ -72,8 +73,8 @@
       /* --------------------------------------------- Fields ------------------------------------------------ */
   
   
  -    private final ConcurrentMap<Address,SenderEntry> send_table=new ConcurrentHashMap<Address,SenderEntry>();
  -    private final ConcurrentMap<Address,ReceiverEntry> recv_table=new ConcurrentHashMap<Address,ReceiverEntry>();
  +    private final ConcurrentMap<Address, SenderEntry>   send_table=Util.createConcurrentMap();
  +    private final ConcurrentMap<Address, ReceiverEntry> recv_table=Util.createConcurrentMap();
   
       private final Vector<Address> members=new Vector<Address>(11);
   
  
  
  
  1.5       +3 -3      JGroups/src/org/jgroups/protocols/UFC.java
  
  Index: UFC.java
  ===================================================================
  RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/protocols/UFC.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UFC.java	13 Sep 2010 09:08:36 -0000	1.4
  +++ UFC.java	17 Sep 2010 12:05:09 -0000	1.5
  @@ -6,11 +6,11 @@
   import org.jgroups.annotations.MBean;
   import org.jgroups.annotations.ManagedAttribute;
   import org.jgroups.annotations.ManagedOperation;
  +import org.jgroups.util.Util;
   
   import java.util.Iterator;
   import java.util.Map;
   import java.util.Vector;
  -import java.util.concurrent.ConcurrentHashMap;
   
   
   /**
  @@ -31,7 +31,7 @@
    * <li>Receivers don't send the full credits (max_credits), but rather the actual number of bytes received
    * <ol/>
    * @author Bela Ban
  - * @version $Id: UFC.java,v 1.4 2010/09/13 09:08:36 belaban Exp $
  + * @version $Id: UFC.java,v 1.5 2010/09/17 12:05:09 belaban Exp $
    */
   @MBean(description="Simple flow control protocol based on a credit system")
   public class UFC extends FlowControl {
  @@ -40,7 +40,7 @@
        * Map<Address,Long>: keys are members, values are credits left. For each send,
        * the number of credits is decremented by the message size
        */
  -    protected final Map<Address,Credit> sent=new ConcurrentHashMap<Address,Credit>(11);
  +    protected final Map<Address,Credit> sent=Util.createConcurrentMap();
   
   
   
  
  
  
  1.11      +8 -5      JGroups/src/org/jgroups/protocols/UNICAST2.java
  
  Index: UNICAST2.java
  ===================================================================
  RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/protocols/UNICAST2.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- UNICAST2.java	20 Jul 2010 10:35:22 -0000	1.10
  +++ UNICAST2.java	17 Sep 2010 12:05:09 -0000	1.11
  @@ -3,15 +3,18 @@
   import org.jgroups.*;
   import org.jgroups.annotations.*;
   import org.jgroups.conf.PropertyConverters;
  -import org.jgroups.stack.*;
  +import org.jgroups.stack.AckSenderWindow;
  +import org.jgroups.stack.NakReceiverWindow;
  +import org.jgroups.stack.Protocol;
  +import org.jgroups.stack.Retransmitter;
   import org.jgroups.util.AgeOutCache;
   import org.jgroups.util.TimeScheduler;
  +import org.jgroups.util.Util;
   
   import java.io.DataInputStream;
   import java.io.DataOutputStream;
   import java.io.IOException;
   import java.util.*;
  -import java.util.concurrent.ConcurrentHashMap;
   import java.util.concurrent.ConcurrentMap;
   import java.util.concurrent.Future;
   import java.util.concurrent.TimeUnit;
  @@ -31,7 +34,7 @@
    * The advantage of this protocol over {@link org.jgroups.protocols.UNICAST} is that it doesn't send acks for every
    * message. Instead, it sends 'acks' after receiving max_bytes and/ or periodically (stable_interval).
    * @author Bela Ban
  - * @version $Id: UNICAST2.java,v 1.10 2010/07/20 10:35:22 belaban Exp $
  + * @version $Id: UNICAST2.java,v 1.11 2010/09/17 12:05:09 belaban Exp $
    */
   @Experimental @Unsupported
   @MBean(description="Reliable unicast layer")
  @@ -64,8 +67,8 @@
   
       /* --------------------------------------------- Fields ------------------------------------------------ */
   
  -    private final ConcurrentMap<Address,SenderEntry> send_table=new ConcurrentHashMap<Address,SenderEntry>();
  -    private final ConcurrentMap<Address,ReceiverEntry> recv_table=new ConcurrentHashMap<Address,ReceiverEntry>();
  +    private final ConcurrentMap<Address, SenderEntry>   send_table=Util.createConcurrentMap();
  +    private final ConcurrentMap<Address, ReceiverEntry> recv_table=Util.createConcurrentMap();
   
       private final Vector<Address> members=new Vector<Address>(11);
   
  
  
  
  1.328     +2 -2      JGroups/src/org/jgroups/protocols/TP.java
  
  Index: TP.java
  ===================================================================
  RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/protocols/TP.java,v
  retrieving revision 1.327
  retrieving revision 1.328
  diff -u -r1.327 -r1.328
  --- TP.java	24 Aug 2010 10:17:59 -0000	1.327
  +++ TP.java	17 Sep 2010 12:05:09 -0000	1.328
  @@ -47,7 +47,7 @@
    * The {@link #receive(Address, byte[], int, int)} method must
    * be called by subclasses when a unicast or multicast message has been received.
    * @author Bela Ban
  - * @version $Id: TP.java,v 1.327 2010/08/24 10:17:59 belaban Exp $
  + * @version $Id: TP.java,v 1.328 2010/09/17 12:05:09 belaban Exp $
    */
   @MBean(description="Transport protocol")
   @DeprecatedProperty(names={"bind_to_all_interfaces", "use_incoming_packet_handler", "use_outgoing_packet_handler",
  @@ -459,7 +459,7 @@
        * names (attached to the message by the transport anyway). The values are the next protocols above the
        * transports.
        */
  -    protected final ConcurrentMap<String,Protocol> up_prots=new ConcurrentHashMap<String,Protocol>();
  +    protected final ConcurrentMap<String,Protocol> up_prots=Util.createConcurrentMap(16, 0.75f, 16);
   
       /** The header including the cluster name, sent with each message. Not used with a shared transport (instead
        * TP.ProtocolAdapter attaches the header to the message */
  
  
  

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev