Remove redundant synchronized from JedisClusterInfoCache

* JedisClusterInfoCache already uses RWLock so synchonized keyword is not necessary
** it just slow down whole throughput
This commit is contained in:
Jungtaek Lim
2014-09-27 20:42:22 +09:00
parent 7836531ad7
commit 9a6d3f35fe

View File

@@ -118,7 +118,7 @@ public class JedisClusterInfoCache {
} }
} }
public synchronized void assignSlotsToNode(List<Integer> targetSlots, public void assignSlotsToNode(List<Integer> targetSlots,
HostAndPort targetNode) { HostAndPort targetNode) {
w.lock(); w.lock();
try { try {
@@ -137,7 +137,7 @@ public class JedisClusterInfoCache {
} }
} }
public synchronized JedisPool getNode(String nodeKey) { public JedisPool getNode(String nodeKey) {
r.lock(); r.lock();
try { try {
return nodes.get(nodeKey); return nodes.get(nodeKey);
@@ -146,7 +146,7 @@ public class JedisClusterInfoCache {
} }
} }
public synchronized JedisPool getSlotPool(int slot) { public JedisPool getSlotPool(int slot) {
r.lock(); r.lock();
try { try {
return slots.get(slot); return slots.get(slot);
@@ -155,7 +155,7 @@ public class JedisClusterInfoCache {
} }
} }
public synchronized Map<String, JedisPool> getNodes() { public Map<String, JedisPool> getNodes() {
r.lock(); r.lock();
try { try {
return new HashMap<String, JedisPool>(nodes); return new HashMap<String, JedisPool>(nodes);