[6/9] git commit: cleanup

2013-09-30 Thread jbellis
cleanup


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/672131d9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/672131d9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/672131d9

Branch: refs/heads/trunk
Commit: 672131d97fe31a7c724a236fc4f040d4c241769d
Parents: d73380e
Author: Jonathan Ellis jbel...@apache.org
Authored: Mon Sep 30 13:52:09 2013 -0500
Committer: Jonathan Ellis jbel...@apache.org
Committed: Mon Sep 30 13:52:09 2013 -0500

--
 .../apache/cassandra/locator/TokenMetadata.java | 22 +++-
 1 file changed, 12 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/672131d9/src/java/org/apache/cassandra/locator/TokenMetadata.java
--
diff --git a/src/java/org/apache/cassandra/locator/TokenMetadata.java 
b/src/java/org/apache/cassandra/locator/TokenMetadata.java
index 7ad711f..ac9a1d0 100644
--- a/src/java/org/apache/cassandra/locator/TokenMetadata.java
+++ b/src/java/org/apache/cassandra/locator/TokenMetadata.java
@@ -45,10 +45,14 @@ public class TokenMetadata
 {
 private static final Logger logger = 
LoggerFactory.getLogger(TokenMetadata.class);
 
-/* Maintains token to endpoint map of every node in the cluster. */
+/**
+ * Maintains token to endpoint map of every node in the cluster.
+ * Each Token is associated with exactly one Address, but each Address may 
have
+ * multiple tokens.  Hence, the BiMultiValMap collection.
+ */
 private final BiMultiValMapToken, InetAddress tokenToEndpointMap;
 
-/* Maintains endpoint to host ID map of every node in the cluster */
+/** Maintains endpoint to host ID map of every node in the cluster */
 private final BiMapInetAddress, UUID endpointToHostIdMap;
 
 // Prior to CASSANDRA-603, we just had ttMapRange, InetAddress 
pendingRangestt,
@@ -235,10 +239,10 @@ public class TokenMetadata
  hostId));
 }
 }
-
+
 UUID storedId = endpointToHostIdMap.get(endpoint);
 if ((storedId != null)  (!storedId.equals(hostId)))
-logger.warn(Changing {}'s host ID from {} to {}, new 
Object[] {endpoint, storedId, hostId});
+logger.warn(Changing {}'s host ID from {} to {}, endpoint, 
storedId, hostId);
 
 endpointToHostIdMap.forcePut(endpoint, hostId);
 }
