You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/02/08 00:20:41 UTC
[2/7] git commit: Merge branch 'two-dot-o' into rxfixes
Merge branch 'two-dot-o' into rxfixes
Conflicts:
stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyImplTest.java
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/75814fca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/75814fca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/75814fca
Branch: refs/heads/two-dot-o
Commit: 75814fca087df946e861ff702ad1ccfcdd399808
Parents: 19b1cfb a36282e
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Feb 5 17:40:54 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Feb 5 17:40:54 2014 -0700
----------------------------------------------------------------------
stack/corepersistence/collection/pom.xml | 2 +-
.../collection/guice/CollectionModule.java | 15 ++++-----------
.../persistence/collection/rx/ParallelTest.java | 16 +++++++++++-----
stack/corepersistence/pom.xml | 1 -
4 files changed, 16 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75814fca/stack/corepersistence/collection/pom.xml
----------------------------------------------------------------------
diff --cc stack/corepersistence/collection/pom.xml
index cfe5028,cfe5028..db3ce3a
--- a/stack/corepersistence/collection/pom.xml
+++ b/stack/corepersistence/collection/pom.xml
@@@ -204,7 -204,7 +204,7 @@@
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-core</artifactId>
-- <version>${hystrix.version}</version>
++ <version>1.3.8</version>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75814fca/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/rx/ParallelTest.java
----------------------------------------------------------------------
diff --cc stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/rx/ParallelTest.java
index 526f7c7,0000000..b7f4ef7
mode 100644,000000..100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/rx/ParallelTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/rx/ParallelTest.java
@@@ -1,102 -1,0 +1,108 @@@
+/*
+ * 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.collection.rx;
+
+
+import java.util.ArrayList;
++import java.util.HashSet;
+import java.util.List;
++import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.usergrid.persistence.collection.hystrix.CassandraCommand;
+
+import rx.Observable;
+import rx.util.functions.Func1;
+import rx.util.functions.FuncN;
+
+import static org.junit.Assert.assertEquals;
+
+
+/**
+ * Simple tests that provides examples of how to perform common operations in RX
+ */
+public class ParallelTest {
+
+ private static final Logger logger = LoggerFactory.getLogger( ParallelTest.class );
+
+
- @Test( timeout = 5000 )
++// @Test( timeout = 5000 )
++ @Test
+ public void concurrentFunctions() {
+ final String input = "input";
+
+ final int size = 9;
+
+ //TODO Tweak our thread pool size beyond 10.
+
+ //latch used to make each thread block to prove correctness
+ final CountDownLatch latch = new CountDownLatch( size );
+
- List<Observable<String>> observables = new ArrayList<Observable<String>>( size );
++ final List<Observable<String>> observables = new ArrayList<Observable<String>>( size );
+
++
++ //this is not using a hystrix thread pool as I expected but rather the Rx computation thread pool. Am I doing this
++ //incorrectly?
+ for ( int i = 0; i < size; i++ ) {
+ observables.add( new CassandraCommand<String>( input ).toObservable().map( new Func1<String, String>() {
+ @Override
+ public String call( final String s ) {
+
- // logger.info( "Function executing on thread {} with latch value {}", Thread.currentThread().getName(), latch.getCount() );
++ final String threadName = Thread.currentThread().getName();
+
+ latch.countDown();
+
- logger.info( "Function executing on thread {} with latch value {}", Thread.currentThread().getName(), latch.getCount() );
-
++ logger.info( "Function executing on thread {} with latch value {}",
++ threadName, latch.getCount() );
+
+
+ try {
+ latch.await();
+ }
+ catch ( InterruptedException e ) {
+ throw new RuntimeException( e );
+ }
+
+ return s;
+ }
+ } ) );
+ }
+
+
+ Observable<String> zipped = Observable.zip( observables, new FuncN<String>() {
+
+ @Override
+ public String call( final Object... args ) {
+ assertEquals( size, args.length );
+ return input;
+ }
+ } );
+
+
+ String last = zipped.toBlockingObservable().last();
+
+
+ assertEquals( input, last );
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/75814fca/stack/corepersistence/pom.xml
----------------------------------------------------------------------
diff --cc stack/corepersistence/pom.xml
index 3edbf56,3edbf56..e6fb1f7
--- a/stack/corepersistence/pom.xml
+++ b/stack/corepersistence/pom.xml
@@@ -20,7 -20,7 +20,6 @@@
<archaius.version>0.5.12</archaius.version>
<slf4j.version>1.7.2</slf4j.version>
<log4j.version>1.2.17</log4j.version>
-- <hystrix.version>1.3.8</hystrix.version>
<guicyfig.version>3.2</guicyfig.version>
<chop.version>1.0</chop.version>
</properties>