CVS update: JGroups/src/org/jgroups/protocols SMACK.java SCOPE.java
"Bela Ban" <[email protected]> Fri, 17 Sep 2010 12:03:35 +0000
| Newsgroups | gmane.comp.java.javagroups.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: belaban
Date: 10/09/17 12:03:35
Modified: src/org/jgroups/protocols SMACK.java SCOPE.java
Log:
use of Util.createConcurrentMap() instead of new ConcurrentHashMap()
Revision Changes Path
1.38 +6 -5 JGroups/src/org/jgroups/protocols/SMACK.java
Index: SMACK.java
===================================================================
RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/protocols/SMACK.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- SMACK.java 15 Jun 2010 06:44:35 -0000 1.37
+++ SMACK.java 17 Sep 2010 12:03:35 -0000 1.38
@@ -13,12 +13,13 @@
import org.jgroups.stack.StaticInterval;
import org.jgroups.util.Util;
-import java.io.*;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@@ -49,7 +50,7 @@
* </ul>
* Advantage of this protocol: no group membership necessary, fast.
* @author Bela Ban Aug 2002
- * @version $Id: SMACK.java,v 1.37 2010/06/15 06:44:35 belaban Exp $
+ * @version $Id: SMACK.java,v 1.38 2010/09/17 12:03:35 belaban Exp $
* <BR> Fix membershop bug: start a, b, kill b, restart b: b will be suspected by a.
*/
@Experimental @Unsupported
@@ -60,8 +61,8 @@
int max_xmits=10; // max retransmissions (if still no ack, member will be removed)
final Set<Address> members=new LinkedHashSet<Address>(); // contains Addresses
AckMcastSenderWindow sender_win=null;
- final Map<Address,AckReceiverWindow> receivers=new ConcurrentHashMap<Address,AckReceiverWindow>(); // keys=sender (Address), values=AckReceiverWindow
- final Map<Address,Integer> xmit_table=new ConcurrentHashMap<Address,Integer>(); // keeps track of num xmits / member (keys: mbr, val:num)
+ final Map<Address, AckReceiverWindow> receivers=Util.createConcurrentMap(); // keys=sender (Address), values=AckReceiverWindow
+ final Map<Address, Integer> xmit_table=Util.createConcurrentMap(); // keeps track of num xmits / member (keys: mbr, val:num)
Address local_addr=null; // my own address
@GuardedBy("lock")
long seqno=1; // seqno for msgs sent by this sender
1.16 +7 -6 JGroups/src/org/jgroups/protocols/SCOPE.java
Index: SCOPE.java
===================================================================
RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/protocols/SCOPE.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- SCOPE.java 29 Mar 2010 06:03:08 -0000 1.15
+++ SCOPE.java 17 Sep 2010 12:03:35 -0000 1.16
@@ -18,7 +18,7 @@
* Implements https://jira.jboss.org/jira/browse/JGRP-822, which allows for concurrent delivery of messages from the
* same sender based on scopes. Similar to using OOB messages, but messages within the same scope are ordered.
* @author Bela Ban
- * @version $Id: SCOPE.java,v 1.15 2010/03/29 06:03:08 belaban Exp $
+ * @version $Id: SCOPE.java,v 1.16 2010/09/17 12:03:35 belaban Exp $
* @since 2.10
*/
@Experimental
@@ -44,9 +44,10 @@
protected Future<?> expiry_task=null;
- /** Used to find the correct AckReceiverWindow on message reception and deliver it in the right order */
- protected final ConcurrentMap<Address,ConcurrentMap<Short,MessageQueue>> queues
- =new ConcurrentHashMap<Address,ConcurrentMap<Short,MessageQueue>>();
+ /**
+ * Used to find the correct AckReceiverWindow on message reception and deliver it in the right order
+ */
+ protected final ConcurrentMap<Address,ConcurrentMap<Short,MessageQueue>> queues=Util.createConcurrentMap();
protected String cluster_name;
@@ -254,8 +255,8 @@
protected MessageQueue getOrCreateQueue(Address sender, short scope) {
ConcurrentMap<Short,MessageQueue> val=queues.get(sender);
if(val == null) {
- val=new ConcurrentHashMap<Short,MessageQueue>();
- ConcurrentMap<Short, MessageQueue> tmp=queues.putIfAbsent(sender, val);
+ val=Util.createConcurrentMap();
+ ConcurrentMap<Short,MessageQueue> tmp=queues.putIfAbsent(sender, val);
if(tmp != null)
val=tmp;
}
------------------------------------------------------------------------------
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