Permalink
Browse files

Added TimeUUIDUtils from Hector with minor modifications. Updated Sin…

…k to generate column TimeUUID from incoming timestamp instead of current time.
  • Loading branch information...
1 parent 4418660 commit f483a77059e052d0d422f0ac1bfbc20d6caf1a8b Roy Camp committed Jan 10, 2012
Showing with 2 additions and 6 deletions.
  1. +2 −6 src/java/org/apache/cassandra/plugins/SimpleCassandraSink.java
@@ -6,12 +6,10 @@
import java.util.Arrays;
import java.util.List;
import java.util.TimeZone;
+import java.util.UUID;
import org.apache.cassandra.thrift.*;
-import org.safehaus.uuid.UUID;
-import org.safehaus.uuid.UUIDGenerator;
-
import com.cloudera.flume.conf.Context;
import com.cloudera.flume.conf.SinkFactory.SinkBuilder;
import com.cloudera.flume.core.Event;
@@ -36,8 +34,6 @@
private CassandraClient cClient;
- private static final UUIDGenerator uuidGen = UUIDGenerator.getInstance();
-
private static final long MILLI_TO_MICRO = 1000; // 1ms = 1000us
public SimpleCassandraSink(String keyspace, String dataColumnFamily,
@@ -69,7 +65,7 @@ public void append(Event event) throws IOException, InterruptedException {
timestamp = System.currentTimeMillis() * MILLI_TO_MICRO;
// Make the index column
- UUID uuid = uuidGen.generateTimeBasedUUID();
+ UUID uuid = TimeUUIDUtils.getTimeUUID(timestamp);
Column indexColumn = new Column();
indexColumn.setName(uuid.toByteArray());
indexColumn.setValue(new byte[0]);

0 comments on commit f483a77

Please sign in to comment.