You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2016/01/16 01:44:41 UTC
[01/12] usergrid git commit: Fix typo in word 'tenant'.
Repository: usergrid
Updated Branches:
refs/heads/master a51ee2c2e -> d796b68c6
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
index 9e59dbf..2af62a8 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV2Impl.java
@@ -39,8 +39,8 @@ import org.apache.usergrid.persistence.core.astyanax.ColumnSearch;
import org.apache.usergrid.persistence.core.astyanax.CompositeFieldSerializer;
import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
import org.apache.usergrid.persistence.core.astyanax.MultiRowColumnIterator;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.StringColumnParser;
import org.apache.usergrid.persistence.core.migration.schema.Migration;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -99,23 +99,23 @@ public class EdgeMetadataSerializationV2Impl implements EdgeMetadataSerializatio
/**
* CFs where the row key contains the source node id
*/
- private static final MultiTennantColumnFamily<BucketScopedRowKey<Id>, String> CF_SOURCE_EDGE_TYPES =
- new MultiTennantColumnFamily<>( "Graph_Source_Edge_Types_V2", ROW_KEY_SER, STRING_SERIALIZER );
+ private static final MultiTenantColumnFamily<BucketScopedRowKey<Id>, String> CF_SOURCE_EDGE_TYPES =
+ new MultiTenantColumnFamily<>( "Graph_Source_Edge_Types_V2", ROW_KEY_SER, STRING_SERIALIZER );
//all target id types for source edge type
- private static final MultiTennantColumnFamily<BucketScopedRowKey<EdgeIdTypeKey>, String> CF_SOURCE_EDGE_ID_TYPES =
- new MultiTennantColumnFamily<>( "Graph_Source_Edge_Id_Types_V2", EDGE_TYPE_ROW_KEY, STRING_SERIALIZER );
+ private static final MultiTenantColumnFamily<BucketScopedRowKey<EdgeIdTypeKey>, String> CF_SOURCE_EDGE_ID_TYPES =
+ new MultiTenantColumnFamily<>( "Graph_Source_Edge_Id_Types_V2", EDGE_TYPE_ROW_KEY, STRING_SERIALIZER );
/**
* CFs where the row key is the target node id
*/
- private static final MultiTennantColumnFamily<BucketScopedRowKey<Id>, String> CF_TARGET_EDGE_TYPES =
- new MultiTennantColumnFamily<>( "Graph_Target_Edge_Types_V2", ROW_KEY_SER, STRING_SERIALIZER );
+ private static final MultiTenantColumnFamily<BucketScopedRowKey<Id>, String> CF_TARGET_EDGE_TYPES =
+ new MultiTenantColumnFamily<>( "Graph_Target_Edge_Types_V2", ROW_KEY_SER, STRING_SERIALIZER );
//all source id types for target edge type
- private static final MultiTennantColumnFamily<BucketScopedRowKey<EdgeIdTypeKey>, String> CF_TARGET_EDGE_ID_TYPES =
- new MultiTennantColumnFamily<>( "Graph_Target_Edge_Id_Types_V2", EDGE_TYPE_ROW_KEY, STRING_SERIALIZER );
+ private static final MultiTenantColumnFamily<BucketScopedRowKey<EdgeIdTypeKey>, String> CF_TARGET_EDGE_ID_TYPES =
+ new MultiTenantColumnFamily<>( "Graph_Target_Edge_Id_Types_V2", EDGE_TYPE_ROW_KEY, STRING_SERIALIZER );
private static final Comparator<String> STRING_COMPARATOR = new Comparator<String>() {
@@ -321,7 +321,7 @@ public class EdgeMetadataSerializationV2Impl implements EdgeMetadataSerializatio
*/
private MutationBatch removeEdgeType( final ApplicationScope scope, final Id rowKeyId, final String edgeType,
final long version,
- final MultiTennantColumnFamily<BucketScopedRowKey<Id>, String> cf ) {
+ final MultiTenantColumnFamily<BucketScopedRowKey<Id>, String> cf ) {
//write target<--source edge type meta data
@@ -352,7 +352,7 @@ public class EdgeMetadataSerializationV2Impl implements EdgeMetadataSerializatio
*/
private MutationBatch removeIdType( final ApplicationScope scope, final Id rowId, final String idType,
final String edgeType, final long version,
- final MultiTennantColumnFamily<BucketScopedRowKey<EdgeIdTypeKey>, String> cf ) {
+ final MultiTenantColumnFamily<BucketScopedRowKey<EdgeIdTypeKey>, String> cf ) {
final EdgeIdTypeKey edgeIdTypeKey = new EdgeIdTypeKey( rowId, edgeType );
@@ -400,7 +400,7 @@ public class EdgeMetadataSerializationV2Impl implements EdgeMetadataSerializatio
* @param cf The column family to execute on
*/
private Iterator<String> getEdgeTypes( final ApplicationScope scope, final SearchEdgeType search,
- final MultiTennantColumnFamily<BucketScopedRowKey<Id>, String> cf ) {
+ final MultiTenantColumnFamily<BucketScopedRowKey<Id>, String> cf ) {
ValidationUtils.validateApplicationScope( scope );
GraphValidation.validateSearchEdgeType( search );
@@ -438,7 +438,7 @@ public class EdgeMetadataSerializationV2Impl implements EdgeMetadataSerializatio
* @param cf The column family to search
*/
public Iterator<String> getIdTypes( final ApplicationScope scope, final SearchIdType search,
- final MultiTennantColumnFamily<BucketScopedRowKey<EdgeIdTypeKey>, String> cf ) {
+ final MultiTenantColumnFamily<BucketScopedRowKey<EdgeIdTypeKey>, String> cf ) {
ValidationUtils.validateApplicationScope( scope );
GraphValidation.validateSearchEdgeIdType( search );
@@ -465,7 +465,7 @@ public class EdgeMetadataSerializationV2Impl implements EdgeMetadataSerializatio
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
return Arrays.asList( graphCf( CF_SOURCE_EDGE_TYPES ), graphCf( CF_TARGET_EDGE_TYPES ),
graphCf( CF_SOURCE_EDGE_ID_TYPES ), graphCf( CF_TARGET_EDGE_ID_TYPES ) );
}
@@ -474,10 +474,10 @@ public class EdgeMetadataSerializationV2Impl implements EdgeMetadataSerializatio
/**
* Helper to generate an edge definition by the type
*/
- private MultiTennantColumnFamilyDefinition graphCf( MultiTennantColumnFamily cf ) {
- return new MultiTennantColumnFamilyDefinition( cf, BytesType.class.getSimpleName(),
+ private MultiTenantColumnFamilyDefinition graphCf(MultiTenantColumnFamily cf ) {
+ return new MultiTenantColumnFamilyDefinition( cf, BytesType.class.getSimpleName(),
UTF8Type.class.getSimpleName(), BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/NodeSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/NodeSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/NodeSerializationImpl.java
index 18062c4..cd803e8 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/NodeSerializationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/NodeSerializationImpl.java
@@ -34,8 +34,8 @@ import org.apache.cassandra.db.marshal.BytesType;
import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKeySerializer;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.migration.schema.Migration;
@@ -86,8 +86,8 @@ public class NodeSerializationImpl implements NodeSerialization, Migration {
* BloomFilter on read. This means our performance will be no worse than checking a distributed cache in RAM for
* the existence of a marked node.
*/
- private static final MultiTennantColumnFamily<ScopedRowKey<Id>, Boolean> GRAPH_DELETE =
- new MultiTennantColumnFamily<>( "Graph_Marked_Nodes",
+ private static final MultiTenantColumnFamily<ScopedRowKey<Id>, Boolean> GRAPH_DELETE =
+ new MultiTenantColumnFamily<>( "Graph_Marked_Nodes",
new ScopedRowKeySerializer<Id>( ROW_SERIALIZER ), BOOLEAN_SERIALIZER );
@@ -103,11 +103,11 @@ public class NodeSerializationImpl implements NodeSerialization, Migration {
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
return Collections.singleton(
- new MultiTennantColumnFamilyDefinition( GRAPH_DELETE, BytesType.class.getSimpleName(),
+ new MultiTenantColumnFamilyDefinition( GRAPH_DELETE, BytesType.class.getSimpleName(),
BooleanType.class.getSimpleName(), BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.ALL ) );
+ MultiTenantColumnFamilyDefinition.CacheOption.ALL ) );
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeColumnFamilies.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeColumnFamilies.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeColumnFamilies.java
index f1d6e37..762f9d0 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeColumnFamilies.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/EdgeColumnFamilies.java
@@ -21,7 +21,7 @@
package org.apache.usergrid.persistence.graph.serialization.impl.shard;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.migration.schema.Migration;
@@ -34,27 +34,27 @@ public interface EdgeColumnFamilies extends Migration{
/**
* Get the name of the column family for getting source nodes
*/
- public MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getSourceNodeCfName();
+ public MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getSourceNodeCfName();
/**
* Get the name of the column family for getting target nodes
*/
- public MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getTargetNodeCfName();
+ public MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getTargetNodeCfName();
/**
* Get the name of the column family for getting source nodes with a target type
*/
- public MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getSourceNodeTargetTypeCfName();
+ public MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getSourceNodeTargetTypeCfName();
/**
* Get the name of the column family for getting target nodes with a source type
*/
- public MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getTargetNodeSourceTypeCfName();
+ public MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getTargetNodeSourceTypeCfName();
/**
* Get the Graph edge versions cf
* @return
*/
- public MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> getGraphEdgeVersions();
+ public MultiTenantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> getGraphEdgeVersions();
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardSerializationImpl.java
index 2f83d6f..120a15c 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardSerializationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/EdgeShardSerializationImpl.java
@@ -30,8 +30,8 @@ import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
import org.apache.usergrid.persistence.core.astyanax.ColumnNameIterator;
import org.apache.usergrid.persistence.core.astyanax.ColumnParser;
import org.apache.usergrid.persistence.core.astyanax.ColumnTypes;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKeySerializer;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -61,8 +61,8 @@ public class EdgeShardSerializationImpl implements EdgeShardSerialization {
/**
* Edge shards
*/
- private static final MultiTennantColumnFamily<ScopedRowKey<DirectedEdgeMeta>, Long> EDGE_SHARDS =
- new MultiTennantColumnFamily<>( "Edge_Shards",
+ private static final MultiTenantColumnFamily<ScopedRowKey<DirectedEdgeMeta>, Long> EDGE_SHARDS =
+ new MultiTenantColumnFamily<>( "Edge_Shards",
new ScopedRowKeySerializer<>( EdgeShardRowKeySerializer.INSTANCE ), LongSerializer.get() );
@@ -164,13 +164,13 @@ public class EdgeShardSerializationImpl implements EdgeShardSerialization {
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
return Collections.singleton(
- new MultiTennantColumnFamilyDefinition( EDGE_SHARDS, BytesType.class.getSimpleName(),
+ new MultiTenantColumnFamilyDefinition( EDGE_SHARDS, BytesType.class.getSimpleName(),
ColumnTypes.LONG_TYPE_REVERSED, BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS ) );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS ) );
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardedEdgeSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardedEdgeSerializationImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardedEdgeSerializationImpl.java
index bc02c8d..ce0953c 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardedEdgeSerializationImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardedEdgeSerializationImpl.java
@@ -30,7 +30,7 @@ import javax.annotation.Nullable;
import javax.inject.Inject;
import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.consistency.TimeService;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -117,7 +117,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
+ final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge,
final Shard shard, final boolean isDeleted ) {
@@ -142,7 +142,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
+ final MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
final ApplicationScope scope, final RowKeyType rowKey, final DirectedEdge edge,
final Shard shard, final boolean isDeleted ) {
@@ -166,7 +166,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
+ final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge,
final Shard shard, final boolean isDeleted ) {
@@ -192,7 +192,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
+ final MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
final ApplicationScope scope, final RowKeyType rowKey, final DirectedEdge edge,
final Shard shard, final boolean isDeleted ) {
@@ -217,7 +217,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily,
+ final MultiTenantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily,
final ApplicationScope scope, final EdgeRowKey rowKey, final Long column, final Shard shard,
final boolean isDeleted ) {
batch.withRow( columnFamilies.getGraphEdgeVersions(), ScopedRowKey.fromKey( scope.getApplication(), rowKey ) )
@@ -236,7 +236,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
+ final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge,
final Shard shard, final boolean isDeleted ) {
@@ -256,7 +256,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
+ final MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
final ApplicationScope scope, final RowKeyType rowKey, final DirectedEdge edge,
final Shard shard, final boolean isDeleted ) {
@@ -277,7 +277,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
+ final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily,
final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge,
final Shard shard, final boolean isDeleted ) {
@@ -298,7 +298,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
+ final MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily,
final ApplicationScope scope, final RowKeyType rowKey, final DirectedEdge edge,
final Shard shard, final boolean isDeleted ) {
@@ -318,7 +318,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily,
+ final MultiTenantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily,
final ApplicationScope scope, final EdgeRowKey rowKey, final Long column, final Shard shard,
final boolean isDeleted ) {
batch.withRow( columnFamilies.getGraphEdgeVersions(), ScopedRowKey.fromKey( scope.getApplication(), rowKey ) )
@@ -338,7 +338,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
final Id sourceId = search.sourceNode();
final String type = search.getType();
final long maxTimestamp = search.getMaxTimestamp();
- final MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily =
+ final MultiTenantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily =
columnFamilies.getGraphEdgeVersions();
final Serializer<Long> serializer = columnFamily.getColumnSerializer();
@@ -404,7 +404,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
final Id sourceId = search.getNode();
final String type = search.getType();
final long maxTimestamp = search.getMaxTimestamp();
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily =
+ final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily =
columnFamilies.getSourceNodeCfName();
final Serializer<DirectedEdge> serializer = columnFamily.getColumnSerializer();
@@ -469,7 +469,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
final String type = search.getType();
final String targetType = search.getIdType();
final long maxTimestamp = search.getMaxTimestamp();
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily =
+ final MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily =
columnFamilies.getSourceNodeTargetTypeCfName();
final Serializer<DirectedEdge> serializer = columnFamily.getColumnSerializer();
@@ -526,7 +526,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
final Id targetId = search.getNode();
final String type = search.getType();
final long maxTimestamp = search.getMaxTimestamp();
- final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily =
+ final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily =
columnFamilies.getTargetNodeCfName();
final Serializer<DirectedEdge> serializer = columnFamily.getColumnSerializer();
@@ -587,7 +587,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
final String sourceType = search.getIdType();
final String type = search.getType();
final long maxTimestamp = search.getMaxTimestamp();
- final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily =
+ final MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily =
columnFamilies.getTargetNodeSourceTypeCfName();
final Serializer<DirectedEdge> serializer = columnFamily.getColumnSerializer();
@@ -648,7 +648,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
/**
* Return the column family used for the write
*/
- protected abstract MultiTennantColumnFamily<ScopedRowKey<R>, C> getColumnFamily();
+ protected abstract MultiTenantColumnFamily<ScopedRowKey<R>, C> getColumnFamily();
/**
* Get the row key
@@ -670,7 +670,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
* Write the edge with the given data
*/
abstract void writeEdge( final MutationBatch batch,
- final MultiTennantColumnFamily<ScopedRowKey<R>, C> columnFamily,
+ final MultiTenantColumnFamily<ScopedRowKey<R>, C> columnFamily,
final ApplicationScope scope, final R rowKey, final C column, final Shard shard,
final boolean isDeleted );
@@ -687,7 +687,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
final C column = getDirectedEdge();
- final MultiTennantColumnFamily<ScopedRowKey<R>, C> columnFamily = getColumnFamily();
+ final MultiTenantColumnFamily<ScopedRowKey<R>, C> columnFamily = getColumnFamily();
final boolean isDeleted = isDeleted();
@@ -707,7 +707,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
*/
private abstract class SourceWriteOp extends RowOp<RowKey, DirectedEdge> {
- private final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily;
+ private final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily;
private final Id sourceNodeId;
@@ -732,7 +732,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getColumnFamily() {
+ protected MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getColumnFamily() {
return columnFamily;
}
@@ -761,7 +761,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
*/
private abstract class SourceTargetTypeWriteOp extends RowOp<RowKeyType, DirectedEdge> {
- private final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily;
+ private final MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily;
private final Id sourceNodeId;
private final String type;
private Id targetId;
@@ -786,7 +786,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getColumnFamily() {
+ protected MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getColumnFamily() {
return columnFamily;
}
@@ -815,7 +815,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
*/
private abstract class TargetWriteOp extends RowOp<RowKey, DirectedEdge> {
- private final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily;
+ private final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily;
private final Id targetNode;
@@ -840,7 +840,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getColumnFamily() {
+ protected MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getColumnFamily() {
return columnFamily;
}
@@ -869,7 +869,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
*/
private abstract class TargetSourceTypeWriteOp extends RowOp<RowKeyType, DirectedEdge> {
- private final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily;
+ private final MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily;
private final Id targetNode;
private final Id sourceNode;
@@ -897,7 +897,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getColumnFamily() {
+ protected MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getColumnFamily() {
return columnFamily;
}
@@ -926,7 +926,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
*/
private abstract class EdgeVersions extends RowOp<EdgeRowKey, Long> {
- private final MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily;
+ private final MultiTenantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> columnFamily;
private final Id targetNode;
private final Id sourceNode;
@@ -954,7 +954,7 @@ public class ShardedEdgeSerializationImpl implements ShardedEdgeSerialization {
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> getColumnFamily() {
+ protected MultiTenantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> getColumnFamily() {
return columnFamily;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
index 9e84491..d1000fb 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
@@ -1,7 +1,6 @@
package org.apache.usergrid.persistence.graph.serialization.impl.shard.impl;
-import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
@@ -9,16 +8,12 @@ import java.util.NoSuchElementException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.usergrid.persistence.core.astyanax.ColumnNameIterator;
-import org.apache.usergrid.persistence.core.astyanax.MultiKeyColumnNameIterator;
import org.apache.usergrid.persistence.core.astyanax.MultiRowColumnIterator;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
-import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import com.netflix.astyanax.Keyspace;
import com.netflix.astyanax.model.ConsistencyLevel;
-import com.netflix.astyanax.query.RowQuery;
import com.netflix.astyanax.util.RangeBuilder;
@@ -36,7 +31,7 @@ public class ShardsColumnIterator<R, C, T> implements Iterator<T> {
private final EdgeSearcher<R, C, T> searcher;
- private final MultiTennantColumnFamily<ScopedRowKey<R>, C> cf;
+ private final MultiTenantColumnFamily<ScopedRowKey<R>, C> cf;
private Iterator<T> currentColumnIterator;
@@ -47,9 +42,9 @@ public class ShardsColumnIterator<R, C, T> implements Iterator<T> {
private final ConsistencyLevel consistencyLevel;
- public ShardsColumnIterator( final EdgeSearcher<R, C, T> searcher,
- final MultiTennantColumnFamily<ScopedRowKey<R>, C> cf, final Keyspace keyspace,
- final ConsistencyLevel consistencyLevel, final int pageSize ) {
+ public ShardsColumnIterator(final EdgeSearcher<R, C, T> searcher,
+ final MultiTenantColumnFamily<ScopedRowKey<R>, C> cf, final Keyspace keyspace,
+ final ConsistencyLevel consistencyLevel, final int pageSize ) {
this.searcher = searcher;
this.cf = cf;
this.keyspace = keyspace;
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/SizebasedEdgeColumnFamilies.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/SizebasedEdgeColumnFamilies.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/SizebasedEdgeColumnFamilies.java
index f163ecd..9185ac8 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/SizebasedEdgeColumnFamilies.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/SizebasedEdgeColumnFamilies.java
@@ -28,8 +28,8 @@ import org.apache.cassandra.db.marshal.BytesType;
import org.apache.cassandra.db.marshal.DynamicCompositeType;
import org.apache.usergrid.persistence.core.astyanax.ColumnTypes;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKeySerializer;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.graph.serialization.impl.shard.DirectedEdge;
@@ -75,80 +75,80 @@ public class SizebasedEdgeColumnFamilies implements EdgeColumnFamilies {
//initialize the CF's from our implementation
- private static final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> SOURCE_NODE_EDGES =
- new MultiTennantColumnFamily<>( "Graph_Source_Node_Edges",
+ private static final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> SOURCE_NODE_EDGES =
+ new MultiTenantColumnFamily<>( "Graph_Source_Node_Edges",
new ScopedRowKeySerializer<>( ROW_SERIALIZER ), EDGE_SERIALIZER );
- private static final MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> TARGET_NODE_EDGES =
- new MultiTennantColumnFamily<>( "Graph_Target_Node_Edges",
+ private static final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> TARGET_NODE_EDGES =
+ new MultiTenantColumnFamily<>( "Graph_Target_Node_Edges",
new ScopedRowKeySerializer<>( ROW_SERIALIZER ), EDGE_SERIALIZER );
- private static final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> SOURCE_NODE_TARGET_TYPE =
- new MultiTennantColumnFamily<>( "Graph_Source_Node_Target_Type",
+ private static final MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> SOURCE_NODE_TARGET_TYPE =
+ new MultiTenantColumnFamily<>( "Graph_Source_Node_Target_Type",
new ScopedRowKeySerializer<>( ROW_TYPE_SERIALIZER ), EDGE_SERIALIZER );
/**
* The edges that are to the target node with the source type. The target node is the row key
*/
- private static final MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> TARGET_NODE_SOURCE_TYPE =
- new MultiTennantColumnFamily<>( "Graph_Target_Node_Source_Type",
+ private static final MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> TARGET_NODE_SOURCE_TYPE =
+ new MultiTenantColumnFamily<>( "Graph_Target_Node_Source_Type",
new ScopedRowKeySerializer<>( ROW_TYPE_SERIALIZER ), EDGE_SERIALIZER );
- private static final MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> EDGE_VERSIONS =
- new MultiTennantColumnFamily<>( "Graph_Edge_Versions",
+ private static final MultiTenantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> EDGE_VERSIONS =
+ new MultiTenantColumnFamily<>( "Graph_Edge_Versions",
new ScopedRowKeySerializer<>( EDGE_ROW_KEY_SERIALIZER ), LONG_SERIALIZER );
@Override
- public MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getSourceNodeCfName() {
+ public MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getSourceNodeCfName() {
return SOURCE_NODE_EDGES;
}
@Override
- public MultiTennantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getTargetNodeCfName() {
+ public MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> getTargetNodeCfName() {
return TARGET_NODE_EDGES;
}
@Override
- public MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getSourceNodeTargetTypeCfName() {
+ public MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getSourceNodeTargetTypeCfName() {
return SOURCE_NODE_TARGET_TYPE;
}
@Override
- public MultiTennantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getTargetNodeSourceTypeCfName() {
+ public MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> getTargetNodeSourceTypeCfName() {
return TARGET_NODE_SOURCE_TYPE;
}
@Override
- public MultiTennantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> getGraphEdgeVersions() {
+ public MultiTenantColumnFamily<ScopedRowKey<EdgeRowKey>, Long> getGraphEdgeVersions() {
return EDGE_VERSIONS;
}
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
return Arrays
.asList( graphCf( SOURCE_NODE_EDGES ), graphCf( TARGET_NODE_EDGES ), graphCf( SOURCE_NODE_TARGET_TYPE ),
graphCf( TARGET_NODE_SOURCE_TYPE ),
- new MultiTennantColumnFamilyDefinition( EDGE_VERSIONS, BytesType.class.getSimpleName(),
+ new MultiTenantColumnFamilyDefinition( EDGE_VERSIONS, BytesType.class.getSimpleName(),
ColumnTypes.LONG_TYPE_REVERSED, BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.ALL ) );
+ MultiTenantColumnFamilyDefinition.CacheOption.ALL ) );
}
/**
* Helper to generate an edge definition by the type
*/
- private MultiTennantColumnFamilyDefinition graphCf( MultiTennantColumnFamily cf ) {
- return new MultiTennantColumnFamilyDefinition( cf, BytesType.class.getSimpleName(), EDGE_DYNAMIC_COMPOSITE_TYPE,
- BytesType.class.getSimpleName(), MultiTennantColumnFamilyDefinition.CacheOption.ALL );
+ private MultiTenantColumnFamilyDefinition graphCf(MultiTenantColumnFamily cf ) {
+ return new MultiTenantColumnFamilyDefinition( cf, BytesType.class.getSimpleName(), EDGE_DYNAMIC_COMPOSITE_TYPE,
+ BytesType.class.getSimpleName(), MultiTenantColumnFamilyDefinition.CacheOption.ALL );
}
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapSerializationImpl.java b/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapSerializationImpl.java
index ceeb3ad..f90f80c 100644
--- a/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapSerializationImpl.java
+++ b/stack/corepersistence/map/src/main/java/org/apache/usergrid/persistence/map/impl/MapSerializationImpl.java
@@ -34,10 +34,9 @@ import org.apache.cassandra.db.marshal.UTF8Type;
import org.apache.usergrid.persistence.core.astyanax.BucketScopedRowKey;
import org.apache.usergrid.persistence.core.astyanax.BucketScopedRowKeySerializer;
import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
-import org.apache.usergrid.persistence.core.astyanax.CassandraFig;
import org.apache.usergrid.persistence.core.astyanax.CompositeFieldSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKeySerializer;
import org.apache.usergrid.persistence.core.shard.ExpandingShardLocator;
@@ -46,7 +45,6 @@ import org.apache.usergrid.persistence.map.MapScope;
import com.google.common.base.Preconditions;
import com.google.common.hash.Funnel;
-import com.google.common.hash.PrimitiveSink;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.netflix.astyanax.ColumnListMutation;
@@ -89,15 +87,15 @@ public class MapSerializationImpl implements MapSerialization {
/**
* CFs where the row key contains the source node id
*/
- public static final MultiTennantColumnFamily<ScopedRowKey<MapEntryKey>, Boolean> MAP_ENTRIES =
- new MultiTennantColumnFamily<>( "Map_Entries", MAP_ENTRY_SERIALIZER, BOOLEAN_SERIALIZER );
+ public static final MultiTenantColumnFamily<ScopedRowKey<MapEntryKey>, Boolean> MAP_ENTRIES =
+ new MultiTenantColumnFamily<>( "Map_Entries", MAP_ENTRY_SERIALIZER, BOOLEAN_SERIALIZER );
/**
* CFs where the row key contains the source node id
*/
- public static final MultiTennantColumnFamily<BucketScopedRowKey<String>, String> MAP_KEYS =
- new MultiTennantColumnFamily<>( "Map_Keys", MAP_KEY_SERIALIZER, STRING_SERIALIZER );
+ public static final MultiTenantColumnFamily<BucketScopedRowKey<String>, String> MAP_KEYS =
+ new MultiTenantColumnFamily<>( "Map_Keys", MAP_KEY_SERIALIZER, STRING_SERIALIZER );
/**
* Number of buckets to hash across.
@@ -339,17 +337,17 @@ public class MapSerializationImpl implements MapSerialization {
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
- final MultiTennantColumnFamilyDefinition mapEntries =
- new MultiTennantColumnFamilyDefinition( MAP_ENTRIES, BytesType.class.getSimpleName(),
+ final MultiTenantColumnFamilyDefinition mapEntries =
+ new MultiTenantColumnFamilyDefinition( MAP_ENTRIES, BytesType.class.getSimpleName(),
BytesType.class.getSimpleName(), BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
- final MultiTennantColumnFamilyDefinition mapKeys =
- new MultiTennantColumnFamilyDefinition( MAP_KEYS, BytesType.class.getSimpleName(),
+ final MultiTenantColumnFamilyDefinition mapKeys =
+ new MultiTenantColumnFamilyDefinition( MAP_KEYS, BytesType.class.getSimpleName(),
UTF8Type.class.getSimpleName(), BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
return Arrays.asList( mapEntries, mapKeys );
}
[11/12] usergrid git commit: Implement a minimum lock expiration time.
Posted by gr...@apache.org.
Implement a minimum lock expiration time.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/4945b6f2
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/4945b6f2
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/4945b6f2
Branch: refs/heads/master
Commit: 4945b6f2d3a8a2d6e78c230bce6be09082dfa68c
Parents: 289cc97
Author: Michael Russo <mi...@gmail.com>
Authored: Fri Jan 15 14:30:58 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Fri Jan 15 14:30:58 2016 -0800
----------------------------------------------------------------------
.../cassandra/AstyanaxLockManagerImpl.java | 25 +++++++++++++++++++-
.../persistence/core/astyanax/CassandraFig.java | 10 ++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/4945b6f2/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
index 1fcd1b7..a69aee2 100644
--- a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
@@ -52,6 +52,7 @@ public class AstyanaxLockManagerImpl implements LockManager {
private final CassandraFig cassandraFig;
private final Keyspace keyspace;
private final ColumnFamily columnFamily;
+ private static final int MINIMUM_LOCK_EXPIRATION = 60000; // 1 minute
@Inject
public AstyanaxLockManagerImpl(CassandraFig cassandraFig,
@@ -80,13 +81,35 @@ public class AstyanaxLockManagerImpl implements LockManager {
consistencyLevel = ConsistencyLevel.valueOf(cassandraFig.getLocksCl());
}catch(IllegalArgumentException e){
+ logger.warn( "Property {} value provided: {} is not valid", CassandraFig.LOCKS_CL,
+ cassandraFig.getLocksCl() );
+
// just default it to local quorum if we can't parse
consistencyLevel = ConsistencyLevel.CL_LOCAL_QUORUM;
}
+
+ int lockExpiration;
+ int lockConfigExpiration = cassandraFig.getLocksExpiration();
+ if( lockConfigExpiration >= MINIMUM_LOCK_EXPIRATION ){
+
+ lockExpiration = Math.min(cassandraFig.getLocksExpiration(), Integer.MAX_VALUE);
+
+ }else{
+
+ logger.warn("Property {} is not valid. Choose a value greater than or equal to {}",
+ CassandraFig.LOCKS_EXPIRATION,
+ MINIMUM_LOCK_EXPIRATION);
+
+ // use the default if seomthing below the minimum is provided
+ lockExpiration = Integer.valueOf(CassandraFig.DEFAULT_LOCKS_EXPIRATION);
+ }
+
+
+
ColumnPrefixDistributedRowLock<String> lock =
new ColumnPrefixDistributedRowLock<>(keyspace, columnFamily, lockPath)
- .expireLockAfter( Integer.MAX_VALUE, TimeUnit.MILLISECONDS)
+ .expireLockAfter( lockExpiration, TimeUnit.MILLISECONDS)
.withConsistencyLevel(consistencyLevel);
http://git-wip-us.apache.org/repos/asf/usergrid/blob/4945b6f2/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
index caee5c1..e30ba9c 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
@@ -46,11 +46,14 @@ public interface CassandraFig extends GuicyFig {
String LOCKS_CL = "cassandra.lock.cl";
String LOCKS_SHARED_POOL_FLAG = "cassandra.lock.use_shared_pool";
String LOCKS_CONNECTIONS = "cassandra.lock.connections";
+ String LOCKS_EXPIRATION = "cassandra.lock.expiration.milliseconds";
+
// re-usable default values
String DEFAULT_CONNECTION_POOLSIZE = "15";
+ String DEFAULT_LOCKS_EXPIRATION = "3600000"; // 1 hour
@Key( "cassandra.hosts" )
@@ -162,4 +165,11 @@ public interface CassandraFig extends GuicyFig {
@Default( "org.apache.cassandra.locator.SimpleStrategy" )
String getLocksKeyspaceStrategy();
+ /**
+ * Return the expiration that should be used for expiring a lock if it's not released
+ */
+ @Key( LOCKS_EXPIRATION )
+ @Default(DEFAULT_LOCKS_EXPIRATION)
+ int getLocksExpiration();
+
}
[07/12] usergrid git commit: Fix Astyanax locking to be re-entrant as
Hector locks were and possible UG code expects it to be. Remove all reference
of Hector locks, changing its existing test to work with Astyanax.
Posted by gr...@apache.org.
Fix Astyanax locking to be re-entrant as Hector locks were and possible UG code expects it to be. Remove all reference of Hector locks, changing its existing test to work with Astyanax.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/973f5a70
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/973f5a70
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/973f5a70
Branch: refs/heads/master
Commit: 973f5a70c9cab0fdd5006684d3def8e18f962b51
Parents: d1c1d01
Author: Michael Russo <mi...@gmail.com>
Authored: Thu Jan 14 15:30:52 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Thu Jan 14 15:30:52 2016 -0800
----------------------------------------------------------------------
.../locking/cassandra/AstyanaxLockImpl.java | 31 +++-
.../cassandra/AstyanaxLockManagerImpl.java | 4 +-
.../locking/cassandra/HectorLockImpl.java | 86 ---------
.../cassandra/HectorLockManagerImpl.java | 142 --------------
.../usergrid/locking/AstyanaxLockManagerIT.java | 164 ++++++++++++++++
.../locking/SingleNodeLockTestSingleNode.java | 163 ++++++++++++++++
.../locking/cassandra/HectorLockManagerIT.java | 185 -------------------
.../SingleNodeLockTestSingleNode.java | 170 -----------------
.../test/resources/testApplicationContext.xml | 4 -
9 files changed, 352 insertions(+), 597 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/973f5a70/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockImpl.java
index 3c12d8a..1399d16 100644
--- a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockImpl.java
@@ -19,24 +19,24 @@ package org.apache.usergrid.locking.cassandra;
import com.netflix.astyanax.recipes.locks.ColumnPrefixDistributedRowLock;
+import com.netflix.astyanax.retry.RetryPolicy;
+import com.netflix.astyanax.retry.RunOnce;
import org.apache.usergrid.locking.Lock;
import org.apache.usergrid.locking.exception.UGLockException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
public class AstyanaxLockImpl implements Lock {
- private static final Logger logger = LoggerFactory.getLogger( AstyanaxLockImpl.class );
+ private AtomicInteger count = new AtomicInteger();
+ private ColumnPrefixDistributedRowLock lock;
-
- ColumnPrefixDistributedRowLock lock;
-
- public AstyanaxLockImpl(//AstyanaxLockManagerImpl lockManager,
- ColumnPrefixDistributedRowLock lock) {
+ public AstyanaxLockImpl( ColumnPrefixDistributedRowLock lock ) {
this.lock = lock;
@@ -45,21 +45,27 @@ public class AstyanaxLockImpl implements Lock {
@Override
public boolean tryLock( long timeout, TimeUnit time ) throws UGLockException {
- lock.withTtl( (int) timeout, time);
try {
+
lock.acquire();
- return true;
+ count.incrementAndGet();
+
} catch (Exception e) {
return false;
}
+
+ return true;
}
@Override
public void lock() throws UGLockException {
try {
+
lock.acquire();
+ count.incrementAndGet();
+
} catch (Exception e) {
throw new UGLockException("Unable to acquire lock with id: " + lock.getLockId());
}
@@ -68,8 +74,15 @@ public class AstyanaxLockImpl implements Lock {
@Override
public void unlock() throws UGLockException {
+ // all re-entrant locks to be used and only release them all when the count is 0
+ int current = count.decrementAndGet();
+
try {
- lock.release();
+
+ if ( current == 0 ) {
+ lock.release();
+ }
+
} catch (Exception e) {
throw new UGLockException("Unable to release lock with id: " + lock.getLockId());
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/973f5a70/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
index ece942f..1786d72 100644
--- a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
@@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
+import java.util.concurrent.TimeUnit;
public class AstyanaxLockManagerImpl implements LockManager {
@@ -72,7 +73,8 @@ public class AstyanaxLockManagerImpl implements LockManager {
String lockPath = LockPathBuilder.buildPath( applicationId, path );
ColumnPrefixDistributedRowLock<String> lock =
- new ColumnPrefixDistributedRowLock<>(keyspace, columnFamily, lockPath);
+ new ColumnPrefixDistributedRowLock<>(keyspace, columnFamily, lockPath)
+ .expireLockAfter( Integer.MAX_VALUE, TimeUnit.MILLISECONDS);
return new AstyanaxLockImpl( lock );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/973f5a70/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/HectorLockImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/HectorLockImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/HectorLockImpl.java
deleted file mode 100644
index 57b9b5c..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/HectorLockImpl.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.usergrid.locking.cassandra;
-
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.usergrid.locking.Lock;
-import org.apache.usergrid.locking.exception.UGLockException;
-
-import me.prettyprint.hector.api.locking.HLock;
-import me.prettyprint.hector.api.locking.HLockManager;
-import me.prettyprint.hector.api.locking.HLockTimeoutException;
-
-
-/** @author tnine */
-public class HectorLockImpl implements Lock {
-
- private HLock lock;
- private HLockManager lm;
- private AtomicInteger count = new AtomicInteger();
-
-
- /**
- *
- */
- public HectorLockImpl( HLock lock, HLockManager lm ) {
- this.lock = lock;
- this.lm = lm;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.locking.Lock#acquire(long, java.util.concurrent.TimeUnit)
- */
- @Override
- public boolean tryLock( long timeout, TimeUnit time ) throws UGLockException {
- try {
- lm.acquire( this.lock, time.toMillis( timeout ) );
- count.incrementAndGet();
- }
- catch ( HLockTimeoutException hlte ) {
- return false;
- }
-
- return true;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.locking.Lock#lock()
- */
- @Override
- public void lock() throws UGLockException {
- lm.acquire( lock );
- count.incrementAndGet();
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.locking.Lock#release()
- */
- @Override
- public void unlock() throws UGLockException {
- int current = count.decrementAndGet();
-
- if ( current == 0 ) {
- lm.release( this.lock );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/973f5a70/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/HectorLockManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/HectorLockManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/HectorLockManagerImpl.java
deleted file mode 100644
index ae7878a..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/HectorLockManagerImpl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.usergrid.locking.cassandra;
-
-
-import java.util.UUID;
-
-import javax.annotation.PostConstruct;
-
-import me.prettyprint.cassandra.locking.HLockManagerImpl;
-import me.prettyprint.hector.api.Cluster;
-import me.prettyprint.hector.api.ConsistencyLevelPolicy;
-import me.prettyprint.hector.api.locking.HLockManager;
-import me.prettyprint.hector.api.locking.HLockManagerConfigurator;
-
-import org.springframework.util.Assert;
-import org.apache.usergrid.locking.Lock;
-import org.apache.usergrid.locking.LockManager;
-import org.apache.usergrid.locking.LockPathBuilder;
-
-
-/**
- * Uses the hector based locking implementation to obtain locks
- *
- * @author tnine
- */
-public class HectorLockManagerImpl implements LockManager {
- private int replicationFactor = 1;
- private int numberOfLockObserverThreads = 1;
- private long lockTtl = 2000;
- private String keyspaceName;
- private Cluster cluster;
- private HLockManager lm;
- private ConsistencyLevelPolicy consistencyLevelPolicy;
-
-
- /**
- *
- */
- public HectorLockManagerImpl() {
- }
-
-
- @PostConstruct
- public void init() {
- HLockManagerConfigurator hlc = new HLockManagerConfigurator();
- hlc.setReplicationFactor( replicationFactor );
- hlc.setKeyspaceName( keyspaceName );
- hlc.setNumberOfLockObserverThreads( numberOfLockObserverThreads );
- hlc.setLocksTTLInMillis( lockTtl );
- lm = new HLockManagerImpl( cluster, hlc );
- if ( consistencyLevelPolicy != null ) {
- lm.getKeyspace().setConsistencyLevelPolicy(consistencyLevelPolicy);
- }
- // if consistencyLevelPolicy == null, use hector's default, which is QuorumAll, no need to explicitly set
- lm.init();
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.usergrid.locking.LockManager#createLock(java.util.UUID,
- * java.lang.String[])
- */
- @Override
- public Lock createLock( UUID applicationId, String... path ) {
-
- String lockPath = LockPathBuilder.buildPath( applicationId, path );
-
- return new HectorLockImpl( lm.createLock( lockPath ), lm );
- }
-
-
- /**
- * Note that in a real environment this MUST be an odd number. Locks are read and written at QUORUM. RF >= 3 is
- * preferred for failure tolerance and replication. Defaults to 1
- *
- * @param replicationFactor the replicationFactor to set
- */
- public void setReplicationFactor( int replicationFactor ) {
-
- Assert.isTrue( numberOfLockObserverThreads % 2 != 0, "You must specify an odd number for replication factor" );
-
- this.replicationFactor = replicationFactor;
- }
-
-
- /**
- * Set the number of threads the lock heartbeat executor uses. Must accommodate the total number of locks that may
- * exist in the system. Locks are always renewed at the ttl/2 time.
- *
- * @param numberOfLockObserverThreads the numberOfLockObserverThreads to set
- */
- public void setNumberOfLockObserverThreads( int numberOfLockObserverThreads ) {
- this.numberOfLockObserverThreads = numberOfLockObserverThreads;
- }
-
-
- /**
- * The amount of time a lock must not be renewed before it times out. Set in milliseconds. 2000 is the default
- *
- * @param lockTtl the lockTtl to set
- */
- public void setLockTtl( long lockTtl ) {
- this.lockTtl = lockTtl;
- }
-
-
- /** @param keyspaceName the keyspaceName to set */
- public void setKeyspaceName( String keyspaceName ) {
- this.keyspaceName = keyspaceName;
- }
-
-
- /** @param cluster the cluster to set */
- public void setCluster( Cluster cluster ) {
- this.cluster = cluster;
- }
-
-
- /**
- * @param consistencyLevelPolicy the consistencyLevelPolicy to set
- */
- public void setConsistencyLevelPolicy(ConsistencyLevelPolicy consistencyLevelPolicy) {
- this.consistencyLevelPolicy = consistencyLevelPolicy;
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/973f5a70/stack/core/src/test/java/org/apache/usergrid/locking/AstyanaxLockManagerIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/locking/AstyanaxLockManagerIT.java b/stack/core/src/test/java/org/apache/usergrid/locking/AstyanaxLockManagerIT.java
new file mode 100644
index 0000000..e95c0d5
--- /dev/null
+++ b/stack/core/src/test/java/org/apache/usergrid/locking/AstyanaxLockManagerIT.java
@@ -0,0 +1,164 @@
+/*
+ * 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.usergrid.locking;
+
+
+import org.apache.usergrid.AbstractCoreIT;
+import org.apache.usergrid.locking.exception.UGLockException;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.UUID;
+import java.util.concurrent.*;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+
+public class AstyanaxLockManagerIT extends AbstractCoreIT {
+ private static final Logger logger = LoggerFactory.getLogger( AstyanaxLockManagerIT.class );
+
+
+ private static LockManager lockManager;
+ private static ExecutorService pool;
+
+
+ @BeforeClass
+ public static void setup() throws Exception {
+
+ lockManager = setup.getInjector().getInstance(LockManager.class);
+ }
+
+
+
+ @BeforeClass
+ public static void start() {
+ // Create a different thread to lock the same node, that is held by the main thread.
+ pool = Executors.newFixedThreadPool( 1 );
+ }
+
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ pool.shutdownNow();
+ }
+
+
+ /** Locks a path and launches a thread which also locks the same path. */
+ @Test
+ public void testLock() throws InterruptedException, ExecutionException, UGLockException {
+ final UUID application = UUID.randomUUID();
+ final UUID entity = UUID.randomUUID();
+
+ logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
+
+ // Lock a node twice to test re-entrancy and validate.
+ Lock lock = lockManager.createLock( application, entity.toString() );
+ lock.lock();
+ lock.lock();
+
+ boolean wasLocked = lockInDifferentThread( application, entity );
+ Assert.assertEquals( false, wasLocked );
+
+ // Unlock once
+ lock.unlock();
+
+ // Try from the thread expecting to fail since we still hold one re-entrant lock.
+ wasLocked = lockInDifferentThread( application, entity );
+ assertFalse( wasLocked );
+
+ // Unlock completely
+ logger.info( "Releasing lock:" + application.toString() + "/" + entity.toString() );
+ lock.unlock();
+
+ // Try to effectively get the lock from the thread since the current one has
+ // already released it.
+ wasLocked = lockInDifferentThread( application, entity );
+ Assert.assertEquals( true, wasLocked );
+ }
+
+
+ /** Locks a couple of times and try to clean up. Later oin another thread successfully acquire the lock */
+ @Test
+ public void testLock2() throws InterruptedException, ExecutionException, UGLockException {
+ final UUID application = UUID.randomUUID();
+ final UUID entity = UUID.randomUUID();
+ final UUID entity2 = UUID.randomUUID();
+
+ logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
+
+ // Acquire to locks. One of them twice.
+ Lock lock = lockManager.createLock( application, entity.toString() );
+ lock.lock();
+ lock.lock();
+
+ Lock second = lockManager.createLock( application, entity2.toString() );
+ second.lock();
+
+ // Cleanup the locks for main thread
+ logger.info( "Cleaning up locks for current thread..." );
+ lock.unlock();
+ lock.unlock();
+
+ second.unlock();
+
+ boolean locked = lockInDifferentThread( application, entity );
+ assertTrue( locked );
+
+ locked = lockInDifferentThread( application, entity2 );
+ assertTrue( locked );
+ }
+
+
+ /** Acquires a lock in a different thread. */
+ private boolean lockInDifferentThread( final UUID application, final UUID entity ) {
+ Callable<Boolean> callable = new Callable<Boolean>() {
+ @Override
+ public Boolean call() throws Exception {
+ Lock lock = lockManager.createLock( application, entity.toString() );
+
+ // False here means that the lock WAS NOT ACQUIRED. And that is
+ // what we expect.
+ boolean locked = lock.tryLock( 0, TimeUnit.MILLISECONDS );
+
+ // shouldn't lock, so unlock to avoid polluting future tests
+ if ( locked ) {
+ lock.unlock();
+ }
+
+ return locked;
+ }
+ };
+
+ Future<Boolean> status = pool.submit( callable );
+
+ boolean wasLocked = true;
+
+ try {
+ wasLocked = status.get( 2, TimeUnit.SECONDS );
+ }
+ catch ( Exception e ) {
+ wasLocked = false;
+ }
+
+ return wasLocked;
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/973f5a70/stack/core/src/test/java/org/apache/usergrid/locking/SingleNodeLockTestSingleNode.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/locking/SingleNodeLockTestSingleNode.java b/stack/core/src/test/java/org/apache/usergrid/locking/SingleNodeLockTestSingleNode.java
new file mode 100644
index 0000000..ba7b48d
--- /dev/null
+++ b/stack/core/src/test/java/org/apache/usergrid/locking/SingleNodeLockTestSingleNode.java
@@ -0,0 +1,163 @@
+/*
+ * 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.usergrid.locking;
+
+
+import org.apache.usergrid.locking.exception.UGLockException;
+import org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.UUID;
+import java.util.concurrent.*;
+
+import static org.junit.Assert.assertTrue;
+
+
+public class SingleNodeLockTestSingleNode {
+
+ private static final Logger logger = LoggerFactory.getLogger( SingleNodeLockTestSingleNode.class );
+
+ private LockManager manager;
+
+ private ExecutorService pool;
+
+
+ @Before
+ public void setUp() throws Exception {
+
+ manager = new SingleNodeLockManagerImpl();
+
+ // Create a different thread to lock the same node, that is held by the main
+ // thread.
+ pool = Executors.newFixedThreadPool( 1 );
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+ pool.shutdownNow();
+ }
+
+
+ /** Locks a path and launches a thread which also locks the same path. */
+ @Test
+ public void testLock() throws InterruptedException, ExecutionException, UGLockException {
+
+ final UUID application = UUID.randomUUID();
+ final UUID entity = UUID.randomUUID();
+
+ logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
+
+ // Lock a node twice to test reentrancy and validate.
+ Lock lock = manager.createLock( application, entity.toString() );
+ lock.lock();
+ lock.lock();
+
+ boolean wasLocked = lockInDifferentThread( application, entity );
+ Assert.assertEquals( false, wasLocked );
+
+ // Unlock once
+ lock.unlock();
+
+ // Try from the thread expecting to fail since we still hold one reentrant
+ // lock.
+ wasLocked = lockInDifferentThread( application, entity );
+ Assert.assertEquals( false, wasLocked );
+
+ // Unlock completely
+ logger.info( "Releasing lock:" + application.toString() + "/" + entity.toString() );
+ lock.unlock();
+
+ // Try to effectively get the lock from the thread since the current one has
+ // already released it.
+ wasLocked = lockInDifferentThread( application, entity );
+ Assert.assertEquals( true, wasLocked );
+ }
+
+
+ /** Locks a couple of times and try to clean up. Later oin another thread successfully acquire the lock */
+ @Test
+ public void testLock2() throws InterruptedException, ExecutionException, UGLockException {
+
+ final UUID application = UUID.randomUUID();
+ final UUID entity = UUID.randomUUID();
+ final UUID entity2 = UUID.randomUUID();
+
+ logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
+
+ // Acquire to locks. One of them twice.
+ Lock lock = manager.createLock( application, entity.toString() );
+ lock.lock();
+ lock.lock();
+
+ Lock second = manager.createLock( application, entity2.toString() );
+ second.lock();
+
+ // Cleanup the locks for main thread
+ logger.info( "Cleaning up locks for current thread..." );
+ lock.unlock();
+ lock.unlock();
+
+ second.unlock();
+
+ boolean locked = lockInDifferentThread( application, entity );
+ assertTrue( locked );
+
+ locked = lockInDifferentThread( application, entity2 );
+ assertTrue( locked );
+ }
+
+
+ /** Acquires a lock in a different thread. */
+ private boolean lockInDifferentThread( final UUID application, final UUID entity ) {
+ Future<Boolean> status = pool.submit( new Callable<Boolean>() {
+
+ @Override
+ public Boolean call() throws Exception {
+
+ Lock lock = manager.createLock( application, entity.toString() );
+
+ // False here means that the lock WAS NOT ACQUIRED. And that is
+ // what we expect.
+
+ boolean locked = lock.tryLock( 0, TimeUnit.MILLISECONDS );
+
+ // shouldn't lock, so unlock to avoid polluting future tests
+ if ( locked ) {
+ lock.unlock();
+ }
+
+ return locked;
+ }
+ } );
+
+ boolean wasLocked = true;
+ try {
+ wasLocked = status.get( 2, TimeUnit.SECONDS );
+ }
+ catch ( Exception e ) {
+ wasLocked = false;
+ }
+
+ return wasLocked;
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/973f5a70/stack/core/src/test/java/org/apache/usergrid/locking/cassandra/HectorLockManagerIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/locking/cassandra/HectorLockManagerIT.java b/stack/core/src/test/java/org/apache/usergrid/locking/cassandra/HectorLockManagerIT.java
deleted file mode 100644
index 34b2154..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/locking/cassandra/HectorLockManagerIT.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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.usergrid.locking.cassandra;
-
-
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.usergrid.AbstractCoreIT;
-import org.apache.usergrid.locking.Lock;
-import org.apache.usergrid.locking.LockManager;
-import org.apache.usergrid.locking.exception.UGLockException;
-
-import me.prettyprint.cassandra.model.ConfigurableConsistencyLevel;
-import me.prettyprint.hector.api.ConsistencyLevelPolicy;
-import me.prettyprint.hector.api.HConsistencyLevel;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-
-public class HectorLockManagerIT extends AbstractCoreIT {
- private static final Logger logger = LoggerFactory.getLogger( HectorLockManagerIT.class );
-
- private static LockManager manager;
- private static ExecutorService pool;
-
-
- @BeforeClass
- public static void setup() throws Exception {
- HectorLockManagerImpl hlockManager = new HectorLockManagerImpl();
- hlockManager.setCluster( setup.getCassSvc().getCluster() );
- hlockManager.setKeyspaceName( "Locks_Test" );
- hlockManager.setLockTtl( 2000 );
- hlockManager.setNumberOfLockObserverThreads( 1 );
- hlockManager.setReplicationFactor( 1 );
- ConsistencyLevelPolicy consistencyLevel = new ConfigurableConsistencyLevel();
- ((ConfigurableConsistencyLevel) consistencyLevel).setDefaultReadConsistencyLevel(HConsistencyLevel.ONE);
- ((ConfigurableConsistencyLevel) consistencyLevel).setDefaultWriteConsistencyLevel(HConsistencyLevel.ONE);
- hlockManager.setConsistencyLevelPolicy(consistencyLevel);
- hlockManager.init();
-
- manager = hlockManager;
- }
-
-
- @BeforeClass
- public static void start() {
- // Create a different thread to lock the same node, that is held by the main thread.
- pool = Executors.newFixedThreadPool( 1 );
- }
-
-
- @AfterClass
- public static void tearDown() throws Exception {
- pool.shutdownNow();
- }
-
-
- /** Locks a path and launches a thread which also locks the same path. */
- @Test
- public void testLock() throws InterruptedException, ExecutionException, UGLockException {
- final UUID application = UUID.randomUUID();
- final UUID entity = UUID.randomUUID();
-
- logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
-
- // Lock a node twice to test re-entrancy and validate.
- Lock lock = manager.createLock( application, entity.toString() );
- lock.lock();
- lock.lock();
-
- boolean wasLocked = lockInDifferentThread( application, entity );
- Assert.assertEquals( false, wasLocked );
-
- // Unlock once
- lock.unlock();
-
- // Try from the thread expecting to fail since we still hold one re-entrant lock.
- wasLocked = lockInDifferentThread( application, entity );
- assertFalse( wasLocked );
-
- // Unlock completely
- logger.info( "Releasing lock:" + application.toString() + "/" + entity.toString() );
- lock.unlock();
-
- // Try to effectively get the lock from the thread since the current one has
- // already released it.
- wasLocked = lockInDifferentThread( application, entity );
- Assert.assertEquals( true, wasLocked );
- }
-
-
- /** Locks a couple of times and try to clean up. Later oin another thread successfully acquire the lock */
- @Test
- public void testLock2() throws InterruptedException, ExecutionException, UGLockException {
- final UUID application = UUID.randomUUID();
- final UUID entity = UUID.randomUUID();
- final UUID entity2 = UUID.randomUUID();
-
- logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
-
- // Acquire to locks. One of them twice.
- Lock lock = manager.createLock( application, entity.toString() );
- lock.lock();
- lock.lock();
-
- Lock second = manager.createLock( application, entity2.toString() );
- second.lock();
-
- // Cleanup the locks for main thread
- logger.info( "Cleaning up locks for current thread..." );
- lock.unlock();
- lock.unlock();
-
- second.unlock();
-
- boolean locked = lockInDifferentThread( application, entity );
- assertTrue( locked );
-
- locked = lockInDifferentThread( application, entity2 );
- assertTrue( locked );
- }
-
-
- /** Acquires a lock in a different thread. */
- private boolean lockInDifferentThread( final UUID application, final UUID entity ) {
- Callable<Boolean> callable = new Callable<Boolean>() {
- @Override
- public Boolean call() throws Exception {
- Lock lock = manager.createLock( application, entity.toString() );
-
- // False here means that the lock WAS NOT ACQUIRED. And that is
- // what we expect.
- boolean locked = lock.tryLock( 0, TimeUnit.MILLISECONDS );
-
- // shouldn't lock, so unlock to avoid polluting future tests
- if ( locked ) {
- lock.unlock();
- }
-
- return locked;
- }
- };
-
- Future<Boolean> status = pool.submit( callable );
-
- boolean wasLocked = true;
-
- try {
- wasLocked = status.get( 2, TimeUnit.SECONDS );
- }
- catch ( Exception e ) {
- wasLocked = false;
- }
-
- return wasLocked;
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/973f5a70/stack/core/src/test/java/org/apache/usergrid/locking/singlenode/SingleNodeLockTestSingleNode.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/locking/singlenode/SingleNodeLockTestSingleNode.java b/stack/core/src/test/java/org/apache/usergrid/locking/singlenode/SingleNodeLockTestSingleNode.java
deleted file mode 100644
index db1defd..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/locking/singlenode/SingleNodeLockTestSingleNode.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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.usergrid.locking.singlenode;
-
-
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.usergrid.locking.Lock;
-import org.apache.usergrid.locking.LockManager;
-import org.apache.usergrid.locking.exception.UGLockException;
-
-import static org.junit.Assert.assertTrue;
-
-
-public class SingleNodeLockTestSingleNode {
-
- private static final Logger logger = LoggerFactory.getLogger( SingleNodeLockTestSingleNode.class );
-
- private LockManager manager;
-
- private ExecutorService pool;
-
-
- @Before
- public void setUp() throws Exception {
-
- manager = new SingleNodeLockManagerImpl();
-
- // Create a different thread to lock the same node, that is held by the main
- // thread.
- pool = Executors.newFixedThreadPool( 1 );
- }
-
-
- @After
- public void tearDown() throws Exception {
- pool.shutdownNow();
- }
-
-
- /** Locks a path and launches a thread which also locks the same path. */
- @Test
- public void testLock() throws InterruptedException, ExecutionException, UGLockException {
-
- final UUID application = UUID.randomUUID();
- final UUID entity = UUID.randomUUID();
-
- logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
-
- // Lock a node twice to test reentrancy and validate.
- Lock lock = manager.createLock( application, entity.toString() );
- lock.lock();
- lock.lock();
-
- boolean wasLocked = lockInDifferentThread( application, entity );
- Assert.assertEquals( false, wasLocked );
-
- // Unlock once
- lock.unlock();
-
- // Try from the thread expecting to fail since we still hold one reentrant
- // lock.
- wasLocked = lockInDifferentThread( application, entity );
- Assert.assertEquals( false, wasLocked );
-
- // Unlock completely
- logger.info( "Releasing lock:" + application.toString() + "/" + entity.toString() );
- lock.unlock();
-
- // Try to effectively get the lock from the thread since the current one has
- // already released it.
- wasLocked = lockInDifferentThread( application, entity );
- Assert.assertEquals( true, wasLocked );
- }
-
-
- /** Locks a couple of times and try to clean up. Later oin another thread successfully acquire the lock */
- @Test
- public void testLock2() throws InterruptedException, ExecutionException, UGLockException {
-
- final UUID application = UUID.randomUUID();
- final UUID entity = UUID.randomUUID();
- final UUID entity2 = UUID.randomUUID();
-
- logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
-
- // Acquire to locks. One of them twice.
- Lock lock = manager.createLock( application, entity.toString() );
- lock.lock();
- lock.lock();
-
- Lock second = manager.createLock( application, entity2.toString() );
- second.lock();
-
- // Cleanup the locks for main thread
- logger.info( "Cleaning up locks for current thread..." );
- lock.unlock();
- lock.unlock();
-
- second.unlock();
-
- boolean locked = lockInDifferentThread( application, entity );
- assertTrue( locked );
-
- locked = lockInDifferentThread( application, entity2 );
- assertTrue( locked );
- }
-
-
- /** Acquires a lock in a different thread. */
- private boolean lockInDifferentThread( final UUID application, final UUID entity ) {
- Future<Boolean> status = pool.submit( new Callable<Boolean>() {
-
- @Override
- public Boolean call() throws Exception {
-
- Lock lock = manager.createLock( application, entity.toString() );
-
- // False here means that the lock WAS NOT ACQUIRED. And that is
- // what we expect.
-
- boolean locked = lock.tryLock( 0, TimeUnit.MILLISECONDS );
-
- // shouldn't lock, so unlock to avoid polluting future tests
- if ( locked ) {
- lock.unlock();
- }
-
- return locked;
- }
- } );
-
- boolean wasLocked = true;
- try {
- wasLocked = status.get( 2, TimeUnit.SECONDS );
- }
- catch ( Exception e ) {
- wasLocked = false;
- }
-
- return wasLocked;
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/973f5a70/stack/websocket/src/test/resources/testApplicationContext.xml
----------------------------------------------------------------------
diff --git a/stack/websocket/src/test/resources/testApplicationContext.xml b/stack/websocket/src/test/resources/testApplicationContext.xml
index 8363021..d92f4fb 100644
--- a/stack/websocket/src/test/resources/testApplicationContext.xml
+++ b/stack/websocket/src/test/resources/testApplicationContext.xml
@@ -102,10 +102,6 @@
<constructor-arg ref="cassandraCredentials" />
</bean>
- <!--
- <bean name="lockManager" class="org.apache.usergrid.locking.cassandra.HectorLockManagerImpl" />
- -->
-
<bean id="injector"
class="org.apache.usergrid.corepersistence.GuiceFactory">
</bean>
[03/12] usergrid git commit: Remove unused zookeeper lock manager.
Posted by gr...@apache.org.
Remove unused zookeeper lock manager.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/8849d8eb
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/8849d8eb
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/8849d8eb
Branch: refs/heads/master
Commit: 8849d8eb2cb443a70e4ad37c4dae119bb198ece4
Parents: 56eb80f
Author: Michael Russo <mi...@gmail.com>
Authored: Wed Jan 13 09:13:39 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Wed Jan 13 09:13:39 2016 -0800
----------------------------------------------------------------------
.../src/test/resources/usergrid-test.properties | 5 -
stack/core/pom.xml | 5 -
.../zookeeper/ZooKeeperLockManagerImpl.java | 115 --------
.../locking/zookeeper/ZookeeperLockImpl.java | 88 ------
.../main/resources/usergrid-core-context.xml | 8 -
.../zookeeper/AbstractZooKeeperTest.java | 127 ---------
.../usergrid/locking/zookeeper/ZooPut.java | 114 --------
.../zookeeper/ZookeeperLockManagerTest.java | 186 -------------
.../resources/usergrid-standalone.properties | 4 -
stack/pom.xml | 32 ---
.../test/resources/testApplicationContext.xml | 271 +++++++++----------
11 files changed, 135 insertions(+), 820 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8849d8eb/stack/config/src/test/resources/usergrid-test.properties
----------------------------------------------------------------------
diff --git a/stack/config/src/test/resources/usergrid-test.properties b/stack/config/src/test/resources/usergrid-test.properties
index 111c750..0824673 100644
--- a/stack/config/src/test/resources/usergrid-test.properties
+++ b/stack/config/src/test/resources/usergrid-test.properties
@@ -114,11 +114,6 @@ usergrid.binary.bucketname=usergrid-test-bucket
# Where to store temporary files
usergrid.temp.files=/tmp/usergrid
-# Zookeeper instances
-zookeeper.hosts=localhost:2180
-zookeeper.sessionTimeout = 3000
-zookeeper.maxAttempts = 3
-
swagger.basepath=http://localhost:8080
AWS_ACCESS_KEY_ID=
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8849d8eb/stack/core/pom.xml
----------------------------------------------------------------------
diff --git a/stack/core/pom.xml b/stack/core/pom.xml
index 7f7dcfb..ae9f915 100644
--- a/stack/core/pom.xml
+++ b/stack/core/pom.xml
@@ -177,11 +177,6 @@
<artifactId>commons-beanutils</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- </dependency>
-
<!-- SUN, Javax Package, and Other Commercial Dependencies -->
<dependency>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8849d8eb/stack/core/src/main/java/org/apache/usergrid/locking/zookeeper/ZooKeeperLockManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/zookeeper/ZooKeeperLockManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/zookeeper/ZooKeeperLockManagerImpl.java
deleted file mode 100644
index 018e639..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/locking/zookeeper/ZooKeeperLockManagerImpl.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.usergrid.locking.zookeeper;
-
-
-import java.util.UUID;
-
-import javax.annotation.PostConstruct;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.usergrid.locking.Lock;
-import org.apache.usergrid.locking.LockManager;
-import org.apache.usergrid.locking.LockPathBuilder;
-
-import com.netflix.curator.RetryPolicy;
-import com.netflix.curator.framework.CuratorFramework;
-import com.netflix.curator.framework.CuratorFrameworkFactory;
-import com.netflix.curator.framework.recipes.locks.InterProcessMutex;
-import com.netflix.curator.retry.ExponentialBackoffRetry;
-
-
-/** Implementation for Zookeeper service that handles global locks. */
-public final class ZooKeeperLockManagerImpl implements LockManager {
-
- private String hostPort;
-
- private int sessionTimeout = 2000;
-
- private int maxAttempts = 5;
-
- private CuratorFramework client;
-
-
- public ZooKeeperLockManagerImpl( String hostPort, int sessionTimeout, int maxAttemps ) {
- this.hostPort = hostPort;
- this.sessionTimeout = sessionTimeout;
- this.maxAttempts = maxAttemps;
- init();
- }
-
-
- public ZooKeeperLockManagerImpl() {
- }
-
-
- @PostConstruct
- public void init() {
- RetryPolicy retryPolicy = new ExponentialBackoffRetry( sessionTimeout, maxAttempts );
- client = CuratorFrameworkFactory.newClient( hostPort, retryPolicy );
- client.start();
- }
-
-
- protected static final Logger logger = LoggerFactory.getLogger( ZooKeeperLockManagerImpl.class );
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.usergrid.locking.LockManager#createLock(java.util.UUID,
- * java.lang.String[])
- */
- @Override
- public Lock createLock( UUID applicationId, String... path ) {
- String lockPath = LockPathBuilder.buildPath( applicationId, path );
-
-
- return new ZookeeperLockImpl( new InterProcessMutex( client, lockPath ) );
- }
-
-
- public String getHostPort() {
- return hostPort;
- }
-
-
- public void setHostPort( String hostPort ) {
- this.hostPort = hostPort;
- }
-
-
- public int getSessionTimeout() {
- return sessionTimeout;
- }
-
-
- public void setSessionTimeout( int sessionTimeout ) {
- this.sessionTimeout = sessionTimeout;
- }
-
-
- public int getMaxAttempts() {
- return maxAttempts;
- }
-
-
- public void setMaxAttempts( int maxAttemps ) {
- this.maxAttempts = maxAttemps;
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8849d8eb/stack/core/src/main/java/org/apache/usergrid/locking/zookeeper/ZookeeperLockImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/zookeeper/ZookeeperLockImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/zookeeper/ZookeeperLockImpl.java
deleted file mode 100644
index a4aab31..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/locking/zookeeper/ZookeeperLockImpl.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.usergrid.locking.zookeeper;
-
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.usergrid.locking.Lock;
-import org.apache.usergrid.locking.exception.UGLockException;
-
-import com.netflix.curator.framework.recipes.locks.InterProcessMutex;
-
-
-/**
- * Wrapper for locks using curator
- *
- * @author tnine
- */
-public class ZookeeperLockImpl implements Lock {
-
-
- private InterProcessMutex zkMutex;
-
-
- /**
- *
- */
- public ZookeeperLockImpl( InterProcessMutex zkMutex ) {
- this.zkMutex = zkMutex;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.locking.Lock#tryLock(long, java.util.concurrent.TimeUnit)
- */
- @Override
- public boolean tryLock( long timeout, TimeUnit time ) throws UGLockException {
-
- try {
- return zkMutex.acquire( timeout, time );
- }
- catch ( Exception e ) {
- throw new UGLockException( "Unable to obtain lock", e );
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.locking.Lock#lock()
- */
- @Override
- public void lock() throws UGLockException {
- try {
- zkMutex.acquire();
- }
- catch ( Exception e ) {
- throw new UGLockException( "Unable to obtain lock", e );
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.locking.Lock#unlock()
- */
- @Override
- public void unlock() throws UGLockException {
- try {
- zkMutex.release();
- }
- catch ( Exception e ) {
- throw new UGLockException( "Unable to obtain lock", e );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8849d8eb/stack/core/src/main/resources/usergrid-core-context.xml
----------------------------------------------------------------------
diff --git a/stack/core/src/main/resources/usergrid-core-context.xml b/stack/core/src/main/resources/usergrid-core-context.xml
index 57d4de7..dc52b70 100644
--- a/stack/core/src/main/resources/usergrid-core-context.xml
+++ b/stack/core/src/main/resources/usergrid-core-context.xml
@@ -88,14 +88,6 @@
<property name="defaultWriteConsistencyLevel" value="${cassandra.lock.writecl}"/>
</bean>
- <!-- zookeeper locks -->
- <!--
- <bean orgAppName="lockManager" class="org.apache.usergrid.locking.zookeeper.ZooKeeperLockManagerImpl" >
- <property orgAppName="hostPort" value="${zookeeper.url}"/>
- <property orgAppName="sessionTimeout" value="2000"/>
- <property orgAppName="maxAttempts" value="10"/>
- </bean> -->
-
<bean id="injector"
class="org.apache.usergrid.corepersistence.GuiceFactory">
</bean>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8849d8eb/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/AbstractZooKeeperTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/AbstractZooKeeperTest.java b/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/AbstractZooKeeperTest.java
deleted file mode 100644
index 9ff1a33..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/AbstractZooKeeperTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.usergrid.locking.zookeeper;
-
-
-import java.io.File;
-import java.net.InetSocketAddress;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServerMain;
-
-
-/** Base test class for ZooKeeper tests. */
-public abstract class AbstractZooKeeperTest {
-
- public static final String ZOO_KEEPER_HOST = "localhost:20181/";
-
- private static final Logger logger = LoggerFactory.getLogger( AbstractZooKeeperTest.class );
-
-
- static class ZKServerMain extends ZooKeeperServerMain {
- @Override
- public void shutdown() {
- super.shutdown();
- }
- }
-
-
- protected static ZKServerMain zkServer = new ZKServerMain();
-
- protected static File tmpDir = new File( "./zk_tmp" );
-
- protected int clientPort;
-
-
- @BeforeClass
- public static void before() throws Exception {
- // we don't call super.setUp
- System.setProperty( "zkHost", ZOO_KEEPER_HOST );
- Thread zooThread = new Thread() {
- @Override
- public void run() {
- ServerConfig config = null;
-
- config = new ServerConfig() {
- {
- clientPortAddress = new InetSocketAddress( "localhost", 20181 );
- dataDir = tmpDir.getAbsolutePath() + File.separator + "zookeeper/server1/data";
- dataLogDir = dataDir;
- // this.maxClientCnxns = 50;
- // this.tickTime = 2000;
- }
- };
-
- try {
- zkServer.runFromConfig( config );
- logger.info( "ZOOKEEPER EXIT" );
- }
- catch ( Throwable e ) {
- logger.error("Error on zkServer.runFromConfig", e);
- throw new RuntimeException( e );
- }
- }
- };
-
- zooThread.setDaemon( true );
- zooThread.start();
- Thread.sleep( 500 ); // pause for ZooKeeper to start
-
- buildZooKeeper();
-
- logger.info( "Zookeeper initialized." );
- }
-
-
- public static void buildZooKeeper() throws Exception {
- ZooPut zooPut = new ZooPut( ZOO_KEEPER_HOST.substring( 0, ZOO_KEEPER_HOST.indexOf( '/' ) ) );
- // TODO read a system property to get the app root path if
- // needed.
- // zooPut.makePath("/somepath");
- zooPut.close();
- }
-
-
- @AfterClass
- public static void after() throws Exception {
- zkServer.shutdown();
-
- // Remove test data.
- boolean deletedData = recurseDelete( tmpDir );
- if ( !deletedData ) {
- logger.warn( "Zk testing data was not removed properly. You need to" + "manually remove:" + tmpDir
- .getAbsolutePath() );
- }
- }
-
-
- public static boolean recurseDelete( File f ) {
- if ( f.isDirectory() ) {
- for ( File sub : f.listFiles() ) {
- if ( !recurseDelete( sub ) ) {
- return false;
- }
- }
- }
- return f.delete();
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8849d8eb/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/ZooPut.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/ZooPut.java b/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/ZooPut.java
deleted file mode 100644
index 5ef3b05..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/ZooPut.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.usergrid.locking.zookeeper;
-
-
-import java.io.IOException;
-
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.Watcher.Event.KeeperState;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.ZooKeeper;
-
-
-/** Util for uploading and updating files in ZooKeeper. */
-public class ZooPut implements Watcher {
-
- private ZooKeeper keeper;
-
- private boolean closeKeeper = true;
-
- private boolean connected = false;
-
-
- public ZooPut( String host ) throws IOException {
- keeper = new ZooKeeper( host, 10000, this );
- // TODO: nocommit: this is asynchronous - think about how to deal with
- // connection
- // lost, and other failures
- synchronized ( this ) {
- while ( !connected ) {
- try {
- this.wait();
- }
- catch ( InterruptedException e ) {
- // nocommit
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- }
-
-
- public ZooPut( ZooKeeper keeper ) throws IOException {
- this.closeKeeper = false;
- this.keeper = keeper;
- }
-
-
- public void close() throws InterruptedException {
- if ( closeKeeper ) {
- keeper.close();
- }
- }
-
-
- public void makePath( String path ) throws KeeperException, InterruptedException {
- makePath( path, CreateMode.PERSISTENT );
- }
-
-
- public void makePath( String path, CreateMode createMode ) throws KeeperException, InterruptedException {
- // nocommit
- System.out.println( "make:" + path );
-
- if ( path.startsWith( "/" ) ) {
- path = path.substring( 1, path.length() );
- }
- String[] paths = path.split( "/" );
- StringBuilder sbPath = new StringBuilder();
- for ( int i = 0; i < paths.length; i++ ) {
- String pathPiece = paths[i];
- sbPath.append("/").append(pathPiece);
- String currentPath = sbPath.toString();
- Object exists = keeper.exists( currentPath, null );
- if ( exists == null ) {
- CreateMode mode = CreateMode.PERSISTENT;
- if ( i == paths.length - 1 ) {
- mode = createMode;
- }
- keeper.create( currentPath, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, mode );
- }
- }
- }
-
-
- @Override
- public void process( WatchedEvent event ) {
- // nocommit: consider how we want to accomplish this
- if ( event.getState() == KeeperState.SyncConnected ) {
- synchronized ( this ) {
- connected = true;
- this.notify();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8849d8eb/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/ZookeeperLockManagerTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/ZookeeperLockManagerTest.java b/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/ZookeeperLockManagerTest.java
deleted file mode 100644
index c74f6f8..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/ZookeeperLockManagerTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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.usergrid.locking.zookeeper;
-
-
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.usergrid.locking.Lock;
-import org.apache.usergrid.locking.LockManager;
-import org.apache.usergrid.locking.exception.UGLockException;
-
-import net.jcip.annotations.NotThreadSafe;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-
-@NotThreadSafe
-public class ZookeeperLockManagerTest extends AbstractZooKeeperTest {
-
- private static final Logger logger = LoggerFactory.getLogger( ZookeeperLockManagerTest.class );
-
- private static LockManager manager;
-
- private static ExecutorService pool;
-
-
- @BeforeClass
- public static void setup() throws Exception {
-
- // AbstractZooKeeperTest.before();
-
- ZooKeeperLockManagerImpl lockImpl = new ZooKeeperLockManagerImpl();
- lockImpl.setHostPort( "localhost:20181" );
- lockImpl.setMaxAttempts( 1000 );
- lockImpl.setSessionTimeout( 2 );
-
- lockImpl.init();
-
- manager = lockImpl;
- }
-
-
- @Before
- public void start() {
- // Create a different thread to lock the same node, that is held by the main thread.
- pool = Executors.newFixedThreadPool( 1 );
- }
-
-
- @After
- public void tearDown() throws Exception {
- pool.shutdownNow();
- }
-
-
- /** Locks a path and launches a thread which also locks the same path. */
- @Test
- public void testLock() throws InterruptedException, ExecutionException, UGLockException {
-
- final UUID application = UUID.randomUUID();
- final UUID entity = UUID.randomUUID();
-
- logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
-
- // Lock a node twice to test reentrancy and validate.
- Lock lock = manager.createLock( application, entity.toString() );
- lock.lock();
- lock.lock();
-
- boolean wasLocked = lockInDifferentThread( application, entity );
- Assert.assertEquals( false, wasLocked );
-
- // Unlock once
- lock.unlock();
-
- // Try from the thread expecting to fail since we still hold one reentrant
- // lock.
- wasLocked = lockInDifferentThread( application, entity );
- assertFalse( wasLocked );
-
- // Unlock completely
- logger.info( "Releasing lock:" + application.toString() + "/" + entity.toString() );
- lock.unlock();
-
- // Try to effectively get the lock from the thread since the current one has
- // already released it.
- wasLocked = lockInDifferentThread( application, entity );
- Assert.assertEquals( true, wasLocked );
- }
-
-
- /** Locks a couple of times and try to clean up. Later oin another thread successfully acquire the lock */
- @Test
- public void testLock2() throws InterruptedException, ExecutionException, UGLockException {
-
- final UUID application = UUID.randomUUID();
- final UUID entity = UUID.randomUUID();
- final UUID entity2 = UUID.randomUUID();
-
- logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
-
- // Acquire to locks. One of them twice.
- Lock lock = manager.createLock( application, entity.toString() );
- lock.lock();
- lock.lock();
-
- Lock second = manager.createLock( application, entity2.toString() );
- second.lock();
-
- // Cleanup the locks for main thread
- logger.info( "Cleaning up locks for current thread..." );
- lock.unlock();
- lock.unlock();
- second.unlock();
-
- boolean locked = lockInDifferentThread( application, entity );
- assertTrue( locked );
-
- locked = lockInDifferentThread( application, entity2 );
- assertTrue( locked );
- }
-
-
- /** Acquires a lock in a different thread. */
- private boolean lockInDifferentThread( final UUID application, final UUID entity ) {
- Future<Boolean> status = pool.submit( new Callable<Boolean>() {
-
- @Override
- public Boolean call() throws Exception {
-
- Lock lock = manager.createLock( application, entity.toString() );
-
- // False here means that the lock WAS NOT ACQUIRED. And that is
- // what we expect.
-
- boolean locked = lock.tryLock( 0, TimeUnit.MILLISECONDS );
-
- // shouldn't lock, so unlock to avoid polluting future tests
- if ( locked ) {
- lock.unlock();
- }
-
- return locked;
- }
- } );
-
- boolean wasLocked = true;
- try {
- wasLocked = status.get( 2, TimeUnit.SECONDS );
- }
- catch ( Exception e ) {
- wasLocked = false;
- }
-
- return wasLocked;
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8849d8eb/stack/launcher/src/main/resources/usergrid-standalone.properties
----------------------------------------------------------------------
diff --git a/stack/launcher/src/main/resources/usergrid-standalone.properties b/stack/launcher/src/main/resources/usergrid-standalone.properties
index c81437a..86c183c 100644
--- a/stack/launcher/src/main/resources/usergrid-standalone.properties
+++ b/stack/launcher/src/main/resources/usergrid-standalone.properties
@@ -101,10 +101,6 @@ usergrid.sysadmin.approve.organizations=false
# Where to store temporary files
usergrid.temp.files=/tmp/usergrid
-# Zookeeper instances
-zookeeper.hosts=localhost:2180
-zookeeper.sessionTimeout = 3000
-zookeeper.maxAttempts = 3
#AWS_ACCESS_KEY_ID=
#AWS_ACCESS_KEY_SECRET=
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8849d8eb/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index e086295..802f7b5 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -551,38 +551,6 @@
</dependency>
<dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.4.5</version>
- <exclusions>
- <exclusion>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.jboss.netty</groupId>
- <artifactId>netty</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.4.4</version>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8849d8eb/stack/websocket/src/test/resources/testApplicationContext.xml
----------------------------------------------------------------------
diff --git a/stack/websocket/src/test/resources/testApplicationContext.xml b/stack/websocket/src/test/resources/testApplicationContext.xml
index eef74b4..8eccb74 100644
--- a/stack/websocket/src/test/resources/testApplicationContext.xml
+++ b/stack/websocket/src/test/resources/testApplicationContext.xml
@@ -1,136 +1,135 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:amq="http://activemq.apache.org/schema/core" xmlns:jms="http://www.springframework.org/schema/jms"
- xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
- http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
- http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.1.xsd
- http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
-
- <context:component-scan base-package="org.apache.usergrid.persistence" />
- <context:annotation-config />
-
- <bean id="properties"
- class="org.springframework.beans.factory.config.PropertiesFactoryBean">
- <property name="singleton" value="true" />
- <property name="ignoreResourceNotFound" value="true" />
- <property name="locations">
- <list>
- <value>classpath:/usergrid-default.properties</value>
- <value>classpath:/usergrid-test.properties</value>
- <value>${usergrid-custom-spring-test-properties}</value>
- </list>
- </property>
- </bean>
-
- <bean id="propertyPlaceholderConfigurer"
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="properties" ref="properties" />
- <property name="systemPropertiesModeName">
- <value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value>
- </property>
- </bean>
-
- <bean id="cassandraUseRemote" class="java.lang.Boolean">
- <constructor-arg value="${cassandra.use_remote}" />
- </bean>
- <bean id="cassandraLocalUrl" class="java.lang.String">
- <constructor-arg value="${cassandra.local.url}" />
- </bean>
- <bean id="cassandraRemoteUrl" class="java.lang.String">
- <constructor-arg value="${cassandra.remote.url}" />
- </bean>
- <bean id="cassandraUrl" class="java.lang.String">
- <constructor-arg
- value="#{cassandraUseRemote ? cassandraRemoteUrl : cassandraLocalUrl}" />
- </bean>
- <util:map id="cassandraCredentials" map-class="java.util.HashMap">
- <entry key="username" value="${cassandra.username}" />
- <entry key="password" value="${cassandra.password}" />
- </util:map>
-
- <bean id="realm" class="org.apache.usergrid.security.shiro.Realm">
- <property name="name" value="realm" />
- </bean>
-
- <bean id="securityManager" class="org.apache.shiro.mgt.DefaultSecurityManager">
- <property name="realm" ref="realm" />
- </bean>
-
- <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
-
- <bean
- class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
- <property name="staticMethod"
- value="org.apache.shiro.SecurityUtils.setSecurityManager" />
- <property name="arguments" ref="securityManager" />
- </bean>
-
- <!-- The Time Resolution used for the cluster -->
- <bean id="microsecondsTimeResolution"
- class="me.prettyprint.cassandra.service.clock.MicrosecondsClockResolution" />
-
- <bean id="cassandraHostConfigurator"
- class="me.prettyprint.cassandra.service.CassandraHostConfigurator">
- <constructor-arg ref="cassandraUrl" />
- <property name="clockResolution" ref="microsecondsTimeResolution" />
- </bean>
-
- <bean id="cassandraCluster" class="me.prettyprint.cassandra.service.ThriftCluster">
- <constructor-arg value="${cassandra.cluster}" />
- <constructor-arg ref="cassandraHostConfigurator" />
- <constructor-arg ref="cassandraCredentials" />
- </bean>
-
- <!-- bean name="lockManager" class="org.apache.usergrid.locking.zookeeper.ZooKeeperLockManagerImpl" /> -->
- <bean name="lockManager" class="org.apache.usergrid.locking.zookeeper.NoOpLockManagerImpl" />
-
- <bean id="cassandraService"
- class="org.apache.usergrid.persistence.cassandra.CassandraService" init-method="init">
- <constructor-arg ref="properties" />
- <constructor-arg ref="cassandraCluster" />
- <constructor-arg ref="cassandraHostConfigurator" />
- <constructor-arg ref="lockManager" />
- </bean>
-
- <bean id="entityManagerFactory"
- class="org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImpl">
- <constructor-arg ref="cassandraService" />
- </bean>
-
- <bean id="queueManagerFactory"
- class="org.apache.usergrid.mq.cassandra.QueueManagerFactoryImpl">
- <constructor-arg ref="cassandraService" />
- </bean>
-
- <bean id="serviceManagerFactory" class="org.apache.usergrid.services.ServiceManagerFactory">
- <constructor-arg>
- <ref bean="entityManagerFactory" />
- </constructor-arg>
- </bean>
-
- <bean id="tokenService" class="org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl"/>
-
- <bean id="managementService" class="org.apache.usergrid.management.cassandra.ManagementServiceImpl" />
-
-</beans>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:amq="http://activemq.apache.org/schema/core" xmlns:jms="http://www.springframework.org/schema/jms"
+ xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.1.xsd
+ http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+
+ <context:component-scan base-package="org.apache.usergrid.persistence" />
+ <context:annotation-config />
+
+ <bean id="properties"
+ class="org.springframework.beans.factory.config.PropertiesFactoryBean">
+ <property name="singleton" value="true" />
+ <property name="ignoreResourceNotFound" value="true" />
+ <property name="locations">
+ <list>
+ <value>classpath:/usergrid-default.properties</value>
+ <value>classpath:/usergrid-test.properties</value>
+ <value>${usergrid-custom-spring-test-properties}</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean id="propertyPlaceholderConfigurer"
+ class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="properties" ref="properties" />
+ <property name="systemPropertiesModeName">
+ <value>SYSTEM_PROPERTIES_MODE_OVERRIDE</value>
+ </property>
+ </bean>
+
+ <bean id="cassandraUseRemote" class="java.lang.Boolean">
+ <constructor-arg value="${cassandra.use_remote}" />
+ </bean>
+ <bean id="cassandraLocalUrl" class="java.lang.String">
+ <constructor-arg value="${cassandra.local.url}" />
+ </bean>
+ <bean id="cassandraRemoteUrl" class="java.lang.String">
+ <constructor-arg value="${cassandra.remote.url}" />
+ </bean>
+ <bean id="cassandraUrl" class="java.lang.String">
+ <constructor-arg
+ value="#{cassandraUseRemote ? cassandraRemoteUrl : cassandraLocalUrl}" />
+ </bean>
+ <util:map id="cassandraCredentials" map-class="java.util.HashMap">
+ <entry key="username" value="${cassandra.username}" />
+ <entry key="password" value="${cassandra.password}" />
+ </util:map>
+
+ <bean id="realm" class="org.apache.usergrid.security.shiro.Realm">
+ <property name="name" value="realm" />
+ </bean>
+
+ <bean id="securityManager" class="org.apache.shiro.mgt.DefaultSecurityManager">
+ <property name="realm" ref="realm" />
+ </bean>
+
+ <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
+
+ <bean
+ class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="staticMethod"
+ value="org.apache.shiro.SecurityUtils.setSecurityManager" />
+ <property name="arguments" ref="securityManager" />
+ </bean>
+
+ <!-- The Time Resolution used for the cluster -->
+ <bean id="microsecondsTimeResolution"
+ class="me.prettyprint.cassandra.service.clock.MicrosecondsClockResolution" />
+
+ <bean id="cassandraHostConfigurator"
+ class="me.prettyprint.cassandra.service.CassandraHostConfigurator">
+ <constructor-arg ref="cassandraUrl" />
+ <property name="clockResolution" ref="microsecondsTimeResolution" />
+ </bean>
+
+ <bean id="cassandraCluster" class="me.prettyprint.cassandra.service.ThriftCluster">
+ <constructor-arg value="${cassandra.cluster}" />
+ <constructor-arg ref="cassandraHostConfigurator" />
+ <constructor-arg ref="cassandraCredentials" />
+ </bean>
+
+ <bean name="lockManager" class="org.apache.usergrid.locking.cassandra.HectorLockManagerImpl" />
+
+ <bean id="cassandraService"
+ class="org.apache.usergrid.persistence.cassandra.CassandraService" init-method="init">
+ <constructor-arg ref="properties" />
+ <constructor-arg ref="cassandraCluster" />
+ <constructor-arg ref="cassandraHostConfigurator" />
+ <constructor-arg ref="lockManager" />
+ </bean>
+
+ <bean id="entityManagerFactory"
+ class="org.apache.usergrid.persistence.cassandra.EntityManagerFactoryImpl">
+ <constructor-arg ref="cassandraService" />
+ </bean>
+
+ <bean id="queueManagerFactory"
+ class="org.apache.usergrid.mq.cassandra.QueueManagerFactoryImpl">
+ <constructor-arg ref="cassandraService" />
+ </bean>
+
+ <bean id="serviceManagerFactory" class="org.apache.usergrid.services.ServiceManagerFactory">
+ <constructor-arg>
+ <ref bean="entityManagerFactory" />
+ </constructor-arg>
+ </bean>
+
+ <bean id="tokenService" class="org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl"/>
+
+ <bean id="managementService" class="org.apache.usergrid.management.cassandra.ManagementServiceImpl" />
+
+</beans>
[02/12] usergrid git commit: Fix typo in word 'tenant'.
Posted by gr...@apache.org.
Fix typo in word 'tenant'.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/56eb80f8
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/56eb80f8
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/56eb80f8
Branch: refs/heads/master
Commit: 56eb80f8119324e262eac8fd0a25e4c9a32087cf
Parents: c080b02
Author: Michael Russo <mi...@gmail.com>
Authored: Tue Jan 12 16:18:50 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Tue Jan 12 16:18:50 2016 -0800
----------------------------------------------------------------------
.../impl/ScopedCacheSerializationImpl.java | 12 +-
.../MvccEntitySerializationStrategyImpl.java | 14 +-
...vccEntitySerializationStrategyProxyImpl.java | 4 +-
.../MvccEntitySerializationStrategyV1Impl.java | 8 +-
.../MvccEntitySerializationStrategyV2Impl.java | 13 +-
.../MvccEntitySerializationStrategyV3Impl.java | 14 +-
.../MvccLogEntrySerializationProxyImpl.java | 4 +-
.../MvccLogEntrySerializationStrategyImpl.java | 6 +-
...MvccLogEntrySerializationStrategyV1Impl.java | 18 +--
...MvccLogEntrySerializationStrategyV2Impl.java | 18 +--
.../UniqueValueSerializationStrategyImpl.java | 28 ++--
...iqueValueSerializationStrategyProxyImpl.java | 4 +-
.../UniqueValueSerializationStrategyV1Impl.java | 31 ++---
.../UniqueValueSerializationStrategyV2Impl.java | 31 ++---
.../core/astyanax/MultiTenantColumnFamily.java | 47 +++++++
.../MultiTenantColumnFamilyDefinition.java | 138 +++++++++++++++++++
.../core/astyanax/MultiTennantColumnFamily.java | 47 -------
.../MultiTennantColumnFamilyDefinition.java | 138 -------------------
.../data/MigrationInfoSerializationImpl.java | 18 +--
.../core/migration/schema/Migration.java | 4 +-
.../migration/schema/MigrationManagerImpl.java | 9 +-
.../EdgeMetadataSerializationProxyImpl.java | 4 +-
.../impl/EdgeMetadataSerializationV1Impl.java | 36 ++---
.../impl/EdgeMetadataSerializationV2Impl.java | 36 ++---
.../impl/NodeSerializationImpl.java | 14 +-
.../impl/shard/EdgeColumnFamilies.java | 12 +-
.../shard/impl/EdgeShardSerializationImpl.java | 14 +-
.../impl/ShardedEdgeSerializationImpl.java | 58 ++++----
.../impl/shard/impl/ShardsColumnIterator.java | 15 +-
.../shard/impl/SizebasedEdgeColumnFamilies.java | 46 +++----
.../map/impl/MapSerializationImpl.java | 28 ++--
31 files changed, 424 insertions(+), 445 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/cache/src/main/java/org/apache/usergrid/persistence/cache/impl/ScopedCacheSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/cache/src/main/java/org/apache/usergrid/persistence/cache/impl/ScopedCacheSerializationImpl.java b/stack/corepersistence/cache/src/main/java/org/apache/usergrid/persistence/cache/impl/ScopedCacheSerializationImpl.java
index 1439bc5..22c304a 100644
--- a/stack/corepersistence/cache/src/main/java/org/apache/usergrid/persistence/cache/impl/ScopedCacheSerializationImpl.java
+++ b/stack/corepersistence/cache/src/main/java/org/apache/usergrid/persistence/cache/impl/ScopedCacheSerializationImpl.java
@@ -71,8 +71,8 @@ public class ScopedCacheSerializationImpl<K,V> implements ScopedCacheSerializati
private static final ObjectSerializer COLUMN_VALUE_SERIALIZER = ObjectSerializer.get();
- public static final MultiTennantColumnFamily<BucketScopedRowKey<String>, String> SCOPED_CACHE
- = new MultiTennantColumnFamily<>( "SCOPED_CACHE",
+ public static final MultiTenantColumnFamily<BucketScopedRowKey<String>, String> SCOPED_CACHE
+ = new MultiTenantColumnFamily<>( "SCOPED_CACHE",
BUCKET_ROWKEY_SERIALIZER, COLUMN_NAME_SERIALIZER, COLUMN_VALUE_SERIALIZER );
/** Number of buckets to hash across */
@@ -278,13 +278,13 @@ public class ScopedCacheSerializationImpl<K,V> implements ScopedCacheSerializati
//------------------------------------------------------------------------------------------
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
- final MultiTennantColumnFamilyDefinition scopedCache =
- new MultiTennantColumnFamilyDefinition( SCOPED_CACHE,
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
+ final MultiTenantColumnFamilyDefinition scopedCache =
+ new MultiTenantColumnFamilyDefinition( SCOPED_CACHE,
BytesType.class.getSimpleName(),
BytesType.class.getSimpleName(),
BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
return Arrays.asList(scopedCache);
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
index 457664f..fefb303 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImpl.java
@@ -43,8 +43,8 @@ import org.apache.usergrid.persistence.collection.serialization.impl.util.Legacy
import org.apache.usergrid.persistence.core.astyanax.CassandraFig;
import org.apache.usergrid.persistence.core.astyanax.ColumnNameIterator;
import org.apache.usergrid.persistence.core.astyanax.ColumnParser;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.model.entity.Entity;
@@ -81,7 +81,7 @@ public abstract class MvccEntitySerializationStrategyImpl implements MvccEntityS
protected final Keyspace keyspace;
protected final SerializationFig serializationFig;
protected final CassandraFig cassandraFig;
- private final MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> columnFamily;
+ private final MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> columnFamily;
@Inject
@@ -333,10 +333,10 @@ public abstract class MvccEntitySerializationStrategyImpl implements MvccEntityS
//create the CF entity data. We want it reversed b/c we want the most recent version at the top of the
//row for fast seeks
- MultiTennantColumnFamilyDefinition cf =
- new MultiTennantColumnFamilyDefinition( columnFamily, BytesType.class.getSimpleName(),
+ MultiTenantColumnFamilyDefinition cf =
+ new MultiTenantColumnFamilyDefinition( columnFamily, BytesType.class.getSimpleName(),
ReversedType.class.getSimpleName() + "(" + UUIDType.class.getSimpleName() + ")",
- BytesType.class.getSimpleName(), MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ BytesType.class.getSimpleName(), MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
return Collections.singleton( cf );
@@ -446,6 +446,6 @@ public abstract class MvccEntitySerializationStrategyImpl implements MvccEntityS
* Get the column family to perform operations with
* @return
*/
- protected abstract MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> getColumnFamily();
+ protected abstract MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> getColumnFamily();
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyImpl.java
index b45f68b..1fe342e 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyImpl.java
@@ -26,7 +26,7 @@ import org.apache.usergrid.persistence.collection.EntitySet;
import org.apache.usergrid.persistence.collection.MvccEntity;
import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
import org.apache.usergrid.persistence.collection.serialization.impl.migration.CollectionMigrationPlugin;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.migration.data.MigrationInfoCache;
import org.apache.usergrid.persistence.core.migration.data.MigrationRelationship;
import org.apache.usergrid.persistence.core.migration.data.VersionedMigrationSet;
@@ -182,7 +182,7 @@ public class MvccEntitySerializationStrategyProxyImpl implements MvccEntitySeria
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
return Collections.emptyList();
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
index 40054ec..9e29e9c 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
@@ -28,7 +28,7 @@ import org.apache.usergrid.persistence.collection.exception.DataCorruptionExcept
import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
import org.apache.usergrid.persistence.core.astyanax.CassandraFig;
import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.model.entity.Entity;
import org.apache.usergrid.persistence.model.entity.Id;
@@ -64,8 +64,8 @@ public class MvccEntitySerializationStrategyV1Impl extends MvccEntitySerializati
new CollectionScopedRowKeySerializer<>( ID_SER );
- private static final MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> CF_ENTITY_DATA =
- new MultiTennantColumnFamily<>( "Entity_Version_Data", ROW_KEY_SER, UUIDSerializer.get() );
+ private static final MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> CF_ENTITY_DATA =
+ new MultiTenantColumnFamily<>( "Entity_Version_Data", ROW_KEY_SER, UUIDSerializer.get() );
@@ -82,7 +82,7 @@ public class MvccEntitySerializationStrategyV1Impl extends MvccEntitySerializati
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> getColumnFamily() {
+ protected MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> getColumnFamily() {
return CF_ENTITY_DATA;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2Impl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2Impl.java
index 26ec5ec..13d9613 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV2Impl.java
@@ -25,8 +25,6 @@ import java.util.UUID;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Timer;
-import com.fasterxml.jackson.core.Version;
-import com.fasterxml.jackson.databind.module.SimpleModule;
import org.apache.usergrid.persistence.collection.MvccEntity;
import org.apache.usergrid.persistence.collection.exception.DataCorruptionException;
import org.apache.usergrid.persistence.collection.exception.EntityTooLargeException;
@@ -37,7 +35,7 @@ import org.apache.usergrid.persistence.core.astyanax.FieldBufferBuilder;
import org.apache.usergrid.persistence.core.astyanax.FieldBufferParser;
import org.apache.usergrid.persistence.core.astyanax.FieldBufferSerializer;
import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
import org.apache.usergrid.persistence.model.entity.Entity;
@@ -52,9 +50,6 @@ import com.google.inject.Singleton;
import com.netflix.astyanax.Keyspace;
import com.netflix.astyanax.serializers.AbstractSerializer;
import com.netflix.astyanax.serializers.UUIDSerializer;
-import org.apache.usergrid.persistence.model.field.ArrayField;
-import org.apache.usergrid.persistence.model.field.ListField;
-import org.codehaus.jackson.map.deser.CustomDeserializerFactory;
/**
@@ -71,8 +66,8 @@ public class MvccEntitySerializationStrategyV2Impl extends MvccEntitySerializati
new CollectionScopedRowKeySerializer<>( ID_SER );
- private static final MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> CF_ENTITY_DATA =
- new MultiTennantColumnFamily<>( "Entity_Version_Data_V2", ROW_KEY_SER, UUIDSerializer.get() );
+ private static final MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> CF_ENTITY_DATA =
+ new MultiTenantColumnFamily<>( "Entity_Version_Data_V2", ROW_KEY_SER, UUIDSerializer.get() );
private static final FieldBufferSerializer FIELD_BUFFER_SERIALIZER = FieldBufferSerializer.get();
@@ -94,7 +89,7 @@ public class MvccEntitySerializationStrategyV2Impl extends MvccEntitySerializati
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> getColumnFamily() {
+ protected MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> getColumnFamily() {
return CF_ENTITY_DATA;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
index 0fd82cc..f552a97 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
@@ -34,8 +34,8 @@ import org.apache.usergrid.persistence.collection.serialization.SerializationFig
import org.apache.usergrid.persistence.core.astyanax.CassandraFig;
import org.apache.usergrid.persistence.core.astyanax.ColumnParser;
import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKeySerializer;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -75,8 +75,8 @@ public class MvccEntitySerializationStrategyV3Impl implements MvccEntitySerializ
private static final ScopedRowKeySerializer<Id> ROW_KEY_SER = new ScopedRowKeySerializer<>( ID_SER );
- private static final MultiTennantColumnFamily<ScopedRowKey<Id>, Boolean> CF_ENTITY_DATA =
- new MultiTennantColumnFamily<>( "Entity_Version_Data_V3", ROW_KEY_SER, BooleanSerializer.get() );
+ private static final MultiTenantColumnFamily<ScopedRowKey<Id>, Boolean> CF_ENTITY_DATA =
+ new MultiTenantColumnFamily<>( "Entity_Version_Data_V3", ROW_KEY_SER, BooleanSerializer.get() );
private static final Boolean COL_VALUE = Boolean.TRUE;
@@ -295,10 +295,10 @@ public class MvccEntitySerializationStrategyV3Impl implements MvccEntitySerializ
//create the CF entity data. We want it reversed b/c we want the most recent version at the top of the
//row for fast seeks
- MultiTennantColumnFamilyDefinition cf =
- new MultiTennantColumnFamilyDefinition( CF_ENTITY_DATA, BytesType.class.getSimpleName(),
+ MultiTenantColumnFamilyDefinition cf =
+ new MultiTenantColumnFamilyDefinition( CF_ENTITY_DATA, BytesType.class.getSimpleName(),
BooleanType.class.getSimpleName() ,
- BytesType.class.getSimpleName(), MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ BytesType.class.getSimpleName(), MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
return Collections.singleton( cf );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationProxyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationProxyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationProxyImpl.java
index fdef3c3..8e34f01 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationProxyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationProxyImpl.java
@@ -29,7 +29,7 @@ import org.apache.usergrid.persistence.collection.MvccLogEntry;
import org.apache.usergrid.persistence.collection.VersionSet;
import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
import org.apache.usergrid.persistence.collection.serialization.impl.migration.CollectionMigrationPlugin;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.migration.data.MigrationInfoCache;
import org.apache.usergrid.persistence.core.migration.data.MigrationRelationship;
import org.apache.usergrid.persistence.core.migration.data.VersionedMigrationSet;
@@ -142,7 +142,7 @@ public class MvccLogEntrySerializationProxyImpl implements MvccLogEntrySerializa
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
return Collections.emptyList();
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
index 0c0d961..7ba6a5e 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyImpl.java
@@ -37,7 +37,7 @@ import org.apache.usergrid.persistence.collection.mvcc.entity.Stage;
import org.apache.usergrid.persistence.collection.mvcc.entity.impl.MvccLogEntryImpl;
import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.model.entity.Id;
@@ -64,7 +64,7 @@ public abstract class MvccLogEntrySerializationStrategyImpl<K> implements MvccLo
private static final StageSerializer SER = new StageSerializer();
- private final MultiTennantColumnFamily<ScopedRowKey<K>, UUID> CF_ENTITY_LOG;
+ private final MultiTenantColumnFamily<ScopedRowKey<K>, UUID> CF_ENTITY_LOG;
protected final Keyspace keyspace;
@@ -289,7 +289,7 @@ public abstract class MvccLogEntrySerializationStrategyImpl<K> implements MvccLo
}
- protected abstract MultiTennantColumnFamily<ScopedRowKey<K>, UUID> getColumnFamily();
+ protected abstract MultiTenantColumnFamily<ScopedRowKey<K>, UUID> getColumnFamily();
protected abstract ScopedRowKey<K> createKey( final Id applicationId, final Id entityId );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyV1Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyV1Impl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyV1Impl.java
index 57e7421..e0c0909 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyV1Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyV1Impl.java
@@ -32,8 +32,8 @@ import org.apache.cassandra.db.marshal.UUIDType;
import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
import org.apache.usergrid.persistence.collection.serialization.impl.util.LegacyScopeUtils;
import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.model.entity.Id;
@@ -56,8 +56,8 @@ public class MvccLogEntrySerializationStrategyV1Impl
private static final CollectionScopedRowKeySerializer<Id> ROW_KEY_SER =
new CollectionScopedRowKeySerializer<Id>( ID_SER );
- private static final MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> CF_ENTITY_LOG =
- new MultiTennantColumnFamily<>( "Entity_Log", ROW_KEY_SER, UUIDSerializer.get() );
+ private static final MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> CF_ENTITY_LOG =
+ new MultiTenantColumnFamily<>( "Entity_Log", ROW_KEY_SER, UUIDSerializer.get() );
@Inject
@@ -73,7 +73,7 @@ public class MvccLogEntrySerializationStrategyV1Impl
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> getColumnFamily() {
+ protected MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UUID> getColumnFamily() {
return CF_ENTITY_LOG;
}
@@ -104,13 +104,13 @@ public class MvccLogEntrySerializationStrategyV1Impl
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
//create the CF entity data. We want it reversed b/c we want the most recent version at the top of the
//row for fast seeks
- MultiTennantColumnFamilyDefinition cf =
- new MultiTennantColumnFamilyDefinition( CF_ENTITY_LOG, BytesType.class.getSimpleName(),
+ MultiTenantColumnFamilyDefinition cf =
+ new MultiTenantColumnFamilyDefinition( CF_ENTITY_LOG, BytesType.class.getSimpleName(),
ReversedType.class.getSimpleName() + "(" + UUIDType.class.getSimpleName() + ")",
- IntegerType.class.getSimpleName(), MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ IntegerType.class.getSimpleName(), MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
return Collections.singleton( cf );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyV2Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyV2Impl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyV2Impl.java
index 99cc97f..1bfc289 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyV2Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccLogEntrySerializationStrategyV2Impl.java
@@ -31,8 +31,8 @@ import org.apache.cassandra.db.marshal.UUIDType;
import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKeySerializer;
import org.apache.usergrid.persistence.model.entity.Id;
@@ -55,8 +55,8 @@ public class MvccLogEntrySerializationStrategyV2Impl extends MvccLogEntrySeriali
private static final ScopedRowKeySerializer<Id> ROW_KEY_SER = new ScopedRowKeySerializer<>( ID_SER );
- private static final MultiTennantColumnFamily<ScopedRowKey<Id>, UUID> CF_ENTITY_LOG_V2 =
- new MultiTennantColumnFamily<>( "Entity_Log_V2", ROW_KEY_SER, UUIDSerializer.get() );
+ private static final MultiTenantColumnFamily<ScopedRowKey<Id>, UUID> CF_ENTITY_LOG_V2 =
+ new MultiTenantColumnFamily<>( "Entity_Log_V2", ROW_KEY_SER, UUIDSerializer.get() );
@Inject
@@ -72,7 +72,7 @@ public class MvccLogEntrySerializationStrategyV2Impl extends MvccLogEntrySeriali
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<Id>, UUID> getColumnFamily() {
+ protected MultiTenantColumnFamily<ScopedRowKey<Id>, UUID> getColumnFamily() {
return CF_ENTITY_LOG_V2;
}
@@ -92,13 +92,13 @@ public class MvccLogEntrySerializationStrategyV2Impl extends MvccLogEntrySeriali
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
//create the CF entity data. We want it reversed b/c we want the most recent version at the top of the
//row for fast seeks
- MultiTennantColumnFamilyDefinition cf =
- new MultiTennantColumnFamilyDefinition( CF_ENTITY_LOG_V2, BytesType.class.getSimpleName(),
+ MultiTenantColumnFamilyDefinition cf =
+ new MultiTenantColumnFamilyDefinition( CF_ENTITY_LOG_V2, BytesType.class.getSimpleName(),
ReversedType.class.getSimpleName() + "(" + UUIDType.class.getSimpleName() + ")",
- IntegerType.class.getSimpleName(), MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ IntegerType.class.getSimpleName(), MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
return Collections.singleton( cf );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
index a1fb4cc..781490d 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyImpl.java
@@ -34,13 +34,12 @@ import org.apache.usergrid.persistence.collection.serialization.SerializationFig
import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
import org.apache.usergrid.persistence.collection.serialization.UniqueValueSet;
-import org.apache.usergrid.persistence.collection.serialization.impl.util.LegacyScopeUtils;
import org.apache.usergrid.persistence.core.astyanax.CassandraFig;
import org.apache.usergrid.persistence.core.astyanax.ColumnNameIterator;
import org.apache.usergrid.persistence.core.astyanax.ColumnParser;
import org.apache.usergrid.persistence.core.astyanax.ColumnTypes;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
import org.apache.usergrid.persistence.core.util.ValidationUtils;
@@ -48,7 +47,6 @@ import org.apache.usergrid.persistence.model.entity.Id;
import org.apache.usergrid.persistence.model.field.Field;
import com.google.common.base.Preconditions;
-import com.google.inject.Inject;
import com.netflix.astyanax.ColumnListMutation;
import com.netflix.astyanax.Keyspace;
import com.netflix.astyanax.MutationBatch;
@@ -69,11 +67,11 @@ public abstract class UniqueValueSerializationStrategyImpl<FieldKey, EntityKey>
private static final Logger log = LoggerFactory.getLogger( UniqueValueSerializationStrategyImpl.class );
- private final MultiTennantColumnFamily<ScopedRowKey<FieldKey>, EntityVersion>
+ private final MultiTenantColumnFamily<ScopedRowKey<FieldKey>, EntityVersion>
CF_UNIQUE_VALUES;
- private final MultiTennantColumnFamily<ScopedRowKey<EntityKey>, UniqueFieldEntry>
+ private final MultiTenantColumnFamily<ScopedRowKey<EntityKey>, UniqueFieldEntry>
CF_ENTITY_UNIQUE_VALUE_LOG ;
public static final int COL_VALUE = 0x0;
@@ -367,17 +365,17 @@ public abstract class UniqueValueSerializationStrategyImpl<FieldKey, EntityKey>
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
- final MultiTennantColumnFamilyDefinition uniqueLookupCF =
- new MultiTennantColumnFamilyDefinition( CF_UNIQUE_VALUES, BytesType.class.getSimpleName(),
+ final MultiTenantColumnFamilyDefinition uniqueLookupCF =
+ new MultiTenantColumnFamilyDefinition( CF_UNIQUE_VALUES, BytesType.class.getSimpleName(),
ColumnTypes.DYNAMIC_COMPOSITE_TYPE, BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
- final MultiTennantColumnFamilyDefinition uniqueLogCF =
- new MultiTennantColumnFamilyDefinition( CF_ENTITY_UNIQUE_VALUE_LOG, BytesType.class.getSimpleName(),
+ final MultiTenantColumnFamilyDefinition uniqueLogCF =
+ new MultiTenantColumnFamilyDefinition( CF_ENTITY_UNIQUE_VALUE_LOG, BytesType.class.getSimpleName(),
ColumnTypes.DYNAMIC_COMPOSITE_TYPE, BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
return Arrays.asList( uniqueLookupCF, uniqueLogCF );
}
@@ -386,7 +384,7 @@ public abstract class UniqueValueSerializationStrategyImpl<FieldKey, EntityKey>
/**
* Get the column family for the unique fields
*/
- protected abstract MultiTennantColumnFamily<ScopedRowKey<FieldKey>, EntityVersion> getUniqueValuesCF();
+ protected abstract MultiTenantColumnFamily<ScopedRowKey<FieldKey>, EntityVersion> getUniqueValuesCF();
/**
@@ -409,7 +407,7 @@ public abstract class UniqueValueSerializationStrategyImpl<FieldKey, EntityKey>
/**
* Get the column family for the unique field CF
*/
- protected abstract MultiTennantColumnFamily<ScopedRowKey<EntityKey>, UniqueFieldEntry> getEntityUniqueLogCF();
+ protected abstract MultiTenantColumnFamily<ScopedRowKey<EntityKey>, UniqueFieldEntry> getEntityUniqueLogCF();
/**
* Generate a key that is compatible with the column family
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyProxyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyProxyImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyProxyImpl.java
index 3b15142..1de4052 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyProxyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyProxyImpl.java
@@ -28,7 +28,7 @@ import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
import org.apache.usergrid.persistence.collection.serialization.UniqueValueSet;
import org.apache.usergrid.persistence.collection.serialization.impl.migration.CollectionMigrationPlugin;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.migration.data.MigrationInfoCache;
import org.apache.usergrid.persistence.core.migration.data.MigrationRelationship;
import org.apache.usergrid.persistence.core.migration.data.VersionedMigrationSet;
@@ -167,7 +167,7 @@ public class UniqueValueSerializationStrategyProxyImpl implements UniqueValueSer
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
return Collections.emptyList();
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV1Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV1Impl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV1Impl.java
index 6551f5d..6a1cb58 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV1Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV1Impl.java
@@ -26,13 +26,12 @@ import java.util.Collection;
import org.apache.cassandra.db.marshal.BytesType;
import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
-import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
import org.apache.usergrid.persistence.collection.serialization.impl.util.LegacyScopeUtils;
import org.apache.usergrid.persistence.core.astyanax.CassandraFig;
import org.apache.usergrid.persistence.core.astyanax.ColumnTypes;
import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.model.entity.Id;
import org.apache.usergrid.persistence.model.field.Field;
@@ -54,8 +53,8 @@ public class UniqueValueSerializationStrategyV1Impl extends UniqueValueSerializ
private static final EntityVersionSerializer ENTITY_VERSION_SER = new EntityVersionSerializer();
- private static final MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Field>>, EntityVersion>
- CF_UNIQUE_VALUES = new MultiTennantColumnFamily<>( "Unique_Values", ROW_KEY_SER, ENTITY_VERSION_SER );
+ private static final MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Field>>, EntityVersion>
+ CF_UNIQUE_VALUES = new MultiTenantColumnFamily<>( "Unique_Values", ROW_KEY_SER, ENTITY_VERSION_SER );
private static final IdRowCompositeSerializer ID_SER = IdRowCompositeSerializer.get();
@@ -65,9 +64,9 @@ public class UniqueValueSerializationStrategyV1Impl extends UniqueValueSerializ
new CollectionScopedRowKeySerializer<>( ID_SER );
- private static final MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UniqueFieldEntry>
+ private static final MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UniqueFieldEntry>
CF_ENTITY_UNIQUE_VALUE_LOG =
- new MultiTennantColumnFamily<>( "Entity_Unique_Values", ENTITY_ROW_KEY_SER, UniqueFieldEntrySerializer.get() );
+ new MultiTenantColumnFamily<>( "Entity_Unique_Values", ENTITY_ROW_KEY_SER, UniqueFieldEntrySerializer.get() );
/**
@@ -85,30 +84,30 @@ public class UniqueValueSerializationStrategyV1Impl extends UniqueValueSerializ
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
- final MultiTennantColumnFamilyDefinition uniqueLookupCF =
- new MultiTennantColumnFamilyDefinition( CF_UNIQUE_VALUES, BytesType.class.getSimpleName(),
+ final MultiTenantColumnFamilyDefinition uniqueLookupCF =
+ new MultiTenantColumnFamilyDefinition( CF_UNIQUE_VALUES, BytesType.class.getSimpleName(),
ColumnTypes.DYNAMIC_COMPOSITE_TYPE, BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
- final MultiTennantColumnFamilyDefinition uniqueLogCF =
- new MultiTennantColumnFamilyDefinition( CF_ENTITY_UNIQUE_VALUE_LOG, BytesType.class.getSimpleName(),
+ final MultiTenantColumnFamilyDefinition uniqueLogCF =
+ new MultiTenantColumnFamilyDefinition( CF_ENTITY_UNIQUE_VALUE_LOG, BytesType.class.getSimpleName(),
ColumnTypes.DYNAMIC_COMPOSITE_TYPE, BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
return Arrays.asList( uniqueLookupCF, uniqueLogCF );
}
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Field>>, EntityVersion> getUniqueValuesCF() {
+ protected MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Field>>, EntityVersion> getUniqueValuesCF() {
return CF_UNIQUE_VALUES;
}
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UniqueFieldEntry>
+ protected MultiTenantColumnFamily<ScopedRowKey<CollectionPrefixedKey<Id>>, UniqueFieldEntry>
getEntityUniqueLogCF() {
return CF_ENTITY_UNIQUE_VALUE_LOG;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV2Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV2Impl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV2Impl.java
index 1e8b389..40622a4 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV2Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/UniqueValueSerializationStrategyV2Impl.java
@@ -26,12 +26,11 @@ import java.util.Collection;
import org.apache.cassandra.db.marshal.BytesType;
import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
-import org.apache.usergrid.persistence.collection.serialization.impl.util.LegacyScopeUtils;
import org.apache.usergrid.persistence.core.astyanax.CassandraFig;
import org.apache.usergrid.persistence.core.astyanax.ColumnTypes;
import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKeySerializer;
import org.apache.usergrid.persistence.model.entity.Id;
@@ -54,8 +53,8 @@ public class UniqueValueSerializationStrategyV2Impl extends UniqueValueSerializ
private static final EntityVersionSerializer ENTITY_VERSION_SER = new EntityVersionSerializer();
- private static final MultiTennantColumnFamily<ScopedRowKey<TypeField>, EntityVersion>
- CF_UNIQUE_VALUES = new MultiTennantColumnFamily<>( "Unique_Values_V2", ROW_KEY_SER, ENTITY_VERSION_SER );
+ private static final MultiTenantColumnFamily<ScopedRowKey<TypeField>, EntityVersion>
+ CF_UNIQUE_VALUES = new MultiTenantColumnFamily<>( "Unique_Values_V2", ROW_KEY_SER, ENTITY_VERSION_SER );
private static final IdRowCompositeSerializer ID_SER = IdRowCompositeSerializer.get();
@@ -65,9 +64,9 @@ public class UniqueValueSerializationStrategyV2Impl extends UniqueValueSerializ
new ScopedRowKeySerializer<>( ID_SER );
- private static final MultiTennantColumnFamily<ScopedRowKey<Id>, UniqueFieldEntry>
+ private static final MultiTenantColumnFamily<ScopedRowKey<Id>, UniqueFieldEntry>
CF_ENTITY_UNIQUE_VALUE_LOG =
- new MultiTennantColumnFamily<>( "Entity_Unique_Values_V2", ENTITY_ROW_KEY_SER, UniqueFieldEntrySerializer.get() );
+ new MultiTenantColumnFamily<>( "Entity_Unique_Values_V2", ENTITY_ROW_KEY_SER, UniqueFieldEntrySerializer.get() );
/**
@@ -85,30 +84,30 @@ public class UniqueValueSerializationStrategyV2Impl extends UniqueValueSerializ
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
- final MultiTennantColumnFamilyDefinition uniqueLookupCF =
- new MultiTennantColumnFamilyDefinition( CF_UNIQUE_VALUES, BytesType.class.getSimpleName(),
+ final MultiTenantColumnFamilyDefinition uniqueLookupCF =
+ new MultiTenantColumnFamilyDefinition( CF_UNIQUE_VALUES, BytesType.class.getSimpleName(),
ColumnTypes.DYNAMIC_COMPOSITE_TYPE, BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
- final MultiTennantColumnFamilyDefinition uniqueLogCF =
- new MultiTennantColumnFamilyDefinition( CF_ENTITY_UNIQUE_VALUE_LOG, BytesType.class.getSimpleName(),
+ final MultiTenantColumnFamilyDefinition uniqueLogCF =
+ new MultiTenantColumnFamilyDefinition( CF_ENTITY_UNIQUE_VALUE_LOG, BytesType.class.getSimpleName(),
ColumnTypes.DYNAMIC_COMPOSITE_TYPE, BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
return Arrays.asList( uniqueLookupCF, uniqueLogCF );
}
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<TypeField>, EntityVersion> getUniqueValuesCF() {
+ protected MultiTenantColumnFamily<ScopedRowKey<TypeField>, EntityVersion> getUniqueValuesCF() {
return CF_UNIQUE_VALUES;
}
@Override
- protected MultiTennantColumnFamily<ScopedRowKey<Id>, UniqueFieldEntry>
+ protected MultiTenantColumnFamily<ScopedRowKey<Id>, UniqueFieldEntry>
getEntityUniqueLogCF() {
return CF_ENTITY_UNIQUE_VALUE_LOG;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTenantColumnFamily.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTenantColumnFamily.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTenantColumnFamily.java
new file mode 100644
index 0000000..5526cff
--- /dev/null
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTenantColumnFamily.java
@@ -0,0 +1,47 @@
+/*
+ * 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.usergrid.persistence.core.astyanax;
+
+
+
+import com.netflix.astyanax.Serializer;
+import com.netflix.astyanax.model.ColumnFamily;
+
+
+/**
+ * Simple wrapper to force every column family to use ScopedRowKeys
+ *
+ * @author tnine
+ */
+public class MultiTenantColumnFamily<R extends ScopedRowKey<?>, V >
+ extends ColumnFamily<R, V> {
+
+ public MultiTenantColumnFamily(final String columnFamilyName, final Serializer<R> keySerializer,
+ final Serializer<V> columnSerializer ) {
+
+ super( columnFamilyName, keySerializer, columnSerializer );
+ }
+
+
+ public MultiTenantColumnFamily(final String columnFamilyName, final Serializer<R> keySerializer,
+ final Serializer<V> columnSerializer, final Serializer<?> defaultValueSerializer ) {
+
+ super( columnFamilyName, keySerializer, columnSerializer, defaultValueSerializer );
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTenantColumnFamilyDefinition.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTenantColumnFamilyDefinition.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTenantColumnFamilyDefinition.java
new file mode 100644
index 0000000..faa7a5b
--- /dev/null
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTenantColumnFamilyDefinition.java
@@ -0,0 +1,138 @@
+/*
+ * 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.usergrid.persistence.core.astyanax;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.google.common.base.Preconditions;
+import com.netflix.astyanax.model.ColumnFamily;
+
+
+/**
+ * Bean wrapper for column family information
+ *
+ * @author tnine
+ */
+public class MultiTenantColumnFamilyDefinition {
+
+
+ /**
+ * Options for caching on the CF
+ */
+ public enum CacheOption {
+ /**
+ * Use both row key shard and key shard
+ */
+ ALL( "ALL" ),
+
+ /**
+ * Cache keys only (the default)
+ */
+ KEYS( "KEYS_ONLY" ),
+
+ /**
+ * Cache rows only, no keys
+ */
+ ROWS( "ROWS_ONLY" ),
+
+ /**
+ * Cache neither
+ */
+ NONE( "NONE" );
+
+ private String value;
+
+
+ private CacheOption( String value ) {
+ this.value = value;
+ }
+
+
+ public String getValue() {
+ return value;
+ }
+ }
+
+
+ public static final String COMPARATOR_TYPE = "comparator_type";
+ public static final String READ_REPAIR_CHANCE = "read_repair_chance";
+ public static final String KEY_VALIDATION = "key_validation_class";
+ public static final String VALUE_VALIDATION = "default_validation_class";
+ public static final String CACHE_OPTION = "caching";
+ public static final String COMPACTION_STRATEGY = "compaction_strategy";
+ public static final String COMPACTION_STRATEGY_OPTIONS = "compaction_strategy_options";
+ public static final String COMPACTION_SSTABLE_SIZE = "sstable_size_in_mb";
+ public static final String BLOOM_FILTER_FP = "sstable_size_in_mb";
+
+
+
+ private final ColumnFamily columnFamily;
+ private final String columnComparatorType;
+ private final String keyValidationType;
+ private final String columnValidationType;
+ private final CacheOption cacheOption;
+
+
+ public MultiTenantColumnFamilyDefinition(final ColumnFamily columnFamily, final String keyValidationType,
+ final String columnComparatorType, final String columnValidationType, final CacheOption cacheOption ) {
+
+ Preconditions.checkNotNull( columnFamily, "columnFamily is required" );
+ Preconditions.checkNotNull( columnComparatorType, "columnComparatorType is required" );
+ Preconditions.checkNotNull( keyValidationType, "keyValidationType is required" );
+ Preconditions.checkNotNull( columnValidationType, "columnValueValidationType is required" );
+ Preconditions.checkNotNull( cacheOption, "cacheOption is required" );
+
+ this.columnFamily = columnFamily;
+ this.columnComparatorType = columnComparatorType;
+ this.keyValidationType = keyValidationType;
+ this.columnValidationType = columnValidationType;
+ this.cacheOption = cacheOption;
+ }
+
+
+
+ public Map<String, Object> getOptions() {
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put( COMPARATOR_TYPE, columnComparatorType );
+ options.put( KEY_VALIDATION, keyValidationType );
+ options.put( VALUE_VALIDATION, columnValidationType );
+ options.put( CACHE_OPTION, cacheOption.getValue() );
+
+
+ //always use 10% read repair chance!
+ options.put( READ_REPAIR_CHANCE, 0.1d );
+ options.put( BLOOM_FILTER_FP, 0.1d );
+ options.put( COMPACTION_STRATEGY, "LeveledCompactionStrategy");
+
+ Map<String, Object> compactionOptions = new HashMap<>();
+ compactionOptions.put( COMPACTION_SSTABLE_SIZE, "512" );
+
+ options.put( COMPACTION_STRATEGY_OPTIONS, compactionOptions );
+
+ return options;
+ }
+
+
+ public ColumnFamily getColumnFamily() {
+ return columnFamily;
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamily.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamily.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamily.java
deleted file mode 100644
index 38851a5..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamily.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.usergrid.persistence.core.astyanax;
-
-
-
-import com.netflix.astyanax.Serializer;
-import com.netflix.astyanax.model.ColumnFamily;
-
-
-/**
- * Simple wrapper to force every column family to use ScopedRowKeys
- *
- * @author tnine
- */
-public class MultiTennantColumnFamily<R extends ScopedRowKey<?>, V >
- extends ColumnFamily<R, V> {
-
- public MultiTennantColumnFamily( final String columnFamilyName, final Serializer<R> keySerializer,
- final Serializer<V> columnSerializer ) {
-
- super( columnFamilyName, keySerializer, columnSerializer );
- }
-
-
- public MultiTennantColumnFamily( final String columnFamilyName, final Serializer<R> keySerializer,
- final Serializer<V> columnSerializer, final Serializer<?> defaultValueSerializer ) {
-
- super( columnFamilyName, keySerializer, columnSerializer, defaultValueSerializer );
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamilyDefinition.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamilyDefinition.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamilyDefinition.java
deleted file mode 100644
index 9ee886e..0000000
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiTennantColumnFamilyDefinition.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.usergrid.persistence.core.astyanax;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.google.common.base.Preconditions;
-import com.netflix.astyanax.model.ColumnFamily;
-
-
-/**
- * Bean wrapper for column family information
- *
- * @author tnine
- */
-public class MultiTennantColumnFamilyDefinition {
-
-
- /**
- * Options for caching on the CF
- */
- public enum CacheOption {
- /**
- * Use both row key shard and key shard
- */
- ALL( "ALL" ),
-
- /**
- * Cache keys only (the default)
- */
- KEYS( "KEYS_ONLY" ),
-
- /**
- * Cache rows only, no keys
- */
- ROWS( "ROWS_ONLY" ),
-
- /**
- * Cache neither
- */
- NONE( "NONE" );
-
- private String value;
-
-
- private CacheOption( String value ) {
- this.value = value;
- }
-
-
- public String getValue() {
- return value;
- }
- }
-
-
- public static final String COMPARATOR_TYPE = "comparator_type";
- public static final String READ_REPAIR_CHANCE = "read_repair_chance";
- public static final String KEY_VALIDATION = "key_validation_class";
- public static final String VALUE_VALIDATION = "default_validation_class";
- public static final String CACHE_OPTION = "caching";
- public static final String COMPACTION_STRATEGY = "compaction_strategy";
- public static final String COMPACTION_STRATEGY_OPTIONS = "compaction_strategy_options";
- public static final String COMPACTION_SSTABLE_SIZE = "sstable_size_in_mb";
- public static final String BLOOM_FILTER_FP = "sstable_size_in_mb";
-
-
-
- private final ColumnFamily columnFamily;
- private final String columnComparatorType;
- private final String keyValidationType;
- private final String columnValidationType;
- private final CacheOption cacheOption;
-
-
- public MultiTennantColumnFamilyDefinition( final ColumnFamily columnFamily, final String keyValidationType,
- final String columnComparatorType, final String columnValidationType, final CacheOption cacheOption ) {
-
- Preconditions.checkNotNull( columnFamily, "columnFamily is required" );
- Preconditions.checkNotNull( columnComparatorType, "columnComparatorType is required" );
- Preconditions.checkNotNull( keyValidationType, "keyValidationType is required" );
- Preconditions.checkNotNull( columnValidationType, "columnValueValidationType is required" );
- Preconditions.checkNotNull( cacheOption, "cacheOption is required" );
-
- this.columnFamily = columnFamily;
- this.columnComparatorType = columnComparatorType;
- this.keyValidationType = keyValidationType;
- this.columnValidationType = columnValidationType;
- this.cacheOption = cacheOption;
- }
-
-
-
- public Map<String, Object> getOptions() {
-
- Map<String, Object> options = new HashMap<String, Object>();
- options.put( COMPARATOR_TYPE, columnComparatorType );
- options.put( KEY_VALIDATION, keyValidationType );
- options.put( VALUE_VALIDATION, columnValidationType );
- options.put( CACHE_OPTION, cacheOption.getValue() );
-
-
- //always use 10% read repair chance!
- options.put( READ_REPAIR_CHANCE, 0.1d );
- options.put( BLOOM_FILTER_FP, 0.1d );
- options.put( COMPACTION_STRATEGY, "LeveledCompactionStrategy");
-
- Map<String, Object> compactionOptions = new HashMap<>();
- compactionOptions.put( COMPACTION_SSTABLE_SIZE, "512" );
-
- options.put( COMPACTION_STRATEGY_OPTIONS, compactionOptions );
-
- return options;
- }
-
-
- public ColumnFamily getColumnFamily() {
- return columnFamily;
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
index 3def798..f1471ac 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
@@ -22,16 +22,12 @@ package org.apache.usergrid.persistence.core.migration.data;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
import org.apache.cassandra.db.marshal.BytesType;
import org.apache.cassandra.db.marshal.UTF8Type;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKeySerializer;
import org.apache.usergrid.persistence.core.astyanax.StringRowCompositeSerializer;
@@ -63,8 +59,8 @@ public class MigrationInfoSerializationImpl implements MigrationInfoSerializatio
private static final StringSerializer STRING_SERIALIZER = StringSerializer.get();
- public static final MultiTennantColumnFamily<ScopedRowKey<String>, String> CF_MIGRATION_INFO =
- new MultiTennantColumnFamily<>( "Data_Migration_Info", ROW_KEY_SER, STRING_SERIALIZER );
+ public static final MultiTenantColumnFamily<ScopedRowKey<String>, String> CF_MIGRATION_INFO =
+ new MultiTenantColumnFamily<>( "Data_Migration_Info", ROW_KEY_SER, STRING_SERIALIZER );
/**
@@ -207,10 +203,10 @@ public class MigrationInfoSerializationImpl implements MigrationInfoSerializatio
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
return Collections.singletonList(
- new MultiTennantColumnFamilyDefinition( CF_MIGRATION_INFO, BytesType.class.getSimpleName(),
+ new MultiTenantColumnFamilyDefinition( CF_MIGRATION_INFO, BytesType.class.getSimpleName(),
UTF8Type.class.getSimpleName(), BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS ) );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS ) );
}
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/Migration.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/Migration.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/Migration.java
index 7343f07..9938b88 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/Migration.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/Migration.java
@@ -21,7 +21,7 @@ package org.apache.usergrid.persistence.core.migration.schema;
import java.util.Collection;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
/**
@@ -32,5 +32,5 @@ public interface Migration {
/**
* Get the column families required for this implementation. If one does not exist it will be created.
*/
- Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies();
+ Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies();
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/MigrationManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/MigrationManagerImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/MigrationManagerImpl.java
index 26351cf..4075437 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/MigrationManagerImpl.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/schema/MigrationManagerImpl.java
@@ -27,14 +27,13 @@ import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.migration.util.AstayanxUtils;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.netflix.astyanax.Keyspace;
-import com.netflix.astyanax.connectionpool.exceptions.BadRequestException;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import com.netflix.astyanax.connectionpool.exceptions.NotFoundException;
import com.netflix.astyanax.ddl.ColumnFamilyDefinition;
@@ -77,7 +76,7 @@ public class MigrationManagerImpl implements MigrationManager {
for ( Migration migration : migrations ) {
- final Collection<MultiTennantColumnFamilyDefinition> columnFamilies = migration.getColumnFamilies();
+ final Collection<MultiTenantColumnFamilyDefinition> columnFamilies = migration.getColumnFamilies();
if ( columnFamilies == null || columnFamilies.size() == 0 ) {
@@ -88,7 +87,7 @@ public class MigrationManagerImpl implements MigrationManager {
continue;
}
- for ( MultiTennantColumnFamilyDefinition cf : columnFamilies ) {
+ for ( MultiTenantColumnFamilyDefinition cf : columnFamilies ) {
testAndCreateColumnFamilyDef( cf );
}
}
@@ -103,7 +102,7 @@ public class MigrationManagerImpl implements MigrationManager {
/**
* Check if the column family exists. If it dosn't create it
*/
- private void testAndCreateColumnFamilyDef( MultiTennantColumnFamilyDefinition columnFamily )
+ private void testAndCreateColumnFamilyDef( MultiTenantColumnFamilyDefinition columnFamily )
throws ConnectionException {
final KeyspaceDefinition keyspaceDefinition = keyspace.describeKeyspace();
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java
index a3d48de..44d0b73 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationProxyImpl.java
@@ -29,7 +29,7 @@ import java.util.Iterator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.migration.data.MigrationInfoCache;
import org.apache.usergrid.persistence.core.migration.data.MigrationRelationship;
import org.apache.usergrid.persistence.core.migration.data.VersionedMigrationSet;
@@ -284,7 +284,7 @@ public class EdgeMetadataSerializationProxyImpl implements EdgeMetadataSerializa
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
return Collections.EMPTY_LIST;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56eb80f8/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV1Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV1Impl.java b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV1Impl.java
index 5fd270f..da4d044 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV1Impl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/EdgeMetadataSerializationV1Impl.java
@@ -31,8 +31,8 @@ import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
import org.apache.usergrid.persistence.core.astyanax.ColumnNameIterator;
import org.apache.usergrid.persistence.core.astyanax.CompositeFieldSerializer;
import org.apache.usergrid.persistence.core.astyanax.IdRowCompositeSerializer;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamilyDefinition;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
+import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKeySerializer;
import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
import org.apache.usergrid.persistence.core.astyanax.StringColumnParser;
@@ -85,26 +85,26 @@ public class EdgeMetadataSerializationV1Impl implements EdgeMetadataSerializatio
/**
* CFs where the row key contains the source node id
*/
- private static final MultiTennantColumnFamily<ScopedRowKey<Id>, String> CF_SOURCE_EDGE_TYPES =
- new MultiTennantColumnFamily<>( "Graph_Source_Edge_Types", ROW_KEY_SER,
+ private static final MultiTenantColumnFamily<ScopedRowKey<Id>, String> CF_SOURCE_EDGE_TYPES =
+ new MultiTenantColumnFamily<>( "Graph_Source_Edge_Types", ROW_KEY_SER,
STRING_SERIALIZER );
//all target id types for source edge type
- private static final MultiTennantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> CF_SOURCE_EDGE_ID_TYPES =
- new MultiTennantColumnFamily<>( "Graph_Source_Edge_Id_Types",
+ private static final MultiTenantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> CF_SOURCE_EDGE_ID_TYPES =
+ new MultiTenantColumnFamily<>( "Graph_Source_Edge_Id_Types",
EDGE_TYPE_ROW_KEY, STRING_SERIALIZER );
/**
* CFs where the row key is the target node id
*/
- private static final MultiTennantColumnFamily<ScopedRowKey<Id>, String> CF_TARGET_EDGE_TYPES =
- new MultiTennantColumnFamily<>( "Graph_Target_Edge_Types", ROW_KEY_SER,
+ private static final MultiTenantColumnFamily<ScopedRowKey<Id>, String> CF_TARGET_EDGE_TYPES =
+ new MultiTenantColumnFamily<>( "Graph_Target_Edge_Types", ROW_KEY_SER,
STRING_SERIALIZER );
//all source id types for target edge type
- private static final MultiTennantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> CF_TARGET_EDGE_ID_TYPES =
- new MultiTennantColumnFamily<>( "Graph_Target_Edge_Id_Types",
+ private static final MultiTenantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> CF_TARGET_EDGE_ID_TYPES =
+ new MultiTenantColumnFamily<>( "Graph_Target_Edge_Id_Types",
EDGE_TYPE_ROW_KEY, STRING_SERIALIZER );
@@ -243,7 +243,7 @@ public class EdgeMetadataSerializationV1Impl implements EdgeMetadataSerializatio
*/
private MutationBatch removeEdgeType( final ApplicationScope scope, final Id rowKeyId, final String edgeType,
final long version,
- final MultiTennantColumnFamily<ScopedRowKey<Id>, String> cf ) {
+ final MultiTenantColumnFamily<ScopedRowKey<Id>, String> cf ) {
//write target<--source edge type meta data
@@ -271,7 +271,7 @@ public class EdgeMetadataSerializationV1Impl implements EdgeMetadataSerializatio
*/
private MutationBatch removeIdType( final ApplicationScope scope, final Id rowId, final String idType,
final String edgeType, final long version,
- final MultiTennantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> cf ) {
+ final MultiTenantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> cf ) {
final MutationBatch batch = keyspace.prepareMutationBatch().withTimestamp( version );
@@ -314,7 +314,7 @@ public class EdgeMetadataSerializationV1Impl implements EdgeMetadataSerializatio
* @param cf The column family to execute on
*/
private Iterator<String> getEdgeTypes( final ApplicationScope scope, final SearchEdgeType search,
- final MultiTennantColumnFamily<ScopedRowKey<Id>, String> cf ) {
+ final MultiTenantColumnFamily<ScopedRowKey<Id>, String> cf ) {
ValidationUtils.validateApplicationScope( scope );
GraphValidation.validateSearchEdgeType( search );
@@ -349,7 +349,7 @@ public class EdgeMetadataSerializationV1Impl implements EdgeMetadataSerializatio
* @param cf The column family to search
*/
public Iterator<String> getIdTypes( final ApplicationScope scope, final SearchIdType search,
- final MultiTennantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> cf ) {
+ final MultiTenantColumnFamily<ScopedRowKey<EdgeIdTypeKey>, String> cf ) {
ValidationUtils.validateApplicationScope( scope );
GraphValidation.validateSearchEdgeIdType( search );
@@ -371,7 +371,7 @@ public class EdgeMetadataSerializationV1Impl implements EdgeMetadataSerializatio
@Override
- public Collection<MultiTennantColumnFamilyDefinition> getColumnFamilies() {
+ public Collection<MultiTenantColumnFamilyDefinition> getColumnFamilies() {
return Arrays.asList( graphCf( CF_SOURCE_EDGE_TYPES ), graphCf( CF_TARGET_EDGE_TYPES ),
graphCf( CF_SOURCE_EDGE_ID_TYPES ), graphCf( CF_TARGET_EDGE_ID_TYPES ) );
}
@@ -380,10 +380,10 @@ public class EdgeMetadataSerializationV1Impl implements EdgeMetadataSerializatio
/**
* Helper to generate an edge definition by the type
*/
- private MultiTennantColumnFamilyDefinition graphCf( MultiTennantColumnFamily cf ) {
- return new MultiTennantColumnFamilyDefinition( cf, BytesType.class.getSimpleName(),
+ private MultiTenantColumnFamilyDefinition graphCf(MultiTenantColumnFamily cf ) {
+ return new MultiTenantColumnFamilyDefinition( cf, BytesType.class.getSimpleName(),
UTF8Type.class.getSimpleName(), BytesType.class.getSimpleName(),
- MultiTennantColumnFamilyDefinition.CacheOption.KEYS );
+ MultiTenantColumnFamilyDefinition.CacheOption.KEYS );
}
[04/12] usergrid git commit: First commit of new implementation of
Astyanax locks and having it wired with guide instead of Spring.
Posted by gr...@apache.org.
First commit of new implementation of Astyanax locks and having it wired with guide instead of Spring.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/71f32747
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/71f32747
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/71f32747
Branch: refs/heads/master
Commit: 71f327473434874f78fb53bebf46b8cf909a9735
Parents: 8849d8e
Author: Michael Russo <mi...@gmail.com>
Authored: Thu Jan 14 09:42:42 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Thu Jan 14 12:17:35 2016 -0800
----------------------------------------------------------------------
stack/core/pom.xml | 5 +
.../apache/usergrid/batch/job/OnlyOnceJob.java | 3 +-
.../usergrid/corepersistence/CoreModule.java | 2 +
.../locking/cassandra/AstyanaxLockImpl.java | 79 +++++
.../cassandra/AstyanaxLockManagerImpl.java | 173 +++++++++
.../usergrid/locking/guice/LockModule.java | 40 +++
.../mq/cassandra/QueueManagerFactoryImpl.java | 5 +-
.../persistence/cassandra/CassandraService.java | 5 +-
.../main/resources/usergrid-core-context.xml | 5 +-
stack/corepersistence/common/pom.xml | 351 ++++++++++---------
.../core/astyanax/AstyanaxKeyspaceProvider.java | 46 +--
.../core/astyanax/CassandraCluster.java | 20 ++
.../core/astyanax/CassandraClusterImpl.java | 198 +++++++++++
.../persistence/core/astyanax/CassandraFig.java | 72 +++-
.../persistence/core/guice/CommonModule.java | 11 +-
.../data/MigrationInfoSerializationImpl.java | 10 +-
.../core/astyanax/ColumnNameIteratorTest.java | 5 +-
.../MultiKeyColumnNameIteratorTest.java | 5 +-
.../astyanax/MultiRowColumnIteratorTest.java | 5 +-
.../persistence/core/astyanax/TestUtils.java | 8 +-
stack/pom.xml | 7 +
.../services/ServiceManagerFactory.java | 6 +-
.../resources/usergrid-services-context.xml | 6 +-
.../test/resources/testApplicationContext.xml | 10 +-
24 files changed, 830 insertions(+), 247 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/core/pom.xml
----------------------------------------------------------------------
diff --git a/stack/core/pom.xml b/stack/core/pom.xml
index ae9f915..49082b6 100644
--- a/stack/core/pom.xml
+++ b/stack/core/pom.xml
@@ -214,6 +214,11 @@
<artifactId>curator-recipes</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.netflix.astyanax</groupId>
+ <artifactId>astyanax-recipes</artifactId>
+ </dependency>
+
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/core/src/main/java/org/apache/usergrid/batch/job/OnlyOnceJob.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/batch/job/OnlyOnceJob.java b/stack/core/src/main/java/org/apache/usergrid/batch/job/OnlyOnceJob.java
index 726464e..f857d05 100644
--- a/stack/core/src/main/java/org/apache/usergrid/batch/job/OnlyOnceJob.java
+++ b/stack/core/src/main/java/org/apache/usergrid/batch/job/OnlyOnceJob.java
@@ -19,6 +19,7 @@ package org.apache.usergrid.batch.job;
import java.util.concurrent.TimeUnit;
+import org.elasticsearch.common.inject.Inject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.apache.usergrid.batch.Job;
@@ -37,7 +38,7 @@ import org.apache.usergrid.persistence.EntityManagerFactory;
@Component("OnlyOnceJob")
public abstract class OnlyOnceJob implements Job {
- @Autowired
+ @Inject
private LockManager lockManager;
@Autowired
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
index 628459b..e2d845f 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
@@ -16,6 +16,7 @@
package org.apache.usergrid.corepersistence;
+import org.apache.usergrid.locking.guice.LockModule;
import org.apache.usergrid.persistence.cache.guice.CacheModule;
import java.util.concurrent.ThreadPoolExecutor;
@@ -94,6 +95,7 @@ public class CoreModule extends AbstractModule {
protected void configure() {
install( new CommonModule());
+ install( new LockModule());
install( new CacheModule());
install( new CollectionModule() {
/**
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockImpl.java
new file mode 100644
index 0000000..3c12d8a
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockImpl.java
@@ -0,0 +1,79 @@
+/*
+ * 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.usergrid.locking.cassandra;
+
+
+import com.netflix.astyanax.recipes.locks.ColumnPrefixDistributedRowLock;
+
+import org.apache.usergrid.locking.Lock;
+import org.apache.usergrid.locking.exception.UGLockException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.TimeUnit;
+
+
+public class AstyanaxLockImpl implements Lock {
+
+ private static final Logger logger = LoggerFactory.getLogger( AstyanaxLockImpl.class );
+
+
+
+ ColumnPrefixDistributedRowLock lock;
+
+ public AstyanaxLockImpl(//AstyanaxLockManagerImpl lockManager,
+ ColumnPrefixDistributedRowLock lock) {
+
+ this.lock = lock;
+
+ }
+
+
+ @Override
+ public boolean tryLock( long timeout, TimeUnit time ) throws UGLockException {
+ lock.withTtl( (int) timeout, time);
+
+ try {
+ lock.acquire();
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ @Override
+ public void lock() throws UGLockException {
+
+ try {
+ lock.acquire();
+ } catch (Exception e) {
+ throw new UGLockException("Unable to acquire lock with id: " + lock.getLockId());
+ }
+ }
+
+ @Override
+ public void unlock() throws UGLockException {
+
+ try {
+ lock.release();
+ } catch (Exception e) {
+ throw new UGLockException("Unable to release lock with id: " + lock.getLockId());
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
new file mode 100644
index 0000000..ece942f
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
@@ -0,0 +1,173 @@
+/*
+ * 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.usergrid.locking.cassandra;
+
+
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Inject;
+import com.netflix.astyanax.Keyspace;
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
+import com.netflix.astyanax.ddl.ColumnFamilyDefinition;
+import com.netflix.astyanax.ddl.KeyspaceDefinition;
+import com.netflix.astyanax.model.ColumnFamily;
+import com.netflix.astyanax.recipes.locks.ColumnPrefixDistributedRowLock;
+import com.netflix.astyanax.serializers.StringSerializer;
+import org.apache.cassandra.db.marshal.BytesType;
+import org.apache.cassandra.db.marshal.UTF8Type;
+import org.apache.usergrid.locking.Lock;
+import org.apache.usergrid.locking.LockManager;
+import org.apache.usergrid.locking.LockPathBuilder;
+import org.apache.usergrid.persistence.core.astyanax.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+public class AstyanaxLockManagerImpl implements LockManager {
+
+ private static final Logger logger = LoggerFactory.getLogger( AstyanaxLockManagerImpl.class );
+ private static final String CF_NAME = "AstyanaxLocks";
+
+
+ private final CassandraFig cassandraFig;
+ private final Keyspace keyspace;
+ private final ColumnFamily columnFamily;
+
+ @Inject
+ public AstyanaxLockManagerImpl(CassandraFig cassandraFig,
+ CassandraCluster cassandraCluster ) throws ConnectionException {
+
+ this.cassandraFig = cassandraFig;
+ this.keyspace = cassandraCluster.getLocksKeyspace();
+
+ createLocksKeyspace();
+
+ this.columnFamily = createLocksColumnFamily();
+
+
+
+
+ }
+
+
+ @Override
+ public Lock createLock(final UUID applicationId, final String... path ){
+
+ String lockPath = LockPathBuilder.buildPath( applicationId, path );
+
+ ColumnPrefixDistributedRowLock<String> lock =
+ new ColumnPrefixDistributedRowLock<>(keyspace, columnFamily, lockPath);
+
+
+ return new AstyanaxLockImpl( lock );
+
+ }
+
+
+
+ private ColumnFamily createLocksColumnFamily() throws ConnectionException {
+
+ ColumnFamily<String, String> CF_LOCKS = ColumnFamily.newColumnFamily(
+ CF_NAME, StringSerializer.get(), StringSerializer.get() );
+
+ final KeyspaceDefinition keyspaceDefinition = keyspace.describeKeyspace();
+ final ColumnFamilyDefinition existing =
+ keyspaceDefinition.getColumnFamily( CF_LOCKS.getName() );
+
+
+ if ( existing != null ) {
+
+ Map<String, Object> existingOptions = new HashMap<>(1);
+ existingOptions.put("gc_grace_seconds", existing.getGcGraceSeconds());
+ existingOptions.put("caching", existing.getCaching());
+ existingOptions.put("compaction_strategy", existing.getCompactionStrategy());
+ existingOptions.put("compaction_strategy_options", existing.getCompactionStrategyOptions());
+
+ logger.info( "Locks column family {} exists with options: {}", existing.getName(),
+ existingOptions.toString() );
+
+ return CF_LOCKS;
+ }
+
+ MultiTenantColumnFamilyDefinition columnFamilyDefinition = new MultiTenantColumnFamilyDefinition(
+ CF_LOCKS,
+ BytesType.class.getSimpleName(),
+ UTF8Type.class.getSimpleName(),
+ BytesType.class.getSimpleName(),
+ MultiTenantColumnFamilyDefinition.CacheOption.ALL
+ );
+
+ Map<String, Object> cfOptions = columnFamilyDefinition.getOptions();
+
+ // Additionally set the gc grace low
+ cfOptions.put("gc_grace_seconds", 60);
+
+
+ keyspace.createColumnFamily( columnFamilyDefinition.getColumnFamily() , cfOptions );
+
+ logger.info( "Created column family {}", columnFamilyDefinition.getOptions() );
+
+ return columnFamilyDefinition.getColumnFamily();
+ }
+
+
+ private void createLocksKeyspace() throws ConnectionException {
+
+
+
+ ImmutableMap.Builder<String, Object> strategyOptions = getKeySpaceProps();
+
+ ImmutableMap<String, Object> options =
+ ImmutableMap.<String, Object>builder().put( "strategy_class", cassandraFig.getLocksKeyspaceStrategy() )
+ .put( "strategy_options", strategyOptions.build() ).build();
+
+
+ keyspace.createKeyspaceIfNotExists( options );
+
+ strategyOptions.toString();
+
+ logger.info( "Keyspace {} created or already exists with options {}",
+ keyspace.getKeyspaceName(),
+ options.toString() );
+ }
+
+ /**
+ * Get keyspace properties
+ */
+ private ImmutableMap.Builder<String, Object> getKeySpaceProps() {
+ ImmutableMap.Builder<String, Object> keyspaceProps = ImmutableMap.<String, Object>builder();
+
+ String optionString = cassandraFig.getLocksKeyspaceReplication();
+
+ if(optionString == null){
+ return keyspaceProps;
+ }
+
+
+ for ( String key : optionString.split( "," ) ) {
+
+ final String[] options = key.split( ":" );
+ if (options.length > 0) {
+ keyspaceProps.put(options[0], options[1]);
+ }
+ }
+
+ return keyspaceProps;
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/core/src/main/java/org/apache/usergrid/locking/guice/LockModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/guice/LockModule.java b/stack/core/src/main/java/org/apache/usergrid/locking/guice/LockModule.java
new file mode 100644
index 0000000..49c58fe
--- /dev/null
+++ b/stack/core/src/main/java/org/apache/usergrid/locking/guice/LockModule.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. 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. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.usergrid.locking.guice;
+
+
+import com.google.inject.AbstractModule;
+import org.apache.usergrid.locking.LockManager;
+import org.apache.usergrid.locking.cassandra.AstyanaxLockManagerImpl;
+
+
+/**
+ * Wire up LockManager implementation.
+ */
+public class LockModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+
+ bind( LockManager.class ).to( AstyanaxLockManagerImpl.class );
+
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/core/src/main/java/org/apache/usergrid/mq/cassandra/QueueManagerFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/mq/cassandra/QueueManagerFactoryImpl.java b/stack/core/src/main/java/org/apache/usergrid/mq/cassandra/QueueManagerFactoryImpl.java
index a54295c..47b58e8 100644
--- a/stack/core/src/main/java/org/apache/usergrid/mq/cassandra/QueueManagerFactoryImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/mq/cassandra/QueueManagerFactoryImpl.java
@@ -19,6 +19,7 @@ package org.apache.usergrid.mq.cassandra;
import java.util.UUID;
+import com.google.inject.Injector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.usergrid.locking.LockManager;
@@ -47,10 +48,10 @@ public class QueueManagerFactoryImpl implements QueueManagerFactory {
* @param cass the cassandra client pool
* @param counterUtils the CounterUtils
*/
- public QueueManagerFactoryImpl( CassandraService cass, CounterUtils counterUtils, LockManager lockManager, int lockTimeout ) {
+ public QueueManagerFactoryImpl(CassandraService cass, CounterUtils counterUtils, final Injector injector, int lockTimeout ) {
this.cass = cass;
this.counterUtils = counterUtils;
- this.lockManager = lockManager;
+ lockManager = injector.getInstance(LockManager.class);
this.lockTimeout = lockTimeout;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java
index e973764..b0226b7 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java
@@ -17,6 +17,7 @@
package org.apache.usergrid.persistence.cassandra;
+import com.google.inject.Inject;
import com.google.inject.Injector;
import me.prettyprint.cassandra.connection.HConnectionManager;
import me.prettyprint.cassandra.model.ConfigurableConsistencyLevel;
@@ -110,12 +111,12 @@ public class CassandraService {
//Wire guice injector via spring here, just pass the injector in the spring
public CassandraService( Properties properties, Cluster cluster,
- CassandraHostConfigurator cassandraHostConfigurator, LockManager lockManager,
+ CassandraHostConfigurator cassandraHostConfigurator,
final Injector injector) {
this.properties = properties;
this.cluster = cluster;
chc = cassandraHostConfigurator;
- this.lockManager = lockManager;
+ lockManager = injector.getInstance( LockManager.class );
db_logger.info( "" + cluster.getKnownPoolHosts( false ) );
//getInjector
applicationKeyspace = injector.getInstance( CassandraFig.class ).getApplicationKeyspace();
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/core/src/main/resources/usergrid-core-context.xml
----------------------------------------------------------------------
diff --git a/stack/core/src/main/resources/usergrid-core-context.xml b/stack/core/src/main/resources/usergrid-core-context.xml
index dc52b70..d413816 100644
--- a/stack/core/src/main/resources/usergrid-core-context.xml
+++ b/stack/core/src/main/resources/usergrid-core-context.xml
@@ -77,6 +77,7 @@
be updated to use an odd number for it's replication Factor. Even numbers can potentially
case the locks to fail, via "split brain" when read at QUORUM on lock verification-->
+ <!-- not using hector anymore
<bean name="lockManager" class="org.apache.usergrid.locking.cassandra.HectorLockManagerImpl">
<property name="cluster" ref="cassandraCluster"/>
<property name="keyspaceName" value="${cassandra.lock.keyspace}"/>
@@ -87,6 +88,7 @@
<property name="defaultReadConsistencyLevel" value="${cassandra.lock.readcl}"/>
<property name="defaultWriteConsistencyLevel" value="${cassandra.lock.writecl}"/>
</bean>
+ -->
<bean id="injector"
class="org.apache.usergrid.corepersistence.GuiceFactory">
@@ -103,7 +105,6 @@
<constructor-arg ref="properties" />
<constructor-arg ref="cassandraCluster" />
<constructor-arg ref="cassandraHostConfigurator" />
- <constructor-arg ref="lockManager" />
<constructor-arg ref="injector"/>
<property name="consistencyLevelPolicy" ref="consistencyLevelPolicy"/>
</bean>
@@ -124,7 +125,7 @@
class="org.apache.usergrid.mq.cassandra.QueueManagerFactoryImpl">
<constructor-arg ref="cassandraService" />
<constructor-arg ref="counterUtils"/>
- <constructor-arg ref="lockManager"/>
+ <constructor-arg ref="injector"/>
<constructor-arg value="${usergrid.queue.lock.timeout}"/>
</bean>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/corepersistence/common/pom.xml
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/pom.xml b/stack/corepersistence/common/pom.xml
index 0f54896..ff2ab28 100644
--- a/stack/corepersistence/common/pom.xml
+++ b/stack/corepersistence/common/pom.xml
@@ -2,175 +2,181 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>persistence</artifactId>
- <groupId>org.apache.usergrid</groupId>
- <version>2.1.1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>common</artifactId>
- <name>Usergrid Common</name>
-
- <dependencies>
-
- <dependency>
- <groupId>${project.parent.groupId}</groupId>
- <artifactId>model</artifactId>
- <version>${project.version}</version>
- </dependency>
-
-
- <dependency>
- <groupId>com.netflix.astyanax</groupId>
- <artifactId>astyanax-core</artifactId>
- <version>${astyanax.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.netflix.astyanax</groupId>
- <artifactId>astyanax-thrift</artifactId>
- <version>${astyanax.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.netflix.astyanax</groupId>
- <artifactId>astyanax-cassandra</artifactId>
- <version>${astyanax.version}</version>
- <exclusions>
- <exclusion>
- <artifactId>servlet-api</artifactId>
- <groupId>org.mortbay.jetty</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.cassandra</groupId>
- <artifactId>cassandra-all</artifactId>
- <version>${cassandra.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr</artifactId>
- <version>${antlr.version}</version>
- <type>jar</type>
- </dependency>
-
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr-runtime</artifactId>
- <version>${antlr.version}</version>
- <type>jar</type>
- </dependency>
-
- <dependency>
- <groupId>org.safehaus.guicyfig</groupId>
- <artifactId>guicyfig</artifactId>
- <version>${guicyfig.version}</version>
- </dependency>
-
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-collections4</artifactId>
- <version>4.0</version>
- </dependency>
-
-
- <!-- Google Guice -->
-
- <dependency>
- <groupId>com.google.inject</groupId>
- <artifactId>guice</artifactId>
- <version>${guice.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-multibindings</artifactId>
- <version>${guice.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.inject.extensions</groupId>
- <artifactId>guice-assistedinject</artifactId>
- <version>${guice.version}</version>
- </dependency>
-
- <!-- RX java -->
-
- <dependency>
- <groupId>io.reactivex</groupId>
- <artifactId>rxjava</artifactId>
- <version>${rx.version}</version>
- </dependency>
-
- <dependency>
- <groupId>io.reactivex</groupId>
- <artifactId>rxjava-math</artifactId>
- <version>1.0.0</version>
- </dependency>
-
- <dependency>
- <groupId>io.reactivex</groupId>
- <artifactId>rxjava-async-util</artifactId>
- <version>0.21.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.netflix.hystrix</groupId>
- <artifactId>hystrix-core</artifactId>
- <version>${hystrix.version}</version>
- </dependency>
-
-
- <!-- aws sdks -->
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>${aws.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>${mockito.version}</version>
- <scope>test</scope>
- </dependency>
-
-
- <dependency>
- <groupId>com.codahale.metrics</groupId>
- <artifactId>metrics-core</artifactId>
- <version>${metrics.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.codahale.metrics</groupId>
- <artifactId>metrics-graphite</artifactId>
- <version>${metrics.version}</version>
- </dependency>
- </dependencies>
+ <parent>
+ <artifactId>persistence</artifactId>
+ <groupId>org.apache.usergrid</groupId>
+ <version>2.1.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>common</artifactId>
+ <name>Usergrid Common</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.parent.groupId}</groupId>
+ <artifactId>model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>com.netflix.astyanax</groupId>
+ <artifactId>astyanax-core</artifactId>
+ <version>${astyanax.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.netflix.astyanax</groupId>
+ <artifactId>astyanax-thrift</artifactId>
+ <version>${astyanax.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.netflix.astyanax</groupId>
+ <artifactId>astyanax-cassandra</artifactId>
+ <version>${astyanax.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>servlet-api</artifactId>
+ <groupId>org.mortbay.jetty</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>com.netflix.astyanax</groupId>
+ <artifactId>astyanax-recipes</artifactId>
+ <version>${astyanax.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cassandra</groupId>
+ <artifactId>cassandra-all</artifactId>
+ <version>${cassandra.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr</artifactId>
+ <version>${antlr.version}</version>
+ <type>jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr-runtime</artifactId>
+ <version>${antlr.version}</version>
+ <type>jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.safehaus.guicyfig</groupId>
+ <artifactId>guicyfig</artifactId>
+ <version>${guicyfig.version}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ <version>4.0</version>
+ </dependency>
+
+
+ <!-- Google Guice -->
+
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ <version>${guice.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-multibindings</artifactId>
+ <version>${guice.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-assistedinject</artifactId>
+ <version>${guice.version}</version>
+ </dependency>
+
+ <!-- RX java -->
+
+ <dependency>
+ <groupId>io.reactivex</groupId>
+ <artifactId>rxjava</artifactId>
+ <version>${rx.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.reactivex</groupId>
+ <artifactId>rxjava-math</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.reactivex</groupId>
+ <artifactId>rxjava-async-util</artifactId>
+ <version>0.21.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.netflix.hystrix</groupId>
+ <artifactId>hystrix-core</artifactId>
+ <version>${hystrix.version}</version>
+ </dependency>
+
+
+ <!-- aws sdks -->
+ <dependency>
+ <groupId>com.amazonaws</groupId>
+ <artifactId>aws-java-sdk</artifactId>
+ <version>${aws.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>${mockito.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
+ <groupId>com.codahale.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ <version>${metrics.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.codahale.metrics</groupId>
+ <artifactId>metrics-graphite</artifactId>
+ <version>${metrics.version}</version>
+ </dependency>
+ </dependencies>
<profiles>
<profile>
@@ -182,8 +188,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.plugin.version}</version>
<configuration>
- <argLine>-javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${project.build.directory}/jacoco.exec</argLine>
- <excludedGroups>org.apache.usergrid.StressTest,org.apache.usergrid.ExperimentalTest</excludedGroups>
+ <argLine>
+ -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${project.build.directory}/jacoco.exec
+ </argLine>
+ <excludedGroups>org.apache.usergrid.StressTest,org.apache.usergrid.ExperimentalTest
+ </excludedGroups>
</configuration>
</plugin>
</plugins>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/AstyanaxKeyspaceProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/AstyanaxKeyspaceProvider.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/AstyanaxKeyspaceProvider.java
index 9377236..f02cf27 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/AstyanaxKeyspaceProvider.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/AstyanaxKeyspaceProvider.java
@@ -44,55 +44,21 @@ import com.netflix.astyanax.thrift.ThriftFamilyFactory;
*/
@Singleton
public class AstyanaxKeyspaceProvider implements Provider<Keyspace> {
- private final CassandraFig cassandraFig;
- private final CassandraConfig cassandraConfig;
+
+ private final CassandraCluster cassandraCluster;
@Inject
- public AstyanaxKeyspaceProvider( final CassandraFig cassandraFig, final CassandraConfig cassandraConfig) {
- this.cassandraFig = cassandraFig;
- this.cassandraConfig = cassandraConfig;
+ public AstyanaxKeyspaceProvider( final CassandraCluster cassandraCluster) {
+
+ this.cassandraCluster = cassandraCluster;
}
@Override
public Keyspace get() {
- AstyanaxConfiguration config = new AstyanaxConfigurationImpl()
- .setDiscoveryType( NodeDiscoveryType.valueOf( cassandraFig.getDiscoveryType() ) )
- .setTargetCassandraVersion( cassandraFig.getVersion() )
- .setDefaultReadConsistencyLevel( cassandraConfig.getReadCL() )
- .setDefaultWriteConsistencyLevel( cassandraConfig.getWriteCL() );
-
- ConnectionPoolConfiguration connectionPoolConfiguration =
- new ConnectionPoolConfigurationImpl( "UsergridConnectionPool" )
- .setPort( cassandraFig.getThriftPort() )
- .setLocalDatacenter( cassandraFig.getLocalDataCenter() )
- .setMaxConnsPerHost( cassandraFig.getConnections() )
- .setSeeds( cassandraFig.getHosts() )
- .setSocketTimeout( cassandraFig.getTimeout() );
-
- AstyanaxContext<Keyspace> context =
- new AstyanaxContext.Builder().forCluster( cassandraFig.getClusterName() )
- .forKeyspace( cassandraFig.getApplicationKeyspace())
-
- /*
- * TODO tnine Filter this by adding a host supplier. We will get token discovery from cassandra
- * but only connect
- * to nodes that have been specified. Good for real time updates of the cass system without
- * adding
- * load to them during runtime
- */
-
- .withAstyanaxConfiguration( config )
- .withConnectionPoolConfiguration( connectionPoolConfiguration )
- .withConnectionPoolMonitor( new Slf4jConnectionPoolMonitorImpl() )
- .buildKeyspace( ThriftFamilyFactory.getInstance() );
-
- context.start();
-
-
- return context.getClient();
+ return cassandraCluster.getApplicationKeyspace();
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraCluster.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraCluster.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraCluster.java
new file mode 100644
index 0000000..0adac8e
--- /dev/null
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraCluster.java
@@ -0,0 +1,20 @@
+package org.apache.usergrid.persistence.core.astyanax;
+
+
+
+import com.netflix.astyanax.Keyspace;
+
+import java.util.Map;
+
+
+public interface CassandraCluster {
+
+
+ Map<String, Keyspace> getKeyspaces();
+
+ Keyspace getApplicationKeyspace();
+
+ Keyspace getLocksKeyspace();
+
+
+}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraClusterImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraClusterImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraClusterImpl.java
new file mode 100644
index 0000000..674e076
--- /dev/null
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraClusterImpl.java
@@ -0,0 +1,198 @@
+/*
+ * 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.usergrid.persistence.core.astyanax;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.netflix.astyanax.AstyanaxConfiguration;
+import com.netflix.astyanax.AstyanaxContext;
+import com.netflix.astyanax.Cluster;
+import com.netflix.astyanax.Keyspace;
+import com.netflix.astyanax.connectionpool.ConnectionPoolConfiguration;
+import com.netflix.astyanax.connectionpool.NodeDiscoveryType;
+import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
+import com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl;
+import com.netflix.astyanax.connectionpool.impl.Slf4jConnectionPoolMonitorImpl;
+import com.netflix.astyanax.impl.AstyanaxConfigurationImpl;
+import com.netflix.astyanax.thrift.ThriftFamilyFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * TODO. Provide the ability to do a service hook for realtime tuning without the need of a JVM restart This could be
+ * done with governator and service discovery
+ *
+ * @author tnine
+ */
+@Singleton
+public class CassandraClusterImpl implements CassandraCluster {
+
+ private static final Logger logger = LoggerFactory.getLogger( CassandraClusterImpl.class );
+
+
+ private final CassandraFig cassandraFig;
+ private final CassandraConfig cassandraConfig;
+ private final Map<String, Keyspace> keyspaces = new HashMap<>(2);
+
+
+ @Inject
+ public CassandraClusterImpl(final CassandraFig cassandraFig, final CassandraConfig cassandraConfig) {
+ this.cassandraFig = cassandraFig;
+ this.cassandraConfig = cassandraConfig;
+
+
+
+ AstyanaxConfiguration config = new AstyanaxConfigurationImpl()
+ .setDiscoveryType( NodeDiscoveryType.valueOf( cassandraFig.getDiscoveryType() ) )
+ .setTargetCassandraVersion( cassandraFig.getVersion() )
+ .setDefaultReadConsistencyLevel( cassandraConfig.getReadCL() )
+ .setDefaultWriteConsistencyLevel( cassandraConfig.getWriteCL() );
+
+
+ if(cassandraFig.useSharedPoolForLocks()){
+
+ ConnectionPoolConfiguration sharedPoolConfig =
+ getConnectionPoolConfig( "ConnectionPool-Shared", cassandraFig.getConnections());
+
+ AstyanaxContext<Cluster> sharedClusterContext =
+ getCluster( cassandraFig.getClusterName(), config, sharedPoolConfig );
+
+ sharedClusterContext.start();
+ Cluster sharedCluster = sharedClusterContext.getClient();
+
+
+ try {
+ addKeyspace( sharedCluster, cassandraFig.getApplicationKeyspace());
+ addKeyspace( sharedCluster, cassandraFig.getLocksKeyspace());
+ } catch (Exception e) {
+ throw new RuntimeException( "Unable to create keyspace clients");
+ }
+
+
+
+ }else{
+
+ ConnectionPoolConfiguration applicationPoolConfig =
+ getConnectionPoolConfig( "ConnectionPool-Application", cassandraFig.getConnections());
+
+ ConnectionPoolConfiguration locksPoolConfig =
+ getConnectionPoolConfig( "ConnectionPool-Locks", cassandraFig.getConnectionsLocks());
+
+ AstyanaxContext<Cluster> applicationClusterContext =
+ getCluster( cassandraFig.getClusterName(), config, applicationPoolConfig );
+
+ AstyanaxContext<Cluster> locksClusterContext =
+ getCluster( cassandraFig.getClusterName() + "-Locks", config, locksPoolConfig );
+
+
+ applicationClusterContext.start();
+ locksClusterContext.start();
+
+ Cluster applicationCluster = applicationClusterContext.getClient();
+ Cluster locksCluster = locksClusterContext.getClient();
+
+
+ try {
+ addKeyspace( applicationCluster, cassandraFig.getApplicationKeyspace());
+ addKeyspace( locksCluster, cassandraFig.getLocksKeyspace());
+ } catch (Exception e) {
+ throw new RuntimeException( "Unable to create keyspace clients");
+ }
+
+
+ }
+
+
+
+ }
+
+
+ @Override
+ public Map<String, Keyspace> getKeyspaces() {
+
+ return keyspaces;
+
+ }
+
+
+ @Override
+ public Keyspace getApplicationKeyspace() {
+
+ return keyspaces.get( cassandraFig.getApplicationKeyspace() );
+
+ }
+
+ @Override
+ public Keyspace getLocksKeyspace() {
+
+ return keyspaces.get( cassandraFig.getLocksKeyspace() );
+
+ }
+
+
+
+
+
+
+ private ConnectionPoolConfiguration getConnectionPoolConfig ( final String poolName, final int poolSize ){
+
+ return new ConnectionPoolConfigurationImpl( poolName )
+ .setPort( cassandraFig.getThriftPort() )
+ .setLocalDatacenter( cassandraFig.getLocalDataCenter() )
+ .setMaxConnsPerHost( poolSize )
+ .setSeeds( cassandraFig.getHosts() )
+ .setSocketTimeout( cassandraFig.getTimeout() );
+
+ }
+
+ private AstyanaxContext<Cluster> getCluster ( final String clusterName,
+ final AstyanaxConfiguration astyanaxConfiguration,
+ final ConnectionPoolConfiguration poolConfig ) {
+
+ return new AstyanaxContext.Builder().forCluster( clusterName )
+ .withAstyanaxConfiguration( astyanaxConfiguration )
+ .withConnectionPoolConfiguration( poolConfig )
+ .withConnectionPoolMonitor( new Slf4jConnectionPoolMonitorImpl())
+ .buildCluster( ThriftFamilyFactory.getInstance() );
+
+ }
+
+ private void addKeyspace (Cluster cluster, String keyspaceName) throws Exception {
+
+ try {
+ keyspaces.put( keyspaceName, cluster.getKeyspace( keyspaceName ) );
+ } catch (ConnectionException e) {
+
+ logger.error("Unable to get keyspace client for keyspace: {}, detail: {}",
+ keyspaceName,
+ e.getMessage());
+
+ throw e;
+ }
+
+
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
index 2dc4876..d7cd57a 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
@@ -32,16 +32,26 @@ import org.safehaus.guicyfig.Key;
@FigSingleton
public interface CassandraFig extends GuicyFig {
+ // main application cassandra properties
+ String READ_CONSISTENT_CL = "usergrid.consistent.read.cl";
+ String READ_CL = "usergrid.read.cl";
+ String WRITE_CL = "usergrid.write.cl";
+ String SHARD_VALUES = "cassandra.shardvalues";
+ String THRIFT_TRANSPORT_SIZE = "cassandra.thrift.transport.frame";
- public static final String READ_CONSISTENT_CL = "usergrid.consistent.read.cl";
+ // locks cassandra properties
+ String LOCKS_KEYSPACE_NAME = "cassandra.lock.keyspace";
+ String LOCKS_KEYSPACE_REPLICATION = "cassandra.lock.keyspace.replication";
+ String LOCKS_KEYSPACE_STRATEGY = "cassandra.lock.keyspace.strategy";
+ String LOCKS_READ_CL = "cassandra.lock.readcl";
+ String LOCKS_WRITE_CL = "cassandra.lock.writecl";
+ String LOCKS_SHARED_POOL_FLAG = "cassandra.lock.use_shared_pool";
+ String LOCKS_CONNECTIONS = "cassandra.lock.connections";
- public static final String READ_CL = "usergrid.read.cl";
- public static final String WRITE_CL = "usergrid.write.cl";
- public static final String SHARD_VALUES = "cassandra.shardvalues";
-
- public static final String THRIFT_TRANSPORT_SIZE = "cassandra.thrift.transport.frame";
+ // re-usable default values
+ String DEFAULT_CONNECTION_POOLSIZE = "15";
@Key( "cassandra.hosts" )
@@ -67,7 +77,7 @@ public interface CassandraFig extends GuicyFig {
String getLocalDataCenter();
@Key( "cassandra.connections" )
- @Default( "15" )
+ @Default( DEFAULT_CONNECTION_POOLSIZE )
int getConnections();
@Key( "cassandra.timeout" )
@@ -111,5 +121,53 @@ public interface CassandraFig extends GuicyFig {
int getThriftBufferSize();
+ /**
+ * Returns the name of the keyspace that should be used for Locking
+ */
+ @Key( LOCKS_KEYSPACE_NAME )
+ @Default("Locks")
+ String getLocksKeyspace();
+
+ /**
+ * Returns the Astyanax consistency level for reading a Lock
+ */
+ @Key( LOCKS_READ_CL )
+ @Default("CL_QUORUM")
+ String getLocksReadCl();
+
+ /**
+ * Returns the Astyanax consistency level for writing a Lock
+ */
+ @Key( LOCKS_WRITE_CL )
+ @Default("CL_QUORUM")
+ String getLocksWriteCl();
+
+ /**
+ * Returns a flag on whether or not to share the connection pool with other keyspaces
+ */
+ @Key( LOCKS_SHARED_POOL_FLAG )
+ @Default("true")
+ boolean useSharedPoolForLocks();
+
+ /**
+ * Returns a flag on whether or not to share the connection pool with other keyspaces
+ */
+ @Key( LOCKS_CONNECTIONS )
+ @Default( DEFAULT_CONNECTION_POOLSIZE )
+ int getConnectionsLocks();
+
+ /**
+ * Returns a flag on whether or not to share the connection pool with other keyspaces
+ */
+ @Key( LOCKS_KEYSPACE_REPLICATION )
+ @Default("replication_factor:1")
+ String getLocksKeyspaceReplication();
+
+ /**
+ * Returns a flag on whether or not to share the connection pool with other keyspaces
+ */
+ @Key( LOCKS_KEYSPACE_STRATEGY )
+ @Default( "org.apache.cassandra.locator.SimpleStrategy" )
+ String getLocksKeyspaceStrategy();
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CommonModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CommonModule.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CommonModule.java
index 75e2b29..f7a9926 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CommonModule.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/guice/CommonModule.java
@@ -19,12 +19,10 @@
package org.apache.usergrid.persistence.core.guice;
+import com.netflix.astyanax.Keyspace;
+import org.apache.usergrid.persistence.core.astyanax.*;
import org.safehaus.guicyfig.GuicyFigModule;
-import org.apache.usergrid.persistence.core.astyanax.AstyanaxKeyspaceProvider;
-import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
-import org.apache.usergrid.persistence.core.astyanax.CassandraConfigImpl;
-import org.apache.usergrid.persistence.core.astyanax.CassandraFig;
import org.apache.usergrid.persistence.core.consistency.TimeService;
import org.apache.usergrid.persistence.core.consistency.TimeServiceImpl;
import org.apache.usergrid.persistence.core.guicyfig.ClusterFig;
@@ -46,7 +44,6 @@ import org.apache.usergrid.persistence.core.migration.schema.MigrationManagerImp
import com.google.inject.AbstractModule;
import com.google.inject.Key;
import com.google.inject.multibindings.Multibinder;
-import com.netflix.astyanax.Keyspace;
/**
@@ -57,9 +54,13 @@ public class CommonModule extends AbstractModule {
@Override
protected void configure() {
+
//noinspection unchecked
install(new GuicyFigModule(MigrationManagerFig.class, CassandraFig.class));
+ // bind our Cassandra cluster to the Astyanax Implementation
+ bind(CassandraCluster.class).to(CassandraClusterImpl.class).asEagerSingleton();
+
// bind our keyspace to the AstyanaxKeyspaceProvider
bind(Keyspace.class).toProvider(AstyanaxKeyspaceProvider.class).asEagerSingleton();
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
index f1471ac..e02cafe 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/migration/data/MigrationInfoSerializationImpl.java
@@ -26,11 +26,7 @@ import java.util.UUID;
import org.apache.cassandra.db.marshal.BytesType;
import org.apache.cassandra.db.marshal.UTF8Type;
-import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamily;
-import org.apache.usergrid.persistence.core.astyanax.MultiTenantColumnFamilyDefinition;
-import org.apache.usergrid.persistence.core.astyanax.ScopedRowKey;
-import org.apache.usergrid.persistence.core.astyanax.ScopedRowKeySerializer;
-import org.apache.usergrid.persistence.core.astyanax.StringRowCompositeSerializer;
+import org.apache.usergrid.persistence.core.astyanax.*;
import org.apache.usergrid.persistence.core.migration.util.AstayanxUtils;
import org.apache.usergrid.persistence.model.entity.Id;
import org.apache.usergrid.persistence.model.entity.SimpleId;
@@ -78,8 +74,8 @@ public class MigrationInfoSerializationImpl implements MigrationInfoSerializatio
@Inject
- public MigrationInfoSerializationImpl( final Keyspace keyspace ) {
- this.keyspace = keyspace;
+ public MigrationInfoSerializationImpl( final CassandraCluster cassandraCluster ) {
+ this.keyspace = cassandraCluster.getApplicationKeyspace();
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/ColumnNameIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/ColumnNameIteratorTest.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/ColumnNameIteratorTest.java
index d2c6f89..18c9327 100644
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/ColumnNameIteratorTest.java
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/ColumnNameIteratorTest.java
@@ -59,6 +59,9 @@ public class ColumnNameIteratorTest {
@Inject
public CassandraFig cassandraFig;
+ @Inject
+ public CassandraCluster cassandraCluster;
+
protected static Keyspace keyspace;
protected ApplicationScope scope;
@@ -99,7 +102,7 @@ public class ColumnNameIteratorTest {
AstyanaxKeyspaceProvider astyanaxKeyspaceProvider =
- new AstyanaxKeyspaceProvider( cassandraFig, cassandraConfig );
+ new AstyanaxKeyspaceProvider( cassandraCluster );
keyspace = astyanaxKeyspaceProvider.get();
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiKeyColumnNameIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiKeyColumnNameIteratorTest.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiKeyColumnNameIteratorTest.java
index 3c56763..bd1ea55 100644
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiKeyColumnNameIteratorTest.java
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiKeyColumnNameIteratorTest.java
@@ -64,6 +64,9 @@ public class MultiKeyColumnNameIteratorTest {
@Inject
public CassandraFig cassandraFig;
+ @Inject
+ public CassandraCluster cassandraCluster;
+
protected static Keyspace keyspace;
protected ApplicationScope scope;
@@ -104,7 +107,7 @@ public class MultiKeyColumnNameIteratorTest {
AstyanaxKeyspaceProvider astyanaxKeyspaceProvider =
- new AstyanaxKeyspaceProvider( cassandraFig, cassandraConfig );
+ new AstyanaxKeyspaceProvider( cassandraCluster );
keyspace = astyanaxKeyspaceProvider.get();
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIteratorTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIteratorTest.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIteratorTest.java
index d88ebe5..9f5741b 100644
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIteratorTest.java
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIteratorTest.java
@@ -67,6 +67,9 @@ public class MultiRowColumnIteratorTest {
@Inject
public CassandraFig cassandraFig;
+ @Inject
+ public CassandraCluster cassandraCluster;
+
protected static Keyspace keyspace;
protected ApplicationScope scope;
@@ -107,7 +110,7 @@ public class MultiRowColumnIteratorTest {
AstyanaxKeyspaceProvider astyanaxKeyspaceProvider =
- new AstyanaxKeyspaceProvider( cassandraFig, cassandraConfig );
+ new AstyanaxKeyspaceProvider( cassandraCluster );
keyspace = astyanaxKeyspaceProvider.get();
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/TestUtils.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/TestUtils.java b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/TestUtils.java
index 8ee7e36..de2609d 100644
--- a/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/TestUtils.java
+++ b/stack/corepersistence/common/src/test/java/org/apache/usergrid/persistence/core/astyanax/TestUtils.java
@@ -55,7 +55,7 @@ public class TestUtils {
try {
- keyspace.createKeyspace( options );
+ keyspace.createKeyspaceIfNotExists( options );
}
catch ( Throwable t ) {
logger.info( "Error on creating keyspace, ignoring", t );
@@ -68,7 +68,11 @@ public class TestUtils {
public static <K, C> void createColumnFamiliy(final Keyspace keyspace, final ColumnFamily<K, C> columnFamily, final Map<String, Object> options){
try{
- keyspace.createColumnFamily( columnFamily, new HashMap<String, Object>() );
+
+ if(keyspace.describeKeyspace().getColumnFamily(columnFamily.getName()) == null){
+ keyspace.createColumnFamily( columnFamily, new HashMap<String, Object>() );
+ }
+
}catch(Exception e){
logger.error( "Error on creating column family, ignoring" , e);
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 802f7b5..c15ea4b 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -98,6 +98,7 @@
<!-- =================================================================== -->
<amber-version>0.22-incubating</amber-version>
+ <astyanax.version>1.56.49-SNAPSHOT-UG-1</astyanax.version>
<aws.version>1.10.20</aws.version>
<cassandra-version>1.2.18</cassandra-version>
<guava.version>18.0</guava.version>
@@ -1254,6 +1255,12 @@
<version>${io.apigee.gcm.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.netflix.astyanax</groupId>
+ <artifactId>astyanax-recipes</artifactId>
+ <version>${astyanax.version}</version>
+ </dependency>
+
</dependencies>
</dependencyManagement>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/services/src/main/java/org/apache/usergrid/services/ServiceManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/ServiceManagerFactory.java b/stack/services/src/main/java/org/apache/usergrid/services/ServiceManagerFactory.java
index abab195..5274336 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/ServiceManagerFactory.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/ServiceManagerFactory.java
@@ -21,6 +21,8 @@ import java.util.List;
import java.util.Properties;
import java.util.UUID;
+import com.google.inject.Injector;
+import org.apache.usergrid.locking.Lock;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -47,11 +49,11 @@ public class ServiceManagerFactory implements ApplicationContextAware {
public ServiceManagerFactory( EntityManagerFactory emf, Properties properties, SchedulerService schedulerService,
- LockManager lockManager, QueueManagerFactory qmf ) {
+ QueueManagerFactory qmf, final Injector injector ) {
this.emf = emf;
this.properties = properties;
this.schedulerService = schedulerService;
- this.lockManager = lockManager;
+ lockManager = injector.getInstance(LockManager.class);
this.qmf = qmf;
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/services/src/main/resources/usergrid-services-context.xml
----------------------------------------------------------------------
diff --git a/stack/services/src/main/resources/usergrid-services-context.xml b/stack/services/src/main/resources/usergrid-services-context.xml
index a3c353f..02e01ad 100644
--- a/stack/services/src/main/resources/usergrid-services-context.xml
+++ b/stack/services/src/main/resources/usergrid-services-context.xml
@@ -69,11 +69,15 @@
<bean id="saltProvider" class="org.apache.usergrid.security.salt.NoOpSaltProvider" />
+ <bean id="injector"
+ class="org.apache.usergrid.corepersistence.GuiceFactory">
+ </bean>
+
<bean id="serviceManagerFactory" class="org.apache.usergrid.services.ServiceManagerFactory">
<constructor-arg ref="entityManagerFactory" />
<constructor-arg ref="properties" />
<constructor-arg ref="schedulerService"/>
- <constructor-arg ref="lockManager"/>
+ <constructor-arg ref="injector"/>
<constructor-arg ref="queueManagerFactory"/>
</bean>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/71f32747/stack/websocket/src/test/resources/testApplicationContext.xml
----------------------------------------------------------------------
diff --git a/stack/websocket/src/test/resources/testApplicationContext.xml b/stack/websocket/src/test/resources/testApplicationContext.xml
index 8eccb74..8363021 100644
--- a/stack/websocket/src/test/resources/testApplicationContext.xml
+++ b/stack/websocket/src/test/resources/testApplicationContext.xml
@@ -102,14 +102,20 @@
<constructor-arg ref="cassandraCredentials" />
</bean>
- <bean name="lockManager" class="org.apache.usergrid.locking.cassandra.HectorLockManagerImpl" />
+ <!--
+ <bean name="lockManager" class="org.apache.usergrid.locking.cassandra.HectorLockManagerImpl" />
+ -->
+
+ <bean id="injector"
+ class="org.apache.usergrid.corepersistence.GuiceFactory">
+ </bean>
<bean id="cassandraService"
class="org.apache.usergrid.persistence.cassandra.CassandraService" init-method="init">
<constructor-arg ref="properties" />
<constructor-arg ref="cassandraCluster" />
<constructor-arg ref="cassandraHostConfigurator" />
- <constructor-arg ref="lockManager" />
+ <constructor-arg ref="injector" />
</bean>
<bean id="entityManagerFactory"
[06/12] usergrid git commit: Remove commented,
old Hector configuration from Spring context config.
Posted by gr...@apache.org.
Remove commented, old Hector configuration from Spring context config.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/d1c1d01f
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/d1c1d01f
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/d1c1d01f
Branch: refs/heads/master
Commit: d1c1d01fc9ecbfa33493b7c2a8c4c8c155132971
Parents: 8ddc7d9
Author: Michael Russo <mi...@gmail.com>
Authored: Thu Jan 14 13:31:03 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Thu Jan 14 13:31:03 2016 -0800
----------------------------------------------------------------------
.../main/resources/usergrid-core-context.xml | 22 --------------------
1 file changed, 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/d1c1d01f/stack/core/src/main/resources/usergrid-core-context.xml
----------------------------------------------------------------------
diff --git a/stack/core/src/main/resources/usergrid-core-context.xml b/stack/core/src/main/resources/usergrid-core-context.xml
index d413816..fb668fa 100644
--- a/stack/core/src/main/resources/usergrid-core-context.xml
+++ b/stack/core/src/main/resources/usergrid-core-context.xml
@@ -72,33 +72,11 @@
<!-- <bean name="lockManager" class="org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl" /> -->
- <!-- hector based locks -->
- <!-- Note that if this is deployed in a production cluster, the RF on the keyspace MUST
- be updated to use an odd number for it's replication Factor. Even numbers can potentially
- case the locks to fail, via "split brain" when read at QUORUM on lock verification-->
-
- <!-- not using hector anymore
- <bean name="lockManager" class="org.apache.usergrid.locking.cassandra.HectorLockManagerImpl">
- <property name="cluster" ref="cassandraCluster"/>
- <property name="keyspaceName" value="${cassandra.lock.keyspace}"/>
- <property name="consistencyLevelPolicy" ref="hlockConsistencyLevelPolicy" />
- </bean>
-
- <bean name="hlockConsistencyLevelPolicy" class="me.prettyprint.cassandra.model.ConfigurableConsistencyLevel">
- <property name="defaultReadConsistencyLevel" value="${cassandra.lock.readcl}"/>
- <property name="defaultWriteConsistencyLevel" value="${cassandra.lock.writecl}"/>
- </bean>
- -->
<bean id="injector"
class="org.apache.usergrid.corepersistence.GuiceFactory">
</bean>
- <!-- <bean id="injector"
- class="org.apache.usergrid.corepersistence.GuiceFactory">
- <constructor-arg ref="cassandraHostConfigurator" />
- <constructor-arg ref="properties" />
- </bean>-->
<bean id="cassandraService"
class="org.apache.usergrid.persistence.cassandra.CassandraService" init-method="init" destroy-method="destroy">
[05/12] usergrid git commit: Fix new lock manager wiring issues in
services layer.
Posted by gr...@apache.org.
Fix new lock manager wiring issues in services layer.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/8ddc7d98
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/8ddc7d98
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/8ddc7d98
Branch: refs/heads/master
Commit: 8ddc7d98841ffd8ee3d225c1ce07f92f82f64810
Parents: 71f3274
Author: Michael Russo <mi...@gmail.com>
Authored: Thu Jan 14 13:28:52 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Thu Jan 14 13:28:52 2016 -0800
----------------------------------------------------------------------
.../org/apache/usergrid/CoreITSetupImpl.java | 4 +
.../cassandra/ManagementServiceImpl.java | 36 ++---
.../services/guice/ServiceModuleImpl.java | 3 +
.../resources/usergrid-services-context.xml | 131 ++++++++++---------
4 files changed, 87 insertions(+), 87 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8ddc7d98/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
index 6f9b384..64b001c 100644
--- a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
+++ b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java
@@ -20,6 +20,8 @@ package org.apache.usergrid;
import com.google.inject.Injector;
import org.apache.usergrid.cassandra.SpringResource;
import org.apache.usergrid.corepersistence.service.ApplicationService;
+import org.apache.usergrid.locking.Lock;
+import org.apache.usergrid.locking.LockManager;
import org.apache.usergrid.mq.QueueManagerFactory;
import org.apache.usergrid.persistence.Entity;
import org.apache.usergrid.persistence.EntityManagerFactory;
@@ -41,6 +43,7 @@ public class CoreITSetupImpl implements CoreITSetup, TestEntityIndex {
protected EntityManagerFactory emf;
protected QueueManagerFactory qmf;
protected CassandraService cassandraService;
+ protected LockManager lockManager;
protected SpringResource springResource;
@@ -52,6 +55,7 @@ public class CoreITSetupImpl implements CoreITSetup, TestEntityIndex {
emf = springResource.getBean( EntityManagerFactory.class );
qmf = springResource.getBean( QueueManagerFactory.class );
injector = springResource.getBean(Injector.class);
+ lockManager = injector.getInstance(LockManager.class);
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8ddc7d98/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
index a4259f7..4111870 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -65,7 +65,6 @@ import org.apache.usergrid.security.shiro.utils.SubjectUtils;
import org.apache.usergrid.security.tokens.TokenCategory;
import org.apache.usergrid.security.tokens.TokenInfo;
import org.apache.usergrid.security.tokens.TokenService;
-import org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl;
import org.apache.usergrid.security.tokens.exceptions.TokenException;
import org.apache.usergrid.services.*;
import org.apache.usergrid.utils.*;
@@ -155,17 +154,25 @@ public class ManagementServiceImpl implements ManagementService {
@Autowired
protected MailUtils mailUtils;
- @Autowired
- protected Injector injector;
-
protected EncryptionService encryptionService;
protected CacheFactory cacheFactory;
+ protected AggregationServiceFactory aggregationServiceFactory;
+
+ protected ApplicationService service;
+
/** Must be constructed with a CassandraClientPool. */
- public ManagementServiceImpl() {
+ public ManagementServiceImpl(Injector injector) {
+
+ // Use the injector to get our guice dependencies
+ this.lockManager = injector.getInstance(LockManager.class);
+ this.cacheFactory = injector.getInstance( CacheFactory.class );
+ this.aggregationServiceFactory = injector.getInstance(AggregationServiceFactory.class);
+ this.service = injector.getInstance(ApplicationService.class);
+
}
@Autowired
@@ -260,16 +267,6 @@ public class ManagementServiceImpl implements ManagementService {
}
- public LockManager getLockManager() {
- return lockManager;
- }
-
-
- @Autowired
- public void setLockManager( LockManager lockManager ) {
- this.lockManager = lockManager;
- }
-
/** @param encryptionService the encryptionService to set */
@Autowired
@@ -1664,7 +1661,7 @@ public class ManagementServiceImpl implements ManagementService {
EntityManager em = emf.getEntityManager( smf.getManagementAppId() );
-
+
if(em.getCollection(organization.getUuid() ,"users",Query.fromQL( "select * where uuid ="+user.getUuid() ),Level.IDS ).size() >0){
if(logger.isDebugEnabled()) {
logger.debug( "Found value: {} already in collection", user.getName() );
@@ -1757,9 +1754,6 @@ public class ManagementServiceImpl implements ManagementService {
+ ")</a> created a new application named " + applicationName, null );
}
- if ( cacheFactory == null ) {
- cacheFactory = injector.getInstance( CacheFactory.class );
- }
ScopedCache scopedCache = cacheFactory.getScopedCache(
new CacheScope( new SimpleId( CpNamingUtils.MANAGEMENT_APPLICATION_ID, "application" )));
scopedCache.invalidate();
@@ -1830,7 +1824,6 @@ public class ManagementServiceImpl implements ManagementService {
@Override
public long getApplicationSize(final UUID applicationId) {
- AggregationServiceFactory aggregationServiceFactory = injector.getInstance(AggregationServiceFactory.class);
AggregationService aggregationService = aggregationServiceFactory.getAggregationService();
ApplicationScope applicationScope =CpNamingUtils.getApplicationScope(applicationId);
return aggregationService.getApplicationSize(applicationScope);
@@ -1838,7 +1831,6 @@ public class ManagementServiceImpl implements ManagementService {
@Override
public Map<String,Long> getEachCollectionSize(final UUID applicationId) {
- AggregationServiceFactory aggregationServiceFactory = injector.getInstance(AggregationServiceFactory.class);
AggregationService aggregationService = aggregationServiceFactory.getAggregationService();
ApplicationScope applicationScope =CpNamingUtils.getApplicationScope(applicationId);
return aggregationService.getEachCollectionSize(applicationScope);
@@ -1846,7 +1838,6 @@ public class ManagementServiceImpl implements ManagementService {
@Override
public long getCollectionSize(final UUID applicationId, final String collectionName) {
- AggregationServiceFactory aggregationServiceFactory = injector.getInstance(AggregationServiceFactory.class);
AggregationService aggregationService = aggregationServiceFactory.getAggregationService();
ApplicationScope applicationScope =CpNamingUtils.getApplicationScope(applicationId);
return aggregationService.getSize(applicationScope,
@@ -3249,7 +3240,6 @@ public class ManagementServiceImpl implements ManagementService {
throw new IllegalArgumentException("Can't delete from management app");
}
- ApplicationService service = injector.getInstance(ApplicationService.class);
return service.deleteAllEntities(CpNamingUtils.getApplicationScope(applicationId),limit);
}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8ddc7d98/stack/services/src/main/java/org/apache/usergrid/services/guice/ServiceModuleImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/guice/ServiceModuleImpl.java b/stack/services/src/main/java/org/apache/usergrid/services/guice/ServiceModuleImpl.java
index 5ce19e0..58b301a 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/guice/ServiceModuleImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/guice/ServiceModuleImpl.java
@@ -24,6 +24,7 @@ import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.usergrid.corepersistence.ServiceModule;
+import org.apache.usergrid.locking.guice.LockModule;
import org.apache.usergrid.management.AppInfoMigrationPlugin;
import org.apache.usergrid.persistence.cache.CacheFactory;
import org.apache.usergrid.persistence.cache.impl.CacheFactoryImpl;
@@ -50,6 +51,8 @@ public class ServiceModuleImpl extends AbstractModule implements ServiceModule {
@Override
protected void configure() {
+ install(new LockModule());
+
//Seems weird, aren't we just binding the factory to the exact same factory when it goes to look for it?
final Multibinder<MigrationPlugin> plugins = Multibinder.newSetBinder( binder(), MigrationPlugin.class );
plugins.addBinding().to(AppInfoMigrationPlugin.class);
http://git-wip-us.apache.org/repos/asf/usergrid/blob/8ddc7d98/stack/services/src/main/resources/usergrid-services-context.xml
----------------------------------------------------------------------
diff --git a/stack/services/src/main/resources/usergrid-services-context.xml b/stack/services/src/main/resources/usergrid-services-context.xml
index 02e01ad..c41080d 100644
--- a/stack/services/src/main/resources/usergrid-services-context.xml
+++ b/stack/services/src/main/resources/usergrid-services-context.xml
@@ -16,115 +16,118 @@
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
- xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
+ xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
- <context:component-scan base-package="org.apache.usergrid.services" />
+ <context:component-scan base-package="org.apache.usergrid.services"/>
- <import resource="classpath:/usergrid-core-context.xml" />
+ <import resource="classpath:/usergrid-core-context.xml"/>
- <!-- scan for security -->
- <context:component-scan base-package="org.apache.usergrid.security.crypto" />
+ <!-- scan for security -->
+ <context:component-scan base-package="org.apache.usergrid.security.crypto"/>
<!--
<bean id="cacheManager" class="org.apache.shiro.cache.MemoryConstrainedCacheManager"/>
-->
<bean id="cacheManager" class="org.apache.usergrid.security.shiro.ShiroCacheManager">
- <property name="properties" ref="properties" />
+ <property name="properties" ref="properties"/>
</bean>
- <bean id="realm" class="org.apache.usergrid.security.shiro.Realm">
- <property name="name" value="realm" />
- <property name="cacheManager" ref="cacheManager" />
- </bean>
+ <bean id="realm" class="org.apache.usergrid.security.shiro.Realm">
+ <property name="name" value="realm"/>
+ <property name="cacheManager" ref="cacheManager"/>
+ </bean>
- <bean id="securityManager" class="org.apache.shiro.mgt.DefaultSecurityManager">
- <property name="realm" ref="realm" />
- </bean>
+ <bean id="securityManager" class="org.apache.shiro.mgt.DefaultSecurityManager">
+ <property name="realm" ref="realm"/>
+ </bean>
- <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor" />
+ <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
- <bean
- class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
- <property name="staticMethod"
- value="org.apache.shiro.SecurityUtils.setSecurityManager" />
- <property name="arguments" ref="securityManager" />
- </bean>
+ <bean
+ class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
+ <property name="staticMethod"
+ value="org.apache.shiro.SecurityUtils.setSecurityManager"/>
+ <property name="arguments" ref="securityManager"/>
+ </bean>
- <bean id="taskExecutor" class="org.springframework.core.task.SyncTaskExecutor"/>
+ <bean id="taskExecutor" class="org.springframework.core.task.SyncTaskExecutor"/>
- <bean id="tokenService" class="org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl">
+ <bean id="tokenService" class="org.apache.usergrid.security.tokens.cassandra.TokenServiceImpl">
<property name="cassandraService" ref="cassandraService"/>
<property name="entityManagerFactory" ref="entityManagerFactory"/>
- </bean>
-
- <bean id="managementService" class="org.apache.usergrid.management.cassandra.ManagementServiceImpl" >
- <property name="saltProvider" ref="saltProvider"/>
- </bean>
-
- <bean id="saltProvider" class="org.apache.usergrid.security.salt.NoOpSaltProvider" />
+ </bean>
<bean id="injector"
class="org.apache.usergrid.corepersistence.GuiceFactory">
</bean>
- <bean id="serviceManagerFactory" class="org.apache.usergrid.services.ServiceManagerFactory">
- <constructor-arg ref="entityManagerFactory" />
- <constructor-arg ref="properties" />
- <constructor-arg ref="schedulerService"/>
+ <bean id="managementService" class="org.apache.usergrid.management.cassandra.ManagementServiceImpl">
+ <property name="saltProvider" ref="saltProvider"/>
+ <constructor-arg ref="injector"/>
+ </bean>
+
+ <bean id="saltProvider" class="org.apache.usergrid.security.salt.NoOpSaltProvider"/>
+
+
+
+ <bean id="serviceManagerFactory" class="org.apache.usergrid.services.ServiceManagerFactory">
+ <constructor-arg ref="entityManagerFactory"/>
+ <constructor-arg ref="properties"/>
+ <constructor-arg ref="schedulerService"/>
<constructor-arg ref="injector"/>
<constructor-arg ref="queueManagerFactory"/>
- </bean>
+ </bean>
- <bean id="applicationCreator"
- class="org.apache.usergrid.management.cassandra.ApplicationCreatorImpl">
- <constructor-arg ref="entityManagerFactory" />
- <constructor-arg ref="managementService" />
- </bean>
+ <bean id="applicationCreator"
+ class="org.apache.usergrid.management.cassandra.ApplicationCreatorImpl">
+ <constructor-arg ref="entityManagerFactory"/>
+ <constructor-arg ref="managementService"/>
+ </bean>
<bean id="signInProviderFactory" class="org.apache.usergrid.security.providers.SignInProviderFactory">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
<property name="managementService" ref="managementService"/>
</bean>
- <bean id="exportService" class="org.apache.usergrid.management.export.ExportServiceImpl" >
- <property name="managementService" ref="managementService"/>
- <property name="emf" ref="entityManagerFactory"/>
- <property name="sch" ref="schedulerService"/>
- </bean>
+ <bean id="exportService" class="org.apache.usergrid.management.export.ExportServiceImpl">
+ <property name="managementService" ref="managementService"/>
+ <property name="emf" ref="entityManagerFactory"/>
+ <property name="sch" ref="schedulerService"/>
+ </bean>
- <bean id="exportJob" class="org.apache.usergrid.management.export.ExportJob" />
+ <bean id="exportJob" class="org.apache.usergrid.management.export.ExportJob"/>
- <bean id="serviceModule" class="org.apache.usergrid.services.guice.ServiceModuleImpl" />
+ <bean id="serviceModule" class="org.apache.usergrid.services.guice.ServiceModuleImpl"/>
<bean id="notificationsQueueListener" class="org.apache.usergrid.services.notifications.QueueListener">
- <constructor-arg name="emf" ref="entityManagerFactory" />
- <constructor-arg name="props" ref="properties" />
- <constructor-arg name="smf" ref="serviceManagerFactory" />
- </bean>
+ <constructor-arg name="emf" ref="entityManagerFactory"/>
+ <constructor-arg name="props" ref="properties"/>
+ <constructor-arg name="smf" ref="serviceManagerFactory"/>
+ </bean>
- <bean id="importService" class="org.apache.usergrid.management.importer.ImportServiceImpl" >
- <property name="managementService" ref="managementService"/>
- <property name="emf" ref="entityManagerFactory"/>
- <property name="sch" ref="schedulerService"/>
- </bean>
+ <bean id="importService" class="org.apache.usergrid.management.importer.ImportServiceImpl">
+ <property name="managementService" ref="managementService"/>
+ <property name="emf" ref="entityManagerFactory"/>
+ <property name="sch" ref="schedulerService"/>
+ </bean>
<!--<bean id="importQueueListener" class="org.apache.usergrid.services.queues.ImportQueueListener"-->
- <!--scope="singleton">-->
- <!--<constructor-arg orgAppName="emf" ref="entityManagerFactory" />-->
- <!--<constructor-arg orgAppName="metricsService" ref="metricsFactory" />-->
- <!--<constructor-arg orgAppName="smf" ref="serviceManagerFactory" />-->
- <!--<constructor-arg orgAppName="props" ref="properties" />-->
+ <!--scope="singleton">-->
+ <!--<constructor-arg orgAppName="emf" ref="entityManagerFactory" />-->
+ <!--<constructor-arg orgAppName="metricsService" ref="metricsFactory" />-->
+ <!--<constructor-arg orgAppName="smf" ref="serviceManagerFactory" />-->
+ <!--<constructor-arg orgAppName="props" ref="properties" />-->
<!--</bean>-->
- <bean id="importJob" class="org.apache.usergrid.management.importer.ImportJob" />
- <bean id="fileImportJob" class="org.apache.usergrid.management.importer.FileImportJob" />
+ <bean id="importJob" class="org.apache.usergrid.management.importer.ImportJob"/>
+ <bean id="fileImportJob" class="org.apache.usergrid.management.importer.FileImportJob"/>
</beans>
[08/12] usergrid git commit: Simplify the locks consistency level and
default it to LQ in case something passed cannot be parsed to a valid
consistency level.
Posted by gr...@apache.org.
Simplify the locks consistency level and default it to LQ in case something passed cannot be parsed to a valid consistency level.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/56850926
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/56850926
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/56850926
Branch: refs/heads/master
Commit: 56850926ba430c756b348195ffd013e10f09c6e8
Parents: 973f5a7
Author: Michael Russo <mi...@gmail.com>
Authored: Thu Jan 14 16:36:57 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Thu Jan 14 16:36:57 2016 -0800
----------------------------------------------------------------------
.../locking/cassandra/AstyanaxLockManagerImpl.java | 13 ++++++++++++-
.../persistence/core/astyanax/CassandraFig.java | 16 ++++------------
2 files changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56850926/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
index 1786d72..f310118 100644
--- a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
@@ -24,6 +24,7 @@ import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import com.netflix.astyanax.ddl.ColumnFamilyDefinition;
import com.netflix.astyanax.ddl.KeyspaceDefinition;
import com.netflix.astyanax.model.ColumnFamily;
+import com.netflix.astyanax.model.ConsistencyLevel;
import com.netflix.astyanax.recipes.locks.ColumnPrefixDistributedRowLock;
import com.netflix.astyanax.serializers.StringSerializer;
import org.apache.cassandra.db.marshal.BytesType;
@@ -72,9 +73,19 @@ public class AstyanaxLockManagerImpl implements LockManager {
String lockPath = LockPathBuilder.buildPath( applicationId, path );
+ ConsistencyLevel consistencyLevel;
+ try{
+ consistencyLevel = ConsistencyLevel.valueOf(cassandraFig.getLocksCl());
+ }catch(IllegalArgumentException e){
+
+ // just default it to local quorum if we can't parse
+ consistencyLevel = ConsistencyLevel.CL_LOCAL_QUORUM;
+ }
+
ColumnPrefixDistributedRowLock<String> lock =
new ColumnPrefixDistributedRowLock<>(keyspace, columnFamily, lockPath)
- .expireLockAfter( Integer.MAX_VALUE, TimeUnit.MILLISECONDS);
+ .expireLockAfter( Integer.MAX_VALUE, TimeUnit.MILLISECONDS)
+ .withConsistencyLevel(consistencyLevel);
return new AstyanaxLockImpl( lock );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/56850926/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
index d7cd57a..caee5c1 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/CassandraFig.java
@@ -43,8 +43,7 @@ public interface CassandraFig extends GuicyFig {
String LOCKS_KEYSPACE_NAME = "cassandra.lock.keyspace";
String LOCKS_KEYSPACE_REPLICATION = "cassandra.lock.keyspace.replication";
String LOCKS_KEYSPACE_STRATEGY = "cassandra.lock.keyspace.strategy";
- String LOCKS_READ_CL = "cassandra.lock.readcl";
- String LOCKS_WRITE_CL = "cassandra.lock.writecl";
+ String LOCKS_CL = "cassandra.lock.cl";
String LOCKS_SHARED_POOL_FLAG = "cassandra.lock.use_shared_pool";
String LOCKS_CONNECTIONS = "cassandra.lock.connections";
@@ -129,18 +128,11 @@ public interface CassandraFig extends GuicyFig {
String getLocksKeyspace();
/**
- * Returns the Astyanax consistency level for reading a Lock
- */
- @Key( LOCKS_READ_CL )
- @Default("CL_QUORUM")
- String getLocksReadCl();
-
- /**
* Returns the Astyanax consistency level for writing a Lock
*/
- @Key( LOCKS_WRITE_CL )
- @Default("CL_QUORUM")
- String getLocksWriteCl();
+ @Key(LOCKS_CL)
+ @Default("CL_LOCAL_QUORUM")
+ String getLocksCl();
/**
* Returns a flag on whether or not to share the connection pool with other keyspaces
[09/12] usergrid git commit: Remove unused SingleNodeLockImpl and any
references to this.
Posted by gr...@apache.org.
Remove unused SingleNodeLockImpl and any references to this.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/0071df0e
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/0071df0e
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/0071df0e
Branch: refs/heads/master
Commit: 0071df0e235181f47ac370257b99c4de1d7705f7
Parents: 5685092
Author: Michael Russo <mi...@gmail.com>
Authored: Thu Jan 14 18:53:14 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Thu Jan 14 18:53:14 2016 -0800
----------------------------------------------------------------------
.../src/main/dist/lib/log4j.properties | 1 -
.../locking/singlenode/SingleNodeLockImpl.java | 71 --------
.../singlenode/SingleNodeLockManagerImpl.java | 96 -----------
.../main/resources/usergrid-core-context.xml | 5 -
.../locking/SingleNodeLockTestSingleNode.java | 163 -------------------
stack/core/src/test/resources/log4j.properties | 1 -
stack/rest/src/test/resources/log4j.properties | 1 -
.../src/test/resources/log4j.properties | 1 -
stack/tools/src/main/resources/log4j.properties | 1 -
9 files changed, 340 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0071df0e/stack/awscluster/src/main/dist/lib/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/dist/lib/log4j.properties b/stack/awscluster/src/main/dist/lib/log4j.properties
index 52f99ce..013563b 100644
--- a/stack/awscluster/src/main/dist/lib/log4j.properties
+++ b/stack/awscluster/src/main/dist/lib/log4j.properties
@@ -37,7 +37,6 @@ log4j.logger.org.apache.usergrid.persistence.cassandra.ConnectionRefImpl=WARN, s
log4j.logger.me.prettyprint.cassandra.hector.TimingLogger=WARN, stdout
log4j.logger.org.apache.usergrid.rest.security.AllowAjaxFilter=WARN, stdout
log4j.logger.me.prettyprint.hector.api.beans.AbstractComposite=ERROR, stdout
-log4j.logger.org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl=DEBUG, stdout
#log4j.logger.org.apache.usergrid.persistence=INFO
#log4j.logger.org.apache.usergrid.corepersistence=DEBUG
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0071df0e/stack/core/src/main/java/org/apache/usergrid/locking/singlenode/SingleNodeLockImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/singlenode/SingleNodeLockImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/singlenode/SingleNodeLockImpl.java
deleted file mode 100644
index 109307d..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/locking/singlenode/SingleNodeLockImpl.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.usergrid.locking.singlenode;
-
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.apache.usergrid.locking.Lock;
-import org.apache.usergrid.locking.exception.UGLockException;
-
-
-/** @author tnine */
-public class SingleNodeLockImpl implements Lock {
-
- private final ReentrantLock lock;
-
-
- /**
- *
- */
- public SingleNodeLockImpl( ReentrantLock lock ) {
- this.lock = lock;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.locking.Lock#acquire(long)
- */
- @Override
- public boolean tryLock( long timeout, TimeUnit time ) throws UGLockException {
- try {
- return this.lock.tryLock( timeout, time );
- }
- catch ( InterruptedException e ) {
- throw new UGLockException( "Couldn't get the lock", e );
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.locking.Lock#lock()
- */
- @Override
- public void lock() throws UGLockException {
- this.lock.lock();
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.locking.Lock#release()
- */
- @Override
- public void unlock() throws UGLockException {
- this.lock.unlock();
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0071df0e/stack/core/src/main/java/org/apache/usergrid/locking/singlenode/SingleNodeLockManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/singlenode/SingleNodeLockManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/singlenode/SingleNodeLockManagerImpl.java
deleted file mode 100644
index de33772..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/locking/singlenode/SingleNodeLockManagerImpl.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.usergrid.locking.singlenode;
-
-
-import java.util.UUID;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.usergrid.locking.Lock;
-import org.apache.usergrid.locking.LockManager;
-import org.apache.usergrid.locking.LockPathBuilder;
-
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.cache.RemovalListener;
-import com.google.common.cache.RemovalNotification;
-
-
-/**
- * Single Node implementation for {@link LockManager} Note that this implementation has not been used in a production
- * environment.
- * <p/>
- * The hector based implementation is the preferred production locking system
- */
-public class SingleNodeLockManagerImpl implements LockManager {
-
- private static final Logger logger = LoggerFactory.getLogger( SingleNodeLockManagerImpl.class );
-
- public static final long MILLI_EXPIRATION = 5000;
-
- /** Lock cache that sill expire after 5 seconds of no use for a lock path */
- private LoadingCache<String, ReentrantLock> locks =
- CacheBuilder.newBuilder().expireAfterWrite( MILLI_EXPIRATION, TimeUnit.MILLISECONDS )
- // use weakValues. We want want entries removed if they're not being
- // referenced by another
- // thread somewhere and GC occurs
- .weakValues().removalListener( new RemovalListener<String, ReentrantLock>() {
-
- @Override
- public void onRemoval( RemovalNotification<String, ReentrantLock> notification ) {
- if (logger.isDebugEnabled()) {
- logger.debug("Evicting reentrant lock for {}", notification.getKey());
- }
- }
- } ).build( new CacheLoader<String, ReentrantLock>() {
-
- @Override
- public ReentrantLock load( String arg0 ) throws Exception {
- return new ReentrantLock( true );
- }
- } );
-
-
- /** Default constructor. */
- public SingleNodeLockManagerImpl() {
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.usergrid.locking.LockManager#createLock(java.util.UUID,
- * java.lang.String[])
- */
- @Override
- public Lock createLock( UUID applicationId, String... path ) {
-
- String lockPath = LockPathBuilder.buildPath( applicationId, path );
-
- try {
- return new SingleNodeLockImpl( locks.get( lockPath ) );
- }
- catch ( ExecutionException e ) {
- throw new RuntimeException( "Unable to create lock in cache", e );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0071df0e/stack/core/src/main/resources/usergrid-core-context.xml
----------------------------------------------------------------------
diff --git a/stack/core/src/main/resources/usergrid-core-context.xml b/stack/core/src/main/resources/usergrid-core-context.xml
index fb668fa..1087f25 100644
--- a/stack/core/src/main/resources/usergrid-core-context.xml
+++ b/stack/core/src/main/resources/usergrid-core-context.xml
@@ -68,11 +68,6 @@
<bean id="loadBalancingPolicy" class="me.prettyprint.cassandra.connection.DynamicLoadBalancingPolicy"/>
- <!-- locking for a single node -->
-
- <!-- <bean name="lockManager" class="org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl" /> -->
-
-
<bean id="injector"
class="org.apache.usergrid.corepersistence.GuiceFactory">
</bean>
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0071df0e/stack/core/src/test/java/org/apache/usergrid/locking/SingleNodeLockTestSingleNode.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/locking/SingleNodeLockTestSingleNode.java b/stack/core/src/test/java/org/apache/usergrid/locking/SingleNodeLockTestSingleNode.java
deleted file mode 100644
index ba7b48d..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/locking/SingleNodeLockTestSingleNode.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.usergrid.locking;
-
-
-import org.apache.usergrid.locking.exception.UGLockException;
-import org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.UUID;
-import java.util.concurrent.*;
-
-import static org.junit.Assert.assertTrue;
-
-
-public class SingleNodeLockTestSingleNode {
-
- private static final Logger logger = LoggerFactory.getLogger( SingleNodeLockTestSingleNode.class );
-
- private LockManager manager;
-
- private ExecutorService pool;
-
-
- @Before
- public void setUp() throws Exception {
-
- manager = new SingleNodeLockManagerImpl();
-
- // Create a different thread to lock the same node, that is held by the main
- // thread.
- pool = Executors.newFixedThreadPool( 1 );
- }
-
-
- @After
- public void tearDown() throws Exception {
- pool.shutdownNow();
- }
-
-
- /** Locks a path and launches a thread which also locks the same path. */
- @Test
- public void testLock() throws InterruptedException, ExecutionException, UGLockException {
-
- final UUID application = UUID.randomUUID();
- final UUID entity = UUID.randomUUID();
-
- logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
-
- // Lock a node twice to test reentrancy and validate.
- Lock lock = manager.createLock( application, entity.toString() );
- lock.lock();
- lock.lock();
-
- boolean wasLocked = lockInDifferentThread( application, entity );
- Assert.assertEquals( false, wasLocked );
-
- // Unlock once
- lock.unlock();
-
- // Try from the thread expecting to fail since we still hold one reentrant
- // lock.
- wasLocked = lockInDifferentThread( application, entity );
- Assert.assertEquals( false, wasLocked );
-
- // Unlock completely
- logger.info( "Releasing lock:" + application.toString() + "/" + entity.toString() );
- lock.unlock();
-
- // Try to effectively get the lock from the thread since the current one has
- // already released it.
- wasLocked = lockInDifferentThread( application, entity );
- Assert.assertEquals( true, wasLocked );
- }
-
-
- /** Locks a couple of times and try to clean up. Later oin another thread successfully acquire the lock */
- @Test
- public void testLock2() throws InterruptedException, ExecutionException, UGLockException {
-
- final UUID application = UUID.randomUUID();
- final UUID entity = UUID.randomUUID();
- final UUID entity2 = UUID.randomUUID();
-
- logger.info( "Locking:" + application.toString() + "/" + entity.toString() );
-
- // Acquire to locks. One of them twice.
- Lock lock = manager.createLock( application, entity.toString() );
- lock.lock();
- lock.lock();
-
- Lock second = manager.createLock( application, entity2.toString() );
- second.lock();
-
- // Cleanup the locks for main thread
- logger.info( "Cleaning up locks for current thread..." );
- lock.unlock();
- lock.unlock();
-
- second.unlock();
-
- boolean locked = lockInDifferentThread( application, entity );
- assertTrue( locked );
-
- locked = lockInDifferentThread( application, entity2 );
- assertTrue( locked );
- }
-
-
- /** Acquires a lock in a different thread. */
- private boolean lockInDifferentThread( final UUID application, final UUID entity ) {
- Future<Boolean> status = pool.submit( new Callable<Boolean>() {
-
- @Override
- public Boolean call() throws Exception {
-
- Lock lock = manager.createLock( application, entity.toString() );
-
- // False here means that the lock WAS NOT ACQUIRED. And that is
- // what we expect.
-
- boolean locked = lock.tryLock( 0, TimeUnit.MILLISECONDS );
-
- // shouldn't lock, so unlock to avoid polluting future tests
- if ( locked ) {
- lock.unlock();
- }
-
- return locked;
- }
- } );
-
- boolean wasLocked = true;
- try {
- wasLocked = status.get( 2, TimeUnit.SECONDS );
- }
- catch ( Exception e ) {
- wasLocked = false;
- }
-
- return wasLocked;
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0071df0e/stack/core/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/core/src/test/resources/log4j.properties b/stack/core/src/test/resources/log4j.properties
index 4267293..714f2f7 100644
--- a/stack/core/src/test/resources/log4j.properties
+++ b/stack/core/src/test/resources/log4j.properties
@@ -38,7 +38,6 @@ log4j.logger.org.apache.usergrid.persistence.cassandra.ConnectionRefImpl=WARN, s
log4j.logger.me.prettyprint.cassandra.hector.TimingLogger=WARN, stdout
log4j.logger.org.apache.usergrid.rest.security.AllowAjaxFilter=WARN, stdout
log4j.logger.me.prettyprint.hector.api.beans.AbstractComposite=ERROR, stdout
-log4j.logger.org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl=DEBUG, stdout
log4j.logger.org.apache.usergrid.persistence.PerformanceEntityReadTest=DEBUG
log4j.logger.org.apache.usergrid.persistence.PerformanceEntityRebuildIndexTest=DEBUG
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0071df0e/stack/rest/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/resources/log4j.properties b/stack/rest/src/test/resources/log4j.properties
index 33a25c4..812fc12 100644
--- a/stack/rest/src/test/resources/log4j.properties
+++ b/stack/rest/src/test/resources/log4j.properties
@@ -48,7 +48,6 @@ log4j.logger.org.apache.usergrid.persistence.cassandra.ConnectionRefImpl=WARN
log4j.logger.me.prettyprint.cassandra.hector.TimingLogger=WARN
log4j.logger.org.apache.usergrid.rest.security.AllowAjaxFilter=WARN
log4j.logger.me.prettyprint.hector.api.beans.AbstractComposite=ERROR
-log4j.logger.org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl=DEBUG
log4j.logger.org.apache.usergrid.rest.filters.MeteringFilter=ERROR
log4j.logger.org.apache.usergrid.rest=DEBUG
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0071df0e/stack/services/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/services/src/test/resources/log4j.properties b/stack/services/src/test/resources/log4j.properties
index 07e2dde..a557928 100644
--- a/stack/services/src/test/resources/log4j.properties
+++ b/stack/services/src/test/resources/log4j.properties
@@ -37,7 +37,6 @@ log4j.logger.org.apache.usergrid.persistence.cassandra.ConnectionRefImpl=WARN, s
log4j.logger.me.prettyprint.cassandra.hector.TimingLogger=WARN, stdout
log4j.logger.org.apache.usergrid.rest.security.AllowAjaxFilter=WARN, stdout
log4j.logger.me.prettyprint.hector.api.beans.AbstractComposite=ERROR, stdout
-log4j.logger.org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl=DEBUG, stdout
#log4j.logger.org.apache.usergrid.persistence=INFO
#log4j.logger.org.apache.usergrid.corepersistence=DEBUG
http://git-wip-us.apache.org/repos/asf/usergrid/blob/0071df0e/stack/tools/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/tools/src/main/resources/log4j.properties b/stack/tools/src/main/resources/log4j.properties
index 1b60906..2b06dc8 100644
--- a/stack/tools/src/main/resources/log4j.properties
+++ b/stack/tools/src/main/resources/log4j.properties
@@ -42,7 +42,6 @@ log4j.logger.me.prettyprint.cassandra.hector.TimingLogger=WARN
log4j.logger.org.apache.usergrid.rest.security.AllowAjaxFilter=WARN
log4j.logger.me.prettyprint.hector.api.beans.AbstractComposite=ERROR
-#log4j.logger.org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl=DEBUG, stdout
#log4j.logger.org.apache.usergrid.persistence.hector.CountingMutator=INFO
[12/12] usergrid git commit: Merge commit
'4945b6f2d3a8a2d6e78c230bce6be09082dfa68c'
Posted by gr...@apache.org.
Merge commit '4945b6f2d3a8a2d6e78c230bce6be09082dfa68c'
* commit '4945b6f2d3a8a2d6e78c230bce6be09082dfa68c':
Implement a minimum lock expiration time.
Ensure the lock manager is injected as a singleton.
Remove unused SingleNodeLockImpl and any references to this.
Simplify the locks consistency level and default it to LQ in case something passed cannot be parsed to a valid consistency level.
Fix Astyanax locking to be re-entrant as Hector locks were and possible UG code expects it to be. Remove all reference of Hector locks, changing its existing test to work with Astyanax.
Remove commented, old Hector configuration from Spring context config.
Fix new lock manager wiring issues in services layer.
First commit of new implementation of Astyanax locks and having it wired with guide instead of Spring.
Remove unused zookeeper lock manager.
Fix typo in word 'tenant'.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/d796b68c
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/d796b68c
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/d796b68c
Branch: refs/heads/master
Commit: d796b68c64a47b5a79f9b98ae26f5a326ca62bd5
Parents: a51ee2c 4945b6f
Author: George Reyes <gr...@apache.org>
Authored: Fri Jan 15 16:44:30 2016 -0800
Committer: George Reyes <gr...@apache.org>
Committed: Fri Jan 15 16:44:30 2016 -0800
----------------------------------------------------------------------
.../src/main/dist/lib/log4j.properties | 1 -
.../src/test/resources/usergrid-test.properties | 5 -
stack/core/pom.xml | 10 +-
.../apache/usergrid/batch/job/OnlyOnceJob.java | 3 +-
.../usergrid/corepersistence/CoreModule.java | 2 +
.../locking/cassandra/AstyanaxLockImpl.java | 92 +++++
.../cassandra/AstyanaxLockManagerImpl.java | 211 +++++++++++
.../locking/cassandra/HectorLockImpl.java | 86 -----
.../cassandra/HectorLockManagerImpl.java | 142 --------
.../usergrid/locking/guice/LockModule.java | 40 +++
.../locking/singlenode/SingleNodeLockImpl.java | 71 ----
.../singlenode/SingleNodeLockManagerImpl.java | 96 -----
.../zookeeper/ZooKeeperLockManagerImpl.java | 115 ------
.../locking/zookeeper/ZookeeperLockImpl.java | 88 -----
.../mq/cassandra/QueueManagerFactoryImpl.java | 5 +-
.../persistence/cassandra/CassandraService.java | 5 +-
.../main/resources/usergrid-core-context.xml | 36 +-
.../org/apache/usergrid/CoreITSetupImpl.java | 4 +
.../usergrid/locking/AstyanaxLockManagerIT.java | 164 +++++++++
.../locking/cassandra/HectorLockManagerIT.java | 185 ----------
.../SingleNodeLockTestSingleNode.java | 170 ---------
.../zookeeper/AbstractZooKeeperTest.java | 127 -------
.../usergrid/locking/zookeeper/ZooPut.java | 114 ------
.../zookeeper/ZookeeperLockManagerTest.java | 186 ----------
stack/core/src/test/resources/log4j.properties | 1 -
.../impl/ScopedCacheSerializationImpl.java | 12 +-
.../MvccEntitySerializationStrategyImpl.java | 14 +-
...vccEntitySerializationStrategyProxyImpl.java | 4 +-
.../MvccEntitySerializationStrategyV1Impl.java | 8 +-
.../MvccEntitySerializationStrategyV2Impl.java | 13 +-
.../MvccEntitySerializationStrategyV3Impl.java | 14 +-
.../MvccLogEntrySerializationProxyImpl.java | 4 +-
.../MvccLogEntrySerializationStrategyImpl.java | 6 +-
...MvccLogEntrySerializationStrategyV1Impl.java | 18 +-
...MvccLogEntrySerializationStrategyV2Impl.java | 18 +-
.../UniqueValueSerializationStrategyImpl.java | 28 +-
...iqueValueSerializationStrategyProxyImpl.java | 4 +-
.../UniqueValueSerializationStrategyV1Impl.java | 31 +-
.../UniqueValueSerializationStrategyV2Impl.java | 31 +-
stack/corepersistence/common/pom.xml | 351 ++++++++++---------
.../core/astyanax/AstyanaxKeyspaceProvider.java | 46 +--
.../core/astyanax/CassandraCluster.java | 20 ++
.../core/astyanax/CassandraClusterImpl.java | 198 +++++++++++
.../persistence/core/astyanax/CassandraFig.java | 72 +++-
.../core/astyanax/MultiTenantColumnFamily.java | 47 +++
.../MultiTenantColumnFamilyDefinition.java | 138 ++++++++
.../core/astyanax/MultiTennantColumnFamily.java | 47 ---
.../MultiTennantColumnFamilyDefinition.java | 138 --------
.../persistence/core/guice/CommonModule.java | 11 +-
.../data/MigrationInfoSerializationImpl.java | 24 +-
.../core/migration/schema/Migration.java | 4 +-
.../migration/schema/MigrationManagerImpl.java | 9 +-
.../core/astyanax/ColumnNameIteratorTest.java | 5 +-
.../MultiKeyColumnNameIteratorTest.java | 5 +-
.../astyanax/MultiRowColumnIteratorTest.java | 5 +-
.../persistence/core/astyanax/TestUtils.java | 8 +-
.../EdgeMetadataSerializationProxyImpl.java | 4 +-
.../impl/EdgeMetadataSerializationV1Impl.java | 36 +-
.../impl/EdgeMetadataSerializationV2Impl.java | 36 +-
.../impl/NodeSerializationImpl.java | 14 +-
.../impl/shard/EdgeColumnFamilies.java | 12 +-
.../shard/impl/EdgeShardSerializationImpl.java | 14 +-
.../impl/ShardedEdgeSerializationImpl.java | 58 +--
.../impl/shard/impl/ShardsColumnIterator.java | 15 +-
.../shard/impl/SizebasedEdgeColumnFamilies.java | 46 +--
.../map/impl/MapSerializationImpl.java | 28 +-
.../resources/usergrid-standalone.properties | 4 -
stack/pom.xml | 39 +--
stack/rest/src/test/resources/log4j.properties | 1 -
.../cassandra/ManagementServiceImpl.java | 36 +-
.../services/ServiceManagerFactory.java | 6 +-
.../services/guice/ServiceModuleImpl.java | 3 +
.../resources/usergrid-services-context.xml | 133 +++----
.../src/test/resources/log4j.properties | 1 -
stack/tools/src/main/resources/log4j.properties | 1 -
.../test/resources/testApplicationContext.xml | 273 ++++++++-------
76 files changed, 1680 insertions(+), 2372 deletions(-)
----------------------------------------------------------------------
[10/12] usergrid git commit: Ensure the lock manager is injected as a
singleton.
Posted by gr...@apache.org.
Ensure the lock manager is injected as a singleton.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/289cc97c
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/289cc97c
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/289cc97c
Branch: refs/heads/master
Commit: 289cc97c34d5fbe4ec16ac376da85621055524a1
Parents: 0071df0
Author: Michael Russo <mi...@gmail.com>
Authored: Fri Jan 15 12:26:20 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Fri Jan 15 12:26:20 2016 -0800
----------------------------------------------------------------------
.../apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java | 2 ++
.../main/java/org/apache/usergrid/locking/guice/LockModule.java | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/289cc97c/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
index f310118..1fcd1b7 100644
--- a/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/locking/cassandra/AstyanaxLockManagerImpl.java
@@ -19,6 +19,7 @@ package org.apache.usergrid.locking.cassandra;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
+import com.google.inject.Singleton;
import com.netflix.astyanax.Keyspace;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import com.netflix.astyanax.ddl.ColumnFamilyDefinition;
@@ -41,6 +42,7 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
+@Singleton
public class AstyanaxLockManagerImpl implements LockManager {
private static final Logger logger = LoggerFactory.getLogger( AstyanaxLockManagerImpl.class );
http://git-wip-us.apache.org/repos/asf/usergrid/blob/289cc97c/stack/core/src/main/java/org/apache/usergrid/locking/guice/LockModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/locking/guice/LockModule.java b/stack/core/src/main/java/org/apache/usergrid/locking/guice/LockModule.java
index 49c58fe..79e2b67 100644
--- a/stack/core/src/main/java/org/apache/usergrid/locking/guice/LockModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/locking/guice/LockModule.java
@@ -32,7 +32,7 @@ public class LockModule extends AbstractModule {
@Override
protected void configure() {
- bind( LockManager.class ).to( AstyanaxLockManagerImpl.class );
+ bind( LockManager.class ).to( AstyanaxLockManagerImpl.class ).asEagerSingleton();
}
}