CVS update: JGroups/src/org/jgroups/protocols FRAG2.java FD_SOCK.java FlowControl.java
"Bela Ban" <[email protected]> Fri, 17 Sep 2010 11:54:20 +0000
| Newsgroups | gmane.comp.java.javagroups.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: belaban
Date: 10/09/17 11:54:20
Modified: src/org/jgroups/protocols FRAG2.java FD_SOCK.java
FlowControl.java
Log:
use of Util.createConcurrentMap() instead of new ConcurrentHashMap()
Revision Changes Path
1.55 +8 -6 JGroups/src/org/jgroups/protocols/FRAG2.java
Index: FRAG2.java
===================================================================
RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/protocols/FRAG2.java,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- FRAG2.java 26 Aug 2010 15:41:29 -0000 1.54
+++ FRAG2.java 17 Sep 2010 11:54:20 -0000 1.55
@@ -9,12 +9,14 @@
import org.jgroups.util.Range;
import org.jgroups.util.Util;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import java.util.concurrent.atomic.AtomicLong;
/**
@@ -37,7 +39,7 @@
* message, so we add a constant (200 bytes).
*
* @author Bela Ban
- * @version $Id: FRAG2.java,v 1.54 2010/08/26 15:41:29 belaban Exp $
+ * @version $Id: FRAG2.java,v 1.55 2010/09/17 11:54:20 belaban Exp $
*/
@MBean(description="Fragments messages larger than fragmentation size into smaller packets")
@DeprecatedProperty(names={"overhead"})
@@ -55,7 +57,7 @@
/*the fragmentation list contains a fragmentation table per sender
*this way it becomes easier to clean up if a sender (member) leaves or crashes
*/
- private final ConcurrentMap<Address,ConcurrentMap<Long,FragEntry>> fragment_list=new ConcurrentHashMap<Address,ConcurrentMap<Long,FragEntry>>(11);
+ private final ConcurrentMap<Address,ConcurrentMap<Long,FragEntry>> fragment_list=Util.createConcurrentMap(11);
/** Used to assign fragmentation-specific sequence IDs (monotonically increasing) */
private int curr_id=1;
@@ -273,7 +275,7 @@
ConcurrentMap<Long,FragEntry> frag_table=fragment_list.get(sender);
if(frag_table == null) {
- frag_table=new ConcurrentHashMap<Long,FragEntry>();
+ frag_table=Util.createConcurrentMap(16, .075f, 16);
ConcurrentMap<Long,FragEntry> tmp=fragment_list.putIfAbsent(sender, frag_table);
if(tmp != null) // value was already present
frag_table=tmp;
1.120 +6 -4 JGroups/src/org/jgroups/protocols/FD_SOCK.java
Index: FD_SOCK.java
===================================================================
RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/protocols/FD_SOCK.java,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -r1.119 -r1.120
--- FD_SOCK.java 15 Jun 2010 10:10:40 -0000 1.119
+++ FD_SOCK.java 17 Sep 2010 11:54:20 -0000 1.120
@@ -6,12 +6,14 @@
import org.jgroups.stack.IpAddress;
import org.jgroups.stack.Protocol;
import org.jgroups.util.*;
-import org.jgroups.util.ThreadFactory;
import java.io.*;
import java.net.*;
import java.util.*;
-import java.util.concurrent.*;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Future;
+import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.TimeUnit;
/**
@@ -30,7 +32,7 @@
* monitors the client side of the socket connection (to monitor a peer) and another one that manages the
* server socket. However, those threads will be idle as long as both peers are running.
* @author Bela Ban May 29 2001
- * @version $Id: FD_SOCK.java,v 1.119 2010/06/15 10:10:40 belaban Exp $
+ * @version $Id: FD_SOCK.java,v 1.120 2010/09/17 11:54:20 belaban Exp $
*/
@MBean(description="Failure detection protocol based on sockets connecting members")
@DeprecatedProperty(names={"srv_sock_bind_addr"})
@@ -98,7 +100,7 @@
private volatile Thread pinger_thread=null; // listens on ping_sock, suspects member if socket is closed
/** Cache of member addresses and their ServerSocket addresses */
- private final ConcurrentMap<Address,IpAddress> cache=new ConcurrentHashMap<Address,IpAddress>(11);
+ private final ConcurrentMap<Address,IpAddress> cache=Util.createConcurrentMap(11);
private final Promise<IpAddress> ping_addr_promise=new Promise<IpAddress>(); // to fetch the ping_addr for ping_dest
private final Object sock_mutex=new Object(); // for access to ping_sock, ping_input
1.10 +6 -4 JGroups/src/org/jgroups/protocols/FlowControl.java
Index: FlowControl.java
===================================================================
RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/protocols/FlowControl.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FlowControl.java 13 Sep 2010 10:05:37 -0000 1.9
+++ FlowControl.java 17 Sep 2010 11:54:20 -0000 1.10
@@ -4,12 +4,14 @@
import org.jgroups.Event;
import org.jgroups.Message;
import org.jgroups.View;
-import org.jgroups.annotations.*;
+import org.jgroups.annotations.MBean;
+import org.jgroups.annotations.ManagedAttribute;
+import org.jgroups.annotations.ManagedOperation;
+import org.jgroups.annotations.Property;
import org.jgroups.stack.Protocol;
import org.jgroups.util.Util;
import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
/**
@@ -19,7 +21,7 @@
* the receiver sends more credits to the sender.
*
* @author Bela Ban
- * @version $Id: FlowControl.java,v 1.9 2010/09/13 10:05:37 belaban Exp $
+ * @version $Id: FlowControl.java,v 1.10 2010/09/17 11:54:20 belaban Exp $
*/
@MBean(description="Simple flow control protocol based on a credit system")
public abstract class FlowControl extends Protocol {
@@ -97,7 +99,7 @@
* by the size of the received message. When the credits fall below the threshold, we refill and send a REPLENISH
* message to the sender.
*/
- protected final Map<Address,Credit> received=new ConcurrentHashMap<Address,Credit>(11);
+ protected final Map<Address,Credit> received=Util.createConcurrentMap();
/** Whether FlowControl is still running, this is set to false when the protocol terminates (on stop()) */
------------------------------------------------------------------------------
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