cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject git commit: fix clientutil.jar dependencies patch by dbrosius and eevans reviewed by eevans for CASSANDRA-4566
Date Thu, 06 Sep 2012 04:03:20 GMT
Updated Branches:
  refs/heads/trunk 67cc0dc4a -> 978d7bb7d


fix clientutil.jar dependencies
patch by dbrosius and eevans reviewed by eevans for CASSANDRA-4566


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

Branch: refs/heads/trunk
Commit: 978d7bb7d59492129aee2747308d55f949003b02
Parents: 67cc0dc
Author: Dave Brosius <dbrosius@apache.org>
Authored: Wed Sep 5 23:59:31 2012 -0400
Committer: Dave Brosius <dbrosius@apache.org>
Committed: Wed Sep 5 23:59:31 2012 -0400

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 build.xml                                          |    3 -
 .../org/apache/cassandra/cql/jdbc/JdbcAscii.java   |    8 +-
 .../org/apache/cassandra/cql/jdbc/JdbcUTF8.java    |    6 +-
 .../cassandra/db/ColumnFamilySerializer.java       |    9 +--
 .../cassandra/db/SchemaCheckVerbHandler.java       |    6 +-
 .../org/apache/cassandra/net/MessagingService.java |    4 +-
 .../cassandra/streaming/StreamingRepairTask.java   |   27 ++++++--
 .../org/apache/cassandra/utils/ByteBufferUtil.java |    3 +-
 src/java/org/apache/cassandra/utils/UUIDGen.java   |   24 -------
 .../org/apache/cassandra/utils/UUIDSerializer.java |   51 +++++++++++++++
 11 files changed, 88 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/978d7bb7/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 46222c5..1ed7941 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 1.2-dev
+ * fix clientutil.jar dependencies (CASSANDRA-4566)
  * optimize WriteResponse (CASSANDRA-4548)
  * new metrics (CASSANDRA-4009)
  * redesign KEYS indexes to avoid read-before-write (CASSANDRA-2897)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/978d7bb7/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index a58ded5..96e2352 100644
--- a/build.xml
+++ b/build.xml
@@ -1083,9 +1083,6 @@
         <fileset dir="${build.dir.lib}">
           <include name="**/junit*.jar" />
         </fileset>
-        <fileset dir="${build.lib}">
-          <include name="**/guava*.jar" />
-        </fileset>
       </classpath>
     </junit>
   </target>

http://git-wip-us.apache.org/repos/asf/cassandra/blob/978d7bb7/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java
index 4b85f66..d013dc8 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcAscii.java
@@ -19,14 +19,14 @@ package org.apache.cassandra.cql.jdbc;
 
 import java.nio.ByteBuffer;
 import java.nio.charset.CharacterCodingException;
+import java.nio.charset.Charset;
 import java.sql.Types;
 
