usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject incubator-usergrid git commit: removing static class
Date Thu, 26 Feb 2015 16:30:48 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-273-indexbuffer 77cfeb426 -> 0fe2b4024


removing static class


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/0fe2b402
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/0fe2b402
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/0fe2b402

Branch: refs/heads/USERGRID-273-indexbuffer
Commit: 0fe2b40249c668baaea9f76f90c9249a3123887e
Parents: 77cfeb4
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Thu Feb 26 09:30:43 2015 -0700
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Thu Feb 26 09:30:43 2015 -0700

----------------------------------------------------------------------
 .../persistence/index/IndexBufferProducer.java  |  5 +-
 .../persistence/index/guice/IndexModule.java    |  2 +
 .../index/impl/EsIndexBufferConsumerImpl.java   |  4 +-
 .../index/impl/EsIndexBufferProducerImpl.java   | 57 ++++++++++----------
 .../impl/EsIndexBufferProducerObservable.java   | 57 --------------------
 5 files changed, 38 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0fe2b402/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexBufferProducer.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexBufferProducer.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexBufferProducer.java
index c7779a1..6338a0c 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexBufferProducer.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/IndexBufferProducer.java
@@ -27,9 +27,10 @@ import rx.Subscriber;
 /**
  * Classy class class.
  */
-public interface IndexBufferProducer  {
+public interface IndexBufferProducer extends Observable.OnSubscribe<IndexOperationMessage>
{
 
-    Observable.OnSubscribe<IndexOperationMessage> getObservable();
+    @Override
+    void call(Subscriber<? super IndexOperationMessage> subscriber);
 
     BetterFuture put(IndexOperationMessage message);
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0fe2b402/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
index 8e39ff7..d9a14c9 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/guice/IndexModule.java
@@ -41,6 +41,8 @@ public class IndexModule extends AbstractModule {
                 .build(EntityIndexFactory.class));
 
         bind(IndexBufferProducer.class).to(EsIndexBufferProducerImpl.class);
+        bind(IndexBufferConsumer.class).to(EsIndexBufferConsumerImpl.class).asEagerSingleton();
+
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0fe2b402/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
index af61824..eaca9bd 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferConsumerImpl.java
@@ -50,6 +50,7 @@ import java.util.concurrent.atomic.AtomicLong;
 /**
  * Consumer for IndexOperationMessages
  */
+@Singleton
 public class EsIndexBufferConsumerImpl implements IndexBufferConsumer {
     private static final Logger log = LoggerFactory.getLogger(EsIndexBufferConsumerImpl.class);
 
@@ -60,7 +61,8 @@ public class EsIndexBufferConsumerImpl implements IndexBufferConsumer {
     private final Timer flushTimer;
     private final Counter indexSizeCounter;
 
-    public EsIndexBufferConsumerImpl(final IndexFig config, final EsIndexBufferProducerObservable
producer, final EsProvider provider, final MetricsFactory metricsFactory){
+    @Inject
+    public EsIndexBufferConsumerImpl(final IndexFig config, final IndexBufferProducer producer,
final EsProvider provider, final MetricsFactory metricsFactory){
         this.flushTimer = metricsFactory.getTimer(EsIndexBufferConsumerImpl.class, "index.buffer.flush");
         this.indexSizeCounter =  metricsFactory.getCounter(EsIndexBufferConsumerImpl.class,
"index.buffer.size");
         this.config = config;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0fe2b402/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferProducerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferProducerImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferProducerImpl.java
index 715bb84..791cea8 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferProducerImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferProducerImpl.java
@@ -1,52 +1,55 @@
 /*
- * 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
+ *  * 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.
  *
- * 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.index.impl;
 
+import com.codahale.metrics.Counter;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 import org.apache.usergrid.persistence.core.future.BetterFuture;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
-import org.apache.usergrid.persistence.index.IndexBufferConsumer;
 import org.apache.usergrid.persistence.index.IndexBufferProducer;
-import org.apache.usergrid.persistence.index.IndexFig;
 import org.apache.usergrid.persistence.index.IndexOperationMessage;
-import rx.Observable;
+import rx.Subscriber;
 
 /**
- * Buffer index requests into sets to send.
+ * Producer for index operation messages
  */
 @Singleton
 public class EsIndexBufferProducerImpl implements IndexBufferProducer {
-    private final IndexBufferConsumer consumer;
-    private EsIndexBufferProducerObservable producer;
+
+    private final Counter indexSizeCounter;
+    private Subscriber<? super IndexOperationMessage> subscriber;
 
     @Inject
-    public EsIndexBufferProducerImpl(final MetricsFactory metricsFactory, final IndexFig
config, final EsProvider provider){
-        this.producer = new EsIndexBufferProducerObservable(metricsFactory);
-        this.consumer = new EsIndexBufferConsumerImpl(config,producer,provider,metricsFactory);
-    }
+    public EsIndexBufferProducerImpl(MetricsFactory metricsFactory){
+        this.indexSizeCounter = metricsFactory.getCounter(EsIndexBufferProducerImpl.class,"index.buffer.size");
 
+    }
     @Override
-    public Observable.OnSubscribe<IndexOperationMessage> getObservable() {
-        return producer;
+    public void call(Subscriber<? super IndexOperationMessage> subscriber) {
+        this.subscriber = subscriber;
     }
 
-    @Override
-    public BetterFuture put(IndexOperationMessage container){
-        return producer.put(container);
+    public BetterFuture put(IndexOperationMessage message){
+        indexSizeCounter.inc(message.getBuilder().size());
+        subscriber.onNext(message);
+        return message.getFuture();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0fe2b402/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferProducerObservable.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferProducerObservable.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferProducerObservable.java
deleted file mode 100644
index 4a70bca..0000000
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsIndexBufferProducerObservable.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- *  * 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.persistence.index.impl;
-
-import com.codahale.metrics.Counter;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.apache.usergrid.persistence.core.future.BetterFuture;
-import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
-import org.apache.usergrid.persistence.index.IndexOperationMessage;
-import rx.Observable;
-import rx.Subscriber;
-
-/**
- * Producer for index operation messages
- */
-@Singleton
-public class EsIndexBufferProducerObservable implements Observable.OnSubscribe<IndexOperationMessage>
{
-
-    private final MetricsFactory metricsFactory;
-    private final Counter indexSizeCounter;
-    private Subscriber<? super IndexOperationMessage> subscriber;
-
-    @Inject
-    public EsIndexBufferProducerObservable(MetricsFactory metricsFactory){
-        this.metricsFactory = metricsFactory;
-        this.indexSizeCounter = metricsFactory.getCounter(EsIndexBufferProducerObservable.class,"index.buffer.size");
-
-    }
-    @Override
-    public void call(Subscriber<? super IndexOperationMessage> subscriber) {
-        this.subscriber = subscriber;
-    }
-
-    public BetterFuture put(IndexOperationMessage message){
-        indexSizeCounter.inc(message.getBuilder().size());
-        subscriber.onNext(message);
-        return message.getFuture();
-    }
-}


Mime
View raw message