gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rher...@apache.org
Subject svn commit: r1456004 - in /gora/branches/GORA_174: ./ CHANGES.txt gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraClient.java gora-cassandra/src/main/java/org/apache/gora/cassandra/store/HectorUtils.java
Date Wed, 13 Mar 2013 15:30:05 GMT
Author: rherget
Date: Wed Mar 13 15:30:04 2013
New Revision: 1456004

URL: http://svn.apache.org/r1456004
Log:
merge GORA-211 #1455955

Modified:
    gora/branches/GORA_174/   (props changed)
    gora/branches/GORA_174/CHANGES.txt
    gora/branches/GORA_174/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraClient.java
    gora/branches/GORA_174/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/HectorUtils.java

Propchange: gora/branches/GORA_174/
------------------------------------------------------------------------------
  Merged /gora/trunk:r1455955

Modified: gora/branches/GORA_174/CHANGES.txt
URL: http://svn.apache.org/viewvc/gora/branches/GORA_174/CHANGES.txt?rev=1456004&r1=1456003&r2=1456004&view=diff
==============================================================================
--- gora/branches/GORA_174/CHANGES.txt (original)
+++ gora/branches/GORA_174/CHANGES.txt Wed Mar 13 15:30:04 2013
@@ -6,6 +6,8 @@ Gora Change Log
 
 trunk (current development)
 
+* GORA-211 thread safety: fix java.lang.NullPointerException - synchronize on mutator (rherget)
+
 * GORA-210 thread safety: fix java.util.ConcurrentModificationException (rherget)
 
 * GORA-190 Add "version" switch to bin/gora script (lewismc)

Modified: gora/branches/GORA_174/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraClient.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_174/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraClient.java?rev=1456004&r1=1456003&r2=1456004&view=diff
==============================================================================
--- gora/branches/GORA_174/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraClient.java
(original)
+++ gora/branches/GORA_174/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraClient.java
Wed Mar 13 15:30:04 2013
@@ -193,7 +193,9 @@ public class CassandraClient<K, T extend
       return;
     }
     
-    HectorUtils.insertColumn(mutator, key, columnFamily, columnName, byteBuffer);
+    synchronized(mutator) {
+      HectorUtils.insertColumn(mutator, key, columnFamily, columnName, byteBuffer);
+    }
   }
 
   /**
@@ -214,7 +216,9 @@ public class CassandraClient<K, T extend
     String columnFamily = this.cassandraMapping.getFamily(fieldName);
     String superColumnName = this.cassandraMapping.getColumn(fieldName);
     
-    HectorUtils.insertSubColumn(mutator, key, columnFamily, superColumnName, columnName,
byteBuffer);
+    synchronized(mutator) {
+      HectorUtils.insertSubColumn(mutator, key, columnFamily, superColumnName, columnName,
byteBuffer);
+    }
   }
 
   public void addSubColumn(K key, String fieldName, String columnName, Object value) {
@@ -238,7 +242,9 @@ public class CassandraClient<K, T extend
     String columnFamily = this.cassandraMapping.getFamily(fieldName);
     String superColumnName = this.cassandraMapping.getColumn(fieldName);
     
-    HectorUtils.deleteSubColumn(mutator, key, columnFamily, superColumnName, columnName);
+    synchronized(mutator) {
+      HectorUtils.deleteSubColumn(mutator, key, columnFamily, superColumnName, columnName);
+    }
   }
 
   public void deleteSubColumn(K key, String fieldName, String columnName) {

Modified: gora/branches/GORA_174/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/HectorUtils.java
URL: http://svn.apache.org/viewvc/gora/branches/GORA_174/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/HectorUtils.java?rev=1456004&r1=1456003&r2=1456004&view=diff
==============================================================================
--- gora/branches/GORA_174/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/HectorUtils.java
(original)
+++ gora/branches/GORA_174/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/HectorUtils.java
Wed Mar 13 15:30:04 2013
@@ -35,6 +35,11 @@ import org.apache.gora.persistency.Persi
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * This class it not thread safe.
+ * According to Hector's JavaDoc a Mutator isn't thread safe, too.
+ * Take a look at {@CassandraClient} for safe usage.
+ */
 public class HectorUtils<K,T extends Persistent> {
 
   public static final Logger LOG = LoggerFactory.getLogger(HectorUtils.class);



Mime
View raw message