-import com.google.common.base.Charsets;
-
 import org.apache.cassandra.utils.ByteBufferUtil;
 
 public class JdbcAscii extends AbstractJdbcType<String>
 {
+    private static final Charset US_ASCII = Charset.forName("US-ASCII");
     public static final JdbcAscii instance = new JdbcAscii();
 
     JdbcAscii() {}
@@ -70,7 +70,7 @@ public class JdbcAscii extends AbstractJdbcType<String>
     {
         try
         {
-            return ByteBufferUtil.string(bytes, Charsets.US_ASCII);
+            return ByteBufferUtil.string(bytes, US_ASCII);
         }
         catch (CharacterCodingException e)
         {
@@ -95,6 +95,6 @@ public class JdbcAscii extends AbstractJdbcType<String>
 
     public ByteBuffer decompose(String value)
     {
-        return ByteBufferUtil.bytes(value, Charsets.US_ASCII);
+        return ByteBufferUtil.bytes(value, US_ASCII);
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/978d7bb7/src/java/org/apache/cassandra/cql/jdbc/JdbcUTF8.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql/jdbc/JdbcUTF8.java b/src/java/org/apache/cassandra/cql/jdbc/JdbcUTF8.java
index a1eaaf4..ddcb4aa 100644
--- a/src/java/org/apache/cassandra/cql/jdbc/JdbcUTF8.java
+++ b/src/java/org/apache/cassandra/cql/jdbc/JdbcUTF8.java
@@ -19,14 +19,14 @@ package org.apache.cassandra.cql.jdbc;
 
 import java.nio.ByteBuffer;
 import java.nio.charset.CharacterCodingException;
+import java.nio.charset.Charset;
 import java.sql.Types;
 
 import org.apache.cassandra.utils.ByteBufferUtil;
 
-import com.google.common.base.Charsets;
-
 public class JdbcUTF8 extends AbstractJdbcType<String>
 {
+    private static final Charset UTF_8 = Charset.forName("UTF-8");
     public static final JdbcUTF8 instance = new JdbcUTF8();
 
     public JdbcUTF8() {}
@@ -95,6 +95,6 @@ public class JdbcUTF8 extends AbstractJdbcType<String>
 
     public ByteBuffer decompose(String value)
     {
-        return ByteBufferUtil.bytes(value, Charsets.UTF_8);
+        return ByteBufferUtil.bytes(value, UTF_8);
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/978d7bb7/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java b/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java
index d3d6a59..bac1e8b 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilySerializer.java
@@ -23,13 +23,12 @@ import java.io.IOException;
 import java.util.UUID;
 
 import org.apache.cassandra.config.Schema;
-
 import org.apache.cassandra.io.IColumnSerializer;
-import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.io.ISSTableSerializer;
+import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.io.sstable.Descriptor;
 import org.apache.cassandra.net.MessagingService;
-import org.apache.cassandra.utils.UUIDGen;
+import org.apache.cassandra.utils.UUIDSerializer;
 
 public class ColumnFamilySerializer implements IVersionedSerializer<ColumnFamily>,
ISSTableSerializer<ColumnFamily>
 {
@@ -171,7 +170,7 @@ public class ColumnFamilySerializer implements IVersionedSerializer<ColumnFamily
             dos.writeInt(oldId);
         }
         else
-            UUIDGen.serializer.serialize(cfId, dos, version);
+            UUIDSerializer.serializer.serialize(cfId, dos, version);
     }
 
     public UUID deserializeCfId(DataInput dis, int version) throws IOException
@@ -179,7 +178,7 @@ public class ColumnFamilySerializer implements IVersionedSerializer<ColumnFamily
         // create a ColumnFamily based on the cf id
         UUID cfId = (version < MessagingService.VERSION_12)
                      ? Schema.instance.convertOldCfId(dis.readInt())
-                     : UUIDGen.serializer.deserialize(dis, version);
+                     : UUIDSerializer.serializer.deserialize(dis, version);
 
         if (Schema.instance.getCF(cfId) == null)
             throw new UnknownColumnFamilyException("Couldn't find cfId=" + cfId, cfId);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/978d7bb7/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java b/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java
index 4251512..dbbcaa6 100644
--- a/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java
+++ b/src/java/org/apache/cassandra/db/SchemaCheckVerbHandler.java
@@ -19,15 +19,15 @@ package org.apache.cassandra.db;
 
 import java.util.UUID;
 
-import org.apache.cassandra.config.Schema;
-import org.apache.cassandra.utils.UUIDGen;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.net.IVerbHandler;
 import org.apache.cassandra.net.MessageIn;
 import org.apache.cassandra.net.MessageOut;
 import org.apache.cassandra.net.MessagingService;
+import org.apache.cassandra.utils.UUIDSerializer;
 
 public class SchemaCheckVerbHandler implements IVerbHandler
 {
@@ -36,7 +36,7 @@ public class SchemaCheckVerbHandler implements IVerbHandler
     public void doVerb(MessageIn message, String id)
     {
         logger.debug("Received schema check request.");
-        MessageOut<UUID> response = new MessageOut<UUID>(MessagingService.Verb.INTERNAL_RESPONSE,
Schema.instance.getVersion(), UUIDGen.serializer);
+        MessageOut<UUID> response = new MessageOut<UUID>(MessagingService.Verb.INTERNAL_RESPONSE,
Schema.instance.getVersion(), UUIDSerializer.serializer);
         MessagingService.instance().sendReply(response, id, message.from);
     }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/978d7bb7/src/java/org/apache/cassandra/net/MessagingService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/MessagingService.java b/src/java/org/apache/cassandra/net/MessagingService.java
index 1a22273..0090f87 100644
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@ -184,7 +184,7 @@ public final class MessagingService implements MessagingServiceMBean
         put(Verb.TREE_REQUEST, AntiEntropyService.TreeRequest.serializer);
         put(Verb.TREE_RESPONSE, AntiEntropyService.Validator.serializer);
         put(Verb.STREAMING_REPAIR_REQUEST, StreamingRepairTask.serializer);
-        put(Verb.STREAMING_REPAIR_RESPONSE, UUIDGen.serializer);
+        put(Verb.STREAMING_REPAIR_RESPONSE, UUIDSerializer.serializer);
         put(Verb.GOSSIP_DIGEST_ACK, GossipDigestAck.serializer);
         put(Verb.GOSSIP_DIGEST_ACK2, GossipDigestAck2.serializer);
         put(Verb.GOSSIP_DIGEST_SYN, GossipDigestSyn.serializer);
@@ -209,7 +209,7 @@ public final class MessagingService implements MessagingServiceMBean
         put(Verb.SNAPSHOT, null);
 
         put(Verb.MIGRATION_REQUEST, MigrationManager.MigrationsSerializer.instance);
-        put(Verb.SCHEMA_CHECK, UUIDGen.serializer);
+        put(Verb.SCHEMA_CHECK, UUIDSerializer.serializer);
         put(Verb.BOOTSTRAP_TOKEN, BootStrapper.StringSerializer.instance);
         put(Verb.REPLICATION_FINISHED, null);
     }};

http://git-wip-us.apache.org/repos/asf/cassandra/blob/978d7bb7/src/java/org/apache/cassandra/streaming/StreamingRepairTask.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/streaming/StreamingRepairTask.java b/src/java/org/apache/cassandra/streaming/StreamingRepairTask.java
index c63d119..33c3f39 100644
--- a/src/java/org/apache/cassandra/streaming/StreamingRepairTask.java
+++ b/src/java/org/apache/cassandra/streaming/StreamingRepairTask.java
@@ -17,9 +17,15 @@
  */
 package org.apache.cassandra.streaming;
 
-import java.io.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
 import java.net.InetAddress;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -28,16 +34,21 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.db.Table;
+import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.dht.AbstractBounds;
 import org.apache.cassandra.dht.Range;
 import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.io.IVersionedSerializer;
 import org.apache.cassandra.io.sstable.SSTableReader;
-import org.apache.cassandra.net.*;
+import org.apache.cassandra.net.CompactEndpointSerializationHelper;
+import org.apache.cassandra.net.IVerbHandler;
+import org.apache.cassandra.net.MessageIn;
+import org.apache.cassandra.net.MessageOut;
+import org.apache.cassandra.net.MessagingService;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.UUIDGen;
+import org.apache.cassandra.utils.UUIDSerializer;
 
 
 /**
@@ -217,7 +228,7 @@ public class StreamingRepairTask implements Runnable
         private static void reply(InetAddress remote, UUID taskid)
         {
             logger.info(String.format("[streaming task #%s] task suceed, forwarding response
to %s", taskid, remote));
-            MessageOut<UUID> message = new MessageOut<UUID>(MessagingService.Verb.STREAMING_REPAIR_RESPONSE,
taskid, UUIDGen.serializer);
+            MessageOut<UUID> message = new MessageOut<UUID>(MessagingService.Verb.STREAMING_REPAIR_RESPONSE,
taskid, UUIDSerializer.serializer);
             MessagingService.instance().sendOneWay(message, remote);
         }
     }
@@ -226,7 +237,7 @@ public class StreamingRepairTask implements Runnable
     {
         public void serialize(StreamingRepairTask task, DataOutput dos, int version) throws
IOException
         {
-            UUIDGen.serializer.serialize(task.id, dos, version);
+            UUIDSerializer.serializer.serialize(task.id, dos, version);
             CompactEndpointSerializationHelper.serialize(task.owner, dos);
             CompactEndpointSerializationHelper.serialize(task.src, dos);
             CompactEndpointSerializationHelper.serialize(task.dst, dos);
@@ -240,7 +251,7 @@ public class StreamingRepairTask implements Runnable
 
         public StreamingRepairTask deserialize(DataInput dis, int version) throws IOException
         {
-            UUID id = UUIDGen.serializer.deserialize(dis, version);
+            UUID id = UUIDSerializer.serializer.deserialize(dis, version);
             InetAddress owner = CompactEndpointSerializationHelper.deserialize(dis);
             InetAddress src = CompactEndpointSerializationHelper.deserialize(dis);
             InetAddress dst = CompactEndpointSerializationHelper.deserialize(dis);
@@ -255,7 +266,7 @@ public class StreamingRepairTask implements Runnable
 
         public long serializedSize(StreamingRepairTask task, int version)
         {
-            long size = UUIDGen.serializer.serializedSize(task.id, version);
+            long size = UUIDSerializer.serializer.serializedSize(task.id, version);
             size += 3 * CompactEndpointSerializationHelper.serializedSize(task.owner);
             size += TypeSizes.NATIVE.sizeof(task.tableName);
             size += TypeSizes.NATIVE.sizeof(task.cfName);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/978d7bb7/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/ByteBufferUtil.java b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
index 2b5da97..0b27d03 100644
--- a/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
+++ b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java
@@ -31,8 +31,6 @@ import java.nio.charset.Charset;
 import java.util.Arrays;
 import java.util.UUID;
 
-import static com.google.common.base.Charsets.UTF_8;
-
 import org.apache.cassandra.io.util.FileDataInput;
 import org.apache.cassandra.io.util.FileUtils;
 
@@ -76,6 +74,7 @@ import org.apache.cassandra.io.util.FileUtils;
  */
 public class ByteBufferUtil
 {
+    private static final Charset UTF_8 = Charset.forName("UTF-8");
     public static final ByteBuffer EMPTY_BYTE_BUFFER = ByteBuffer.wrap(new byte[0]);
 
     public static int compareUnsigned(ByteBuffer o1, ByteBuffer o2)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/978d7bb7/src/java/org/apache/cassandra/utils/UUIDGen.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/UUIDGen.java b/src/java/org/apache/cassandra/utils/UUIDGen.java
index 2f473d7..2851965 100644
--- a/src/java/org/apache/cassandra/utils/UUIDGen.java
+++ b/src/java/org/apache/cassandra/utils/UUIDGen.java
@@ -17,7 +17,6 @@
  */
 package org.apache.cassandra.utils;
 
-import java.io.*;
 import java.net.InetAddress;
 import java.nio.ByteBuffer;
 import java.security.MessageDigest;
@@ -27,16 +26,12 @@ import java.util.Map;
 import java.util.Random;
 import java.util.UUID;
 
-import org.apache.cassandra.db.TypeSizes;
-import org.apache.cassandra.io.IVersionedSerializer;
 
 /**
  * The goods are here: www.ietf.org/rfc/rfc4122.txt.
  */
 public class UUIDGen
 {
-    public static UUIDSerializer serializer = new UUIDSerializer();
-
     // A grand day! millis at 00:00:00.000 15 Oct 1582.
     private static final long START_EPOCH = -12219292800000L;
     private static final long clock = new Random(System.currentTimeMillis()).nextLong();
@@ -95,25 +90,6 @@ public class UUIDGen
         return new UUID(raw.getLong(raw.position()), raw.getLong(raw.position() + 8));
     }
 
-    public static class UUIDSerializer implements IVersionedSerializer<UUID>
-    {
-        public void serialize(UUID uuid, DataOutput out, int version) throws IOException
-        {
-            out.writeLong(uuid.getMostSignificantBits());
-            out.writeLong(uuid.getLeastSignificantBits());
-        }
-
-        public UUID deserialize(DataInput in, int version) throws IOException
-        {
-            return new UUID(in.readLong(), in.readLong());
-        }
-
-        public long serializedSize(UUID uuid, int version)
-        {
-            return TypeSizes.NATIVE.sizeof(uuid.getMostSignificantBits()) + TypeSizes.NATIVE.sizeof(uuid.getLeastSignificantBits());
-        }
-    }
-
     /** decomposes a uuid into raw bytes. */
     public static byte[] decompose(UUID uuid)
     {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/978d7bb7/src/java/org/apache/cassandra/utils/UUIDSerializer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/UUIDSerializer.java b/src/java/org/apache/cassandra/utils/UUIDSerializer.java
new file mode 100644
index 0000000..9c1df6e
--- /dev/null
+++ b/src/java/org/apache/cassandra/utils/UUIDSerializer.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.utils;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.UUID;
+
+import org.apache.cassandra.db.TypeSizes;
+import org.apache.cassandra.io.IVersionedSerializer;
+
+public class UUIDSerializer implements IVersionedSerializer<UUID>
+{
+    public static UUIDSerializer serializer = new UUIDSerializer();
+
+    private UUIDSerializer()
+    {
+    }
+
+    public void serialize(UUID uuid, DataOutput out, int version) throws IOException
+    {
+        out.writeLong(uuid.getMostSignificantBits());
+        out.writeLong(uuid.getLeastSignificantBits());
+    }
+
+    public UUID deserialize(DataInput in, int version) throws IOException
+    {
+        return new UUID(in.readLong(), in.readLong());
+    }
+
+    public long serializedSize(UUID uuid, int version)
+    {
+        return TypeSizes.NATIVE.sizeof(uuid.getMostSignificantBits()) + TypeSizes.NATIVE.sizeof(uuid.getLeastSignificantBits());
+    }
+}
\ No newline at end of file


Mime
View raw message