CVS update: JGroups/src/org/jgroups/util CreditMap.java Util.java

"Vladimir Blagojevic" <[email protected]> Fri, 17 Sep 2010 16:29:11 +0000
Newsgroups gmane.comp.java.javagroups.cvs
Message-ID <[email protected]>
  User: vlada   
  Date: 10/09/17 16:29:10

  Modified:    src/org/jgroups/util Tag: Branch_JGroups_2_10 Util.java
  Added:       src/org/jgroups/util Tag: Branch_JGroups_2_10 CreditMap.java
  Log:
  [JGRP-1236] Port UFC and MFC protocols from HEAD to 2.10 branch
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.266.2.1 +19 -1     JGroups/src/org/jgroups/util/Util.java
  
  Index: Util.java
  ===================================================================
  RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/util/Util.java,v
  retrieving revision 1.266
  retrieving revision 1.266.2.1
  diff -u -r1.266 -r1.266.2.1
  --- Util.java	7 Jul 2010 09:36:25 -0000	1.266
  +++ Util.java	17 Sep 2010 16:29:10 -0000	1.266.2.1
  @@ -28,6 +28,8 @@
   import java.security.MessageDigest;
   import java.text.NumberFormat;
   import java.util.*;
  +import java.util.concurrent.ConcurrentHashMap;
  +import java.util.concurrent.ConcurrentMap;
   import java.util.regex.Pattern;
   import java.util.regex.Matcher;
   
  @@ -35,7 +37,7 @@
   /**
    * Collection of various utility routines that can not be assigned to other classes.
    * @author Bela Ban
  - * @version $Id: Util.java,v 1.266 2010/07/07 09:36:25 belaban Exp $
  + * @version $Id: Util.java,v 1.266.2.1 2010/09/17 16:29:10 vlada Exp $
    */
   public class Util {
   
  @@ -65,6 +67,10 @@
   
       private static Pattern METHOD_NAME_TO_ATTR_NAME_PATTERN=Pattern.compile("[A-Z]+");
       private static Pattern ATTR_NAME_TO_METHOD_NAME_PATTERN=Pattern.compile("_.");
  +    
  +    protected static int   CCHM_INITIAL_CAPACITY=16;
  +    protected static float CCHM_LOAD_FACTOR=0.75f;
  +    protected static int   CCHM_CONCURRENCY_LEVEL=16;
   
       /**
        * Global thread group to which all (most!) JGroups threads belong
  @@ -1449,6 +1455,18 @@
           }
           return t.isAlive();
   	}
  +    
  +    public static <K,V> ConcurrentMap<K,V> createConcurrentMap(int initial_capacity, float load_factor, int concurrency_level) {
  +        return new ConcurrentHashMap<K,V>(initial_capacity, load_factor, concurrency_level);
  +    }
  +
  +    public static <K,V> ConcurrentMap<K,V> createConcurrentMap(int initial_capacity) {
  +        return new ConcurrentHashMap<K,V>(initial_capacity);
  +    }
  +
  +    public static <K,V> ConcurrentMap<K,V> createConcurrentMap() {
  +        return new ConcurrentHashMap<K,V>(CCHM_INITIAL_CAPACITY, CCHM_LOAD_FACTOR, CCHM_CONCURRENCY_LEVEL);
  +    }
   
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.11.2.2  +302 -0    JGroups/src/org/jgroups/util/CreditMap.java
  
  
  
  

------------------------------------------------------------------------------
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