Updated Branches: refs/heads/trunk 32c3b6e52 -> 3c06ff0a8
reduce unused empty map creation in the local writes (sendToHintedEndpoints) case patch by dbrosius reviewed by jbellis for CASSANDRA-5538 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3c06ff0a Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3c06ff0a Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3c06ff0a Branch: refs/heads/trunk Commit: 3c06ff0a8ee64742416c4b8a5ec083ea5a390e34 Parents: 32c3b6e Author: Dave Brosius <dbros...@apache.org> Authored: Mon May 6 09:39:35 2013 -0400 Committer: Dave Brosius <dbros...@apache.org> Committed: Mon May 6 09:39:35 2013 -0400 ---------------------------------------------------------------------- .../org/apache/cassandra/service/StorageProxy.java | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/3c06ff0a/src/java/org/apache/cassandra/service/StorageProxy.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/service/StorageProxy.java b/src/java/org/apache/cassandra/service/StorageProxy.java index 58fa6e3..684bd10 100644 --- a/src/java/org/apache/cassandra/service/StorageProxy.java +++ b/src/java/org/apache/cassandra/service/StorageProxy.java @@ -692,7 +692,7 @@ public class StorageProxy implements StorageProxyMBean throws OverloadedException { // Multimap that holds onto all the messages and addresses meant for a specific datacenter - Map<String, Multimap<MessageOut, InetAddress>> dcMessages = new HashMap<String, Multimap<MessageOut, InetAddress>>(); + Map<String, Multimap<MessageOut, InetAddress>> dcMessages = null; for (InetAddress destination : targets) { @@ -720,10 +720,12 @@ public class StorageProxy implements StorageProxyMBean logger.trace("insert writing key " + ByteBufferUtil.bytesToHex(rm.key()) + " to " + destination); String dc = DatabaseDescriptor.getEndpointSnitch().getDatacenter(destination); - Multimap<MessageOut, InetAddress> messages = dcMessages.get(dc); + Multimap<MessageOut, InetAddress> messages = (dcMessages != null) ? dcMessages.get(dc) : null; if (messages == null) { messages = HashMultimap.create(); + if (dcMessages == null) + dcMessages = new HashMap<String, Multimap<MessageOut, InetAddress>>(); dcMessages.put(dc, messages); } @@ -740,7 +742,8 @@ public class StorageProxy implements StorageProxyMBean } } - sendMessages(localDataCenter, dcMessages, responseHandler); + if (dcMessages != null) + sendMessages(localDataCenter, dcMessages, responseHandler); } public static Future<Void> submitHint(final RowMutation mutation,