@@ -761,7 +765,7 @@ public class TokenMetadata
 lock.readLock().lock();
 try
 {
-return new HashSet(endpointToHostIdMap.keySet());
+return ImmutableSet.copyOf(endpointToHostIdMap.keySet());
 }
 finally
 {
@@ -775,7 +779,7 @@ public class TokenMetadata
 lock.readLock().lock();
 try
 {
-return new HashSet(leavingEndpoints);
+return ImmutableSet.copyOf(leavingEndpoints);
 }
 finally
 {
@@ -792,7 +796,7 @@ public class TokenMetadata
 lock.readLock().lock();
 try
 {
-return new HashSet(movingEndpoints);
+return ImmutableSet.copyOf(movingEndpoints);
 }
 finally
 {
@@ -1004,9 +1008,7 @@ public class TokenMetadata
  */
 public CollectionInetAddress getWriteEndpoints(Token token, String 
table, CollectionInetAddress naturalEndpoints)
 {
-ArrayListInetAddress endpoints = new ArrayListInetAddress();
-Iterables.addAll(endpoints, Iterables.concat(naturalEndpoints, 
pendingEndpointsFor(token, table)));
-return endpoints;
+return ImmutableList.copyOf(Iterables.concat(naturalEndpoints, 
pendingEndpointsFor(token, table)));
 }
 
 /** @return an endpoint to token multimap representation of 
tokenToEndpointMap (a copy) */



[6/9] git commit: cleanup

2013-06-06 Thread jbellis
cleanup


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ff5b8304
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ff5b8304
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ff5b8304

Branch: refs/heads/cassandra-1.2
Commit: ff5b8304431477eb82fc13ab1344a2fc92c66a57
Parents: fd6d19b
Author: Jonathan Ellis jbel...@apache.org
Authored: Thu Jun 6 16:47:03 2013 -0500
Committer: Jonathan Ellis jbel...@apache.org
Committed: Thu Jun 6 17:00:55 2013 -0500

--
 .../hadoop/cql3/ColumnFamilyRecordWriter.java  |   43 +++
 1 files changed, 20 insertions(+), 23 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ff5b8304/src/java/org/apache/cassandra/hadoop/cql3/ColumnFamilyRecordWriter.java
--
diff --git 
a/src/java/org/apache/cassandra/hadoop/cql3/ColumnFamilyRecordWriter.java 
b/src/java/org/apache/cassandra/hadoop/cql3/ColumnFamilyRecordWriter.java
index 3939e0b..c32d9ef 100644
--- a/src/java/org/apache/cassandra/hadoop/cql3/ColumnFamilyRecordWriter.java
+++ b/src/java/org/apache/cassandra/hadoop/cql3/ColumnFamilyRecordWriter.java
@@ -152,16 +152,16 @@ final class ColumnFamilyRecordWriter extends 
AbstractColumnFamilyRecordWriterMa
  * (i.e., null), then the entire key is marked for {@link Deletion}.
  * /p
  *
- * @param keybuff
+ * @param keyColumns
  *the key to write.
  * @param values
  *the values to write.
  * @throws IOException
  */
 @Override
-public void write(MapString, ByteBuffer keys, ListByteBuffer values) 
throws IOException
+public void write(MapString, ByteBuffer keyColumns, ListByteBuffer 
values) throws IOException
 {
-ByteBuffer rowKey = getRowKey(keys);
+ByteBuffer rowKey = getRowKey(keyColumns);
 RangeToken range = ringCache.getRange(rowKey);
 
 // get the client for the given range, or create a new one
@@ -180,7 +180,7 @@ final class ColumnFamilyRecordWriter extends 
AbstractColumnFamilyRecordWriterMa
 
 /**
  * A client that runs in a threadpool and connects to the list of 
endpoints for a particular
- * range. Binded variable values for keys in that range are sent to this 
client via a queue.
+ * range. Bound variables for keys in that range are sent to this client 
via a queue.
  */
 public class RangeClient extends AbstractRangeClientListByteBuffer
 {
@@ -201,10 +201,10 @@ final class ColumnFamilyRecordWriter extends 
AbstractColumnFamilyRecordWriterMa
 outer:
 while (run || !queue.isEmpty())
 {
-PairByteBuffer, ListByteBuffer bindVariables;
+PairByteBuffer, ListByteBuffer item;
 try
 {
-bindVariables = queue.take();
+item = queue.take();
 }
 catch (InterruptedException e)
 {
@@ -220,15 +220,16 @@ final class ColumnFamilyRecordWriter extends 
AbstractColumnFamilyRecordWriterMa
 {
 int i = 0;
 int itemId = preparedStatement(client);
-while (bindVariables != null)
+while (item != null)
 {
-client.execute_prepared_cql3_query(itemId, 
bindVariables.right, ConsistencyLevel.ONE);
+ListByteBuffer bindVariables = item.right;
+client.execute_prepared_cql3_query(itemId, 
bindVariables, ConsistencyLevel.ONE);
 i++;
 
 if (i = batchThreshold)
 break;
 
-bindVariables = queue.poll();
+item = queue.poll();
 }
 
 break;
@@ -293,7 +294,7 @@ final class ColumnFamilyRecordWriter extends 
AbstractColumnFamilyRecordWriterMa
 }
 }
 
-private ByteBuffer getRowKey(MapString, ByteBuffer keysMap)
+private ByteBuffer getRowKey(MapString, ByteBuffer keyColumns)
 {
 //current row key
 ByteBuffer rowKey;
@@ -301,13 +302,13 @@ final class ColumnFamilyRecordWriter extends 
AbstractColumnFamilyRecordWriterMa
 {
 ByteBuffer[] keys = new ByteBuffer[partitionkeys.length];
 for (int i = 0; i keys.length; i++)
-keys[i] = keysMap.get(partitionkeys[i]);
+keys[i] = keyColumns.get(partitionkeys[i]);
 
 rowKey = ((CompositeType) keyValidator).build(keys);
 }