usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject [1/7] usergrid git commit: Add new dispatcher for blocking io actors.
Date Sat, 01 Oct 2016 01:15:38 GMT
Repository: usergrid
Updated Branches:
  refs/heads/master 9947d488d -> 77d202690


Add new dispatcher for blocking io actors.


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

Branch: refs/heads/master
Commit: 10ac8d0849b64517da7f85fc5fa3da68d73bef9d
Parents: fdb7c27
Author: Michael Russo <mrusso@apigee.com>
Authored: Fri Sep 23 12:25:54 2016 -0700
Committer: Michael Russo <mrusso@apigee.com>
Committed: Fri Sep 23 12:25:54 2016 -0700

----------------------------------------------------------------------
 .../persistence/actorsystem/ActorSystemFig.java | 41 +++++++++++++++++++-
 .../actorsystem/ActorSystemManagerImpl.java     | 10 +++++
 .../uniquevalues/UniqueValuesRouter.java        |  4 +-
 3 files changed, 53 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/10ac8d08/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemFig.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemFig.java
b/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemFig.java
index 5d7b6aa..6980e45 100644
--- a/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemFig.java
+++ b/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemFig.java
@@ -40,6 +40,15 @@ public interface ActorSystemFig extends GuicyFig, Serializable {
 
     String CLUSTER_PORT = "usergrid.cluster.port";
 
+    String CLUSTER_IO_EXECUTOR_TYPE = "usergrid.cluster.io.executor";
+
+    String CLUSTER_IO_EXECUTOR_THREAD_POOL_SIZE = "usergrid.cluster.io.thread-pool-size";
+
+    String CLUSTER_IO_EXECUTOR_REJECTION_POLICY = "usergrid.cluster.io.rejection-policy";
+
+
+
+
 
     /**
      * Use Cluster or nah
@@ -76,8 +85,38 @@ public interface ActorSystemFig extends GuicyFig, Serializable {
     @Default("2551")
     String getPort();
 
-
+    /**
+     *  Hostname used for advertising to the cluster what itself should be reference as
+     */
     @Key("usergrid.cluster.hostname")
     @Default("")
     String getHostname();
+
+    /**
+     *  Possible executor types for any blocking IO actors in the actor system.
+     */
+    @Key(CLUSTER_IO_EXECUTOR_TYPE)
+    @Default("thread-pool-executor")
+    String getClusterIoExecutorType();
+
+    /**
+     *  Number of threads to be used when using the fixed thread pool size in the blocking
IO executor
+     *  Not relevant if anything other than "thread-pool-executor" is configured.
+     */
+    @Key(CLUSTER_IO_EXECUTOR_THREAD_POOL_SIZE)
+    @Default("25")
+    int getClusterIoExecutorThreadPoolSize();
+
+    /** Only used with "thread-pool-executor" and the following values are valid:
+     *
+     *  abort-policy
+     *  caller-runs-policy
+     *  discard-oldest-policy
+     *  discard-policy
+     *
+     *  Not relevant if anything other than "thread-pool-executor" is configured.
+     */
+    @Key(CLUSTER_IO_EXECUTOR_REJECTION_POLICY)
+    @Default("caller-runs-policy")
+    String getClusterIoExecutorRejectionPolicy();
 }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10ac8d08/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManagerImpl.java
b/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManagerImpl.java
index ed9344c..7e7df9c 100644
--- a/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManagerImpl.java
+++ b/stack/corepersistence/actorsystem/src/main/java/org/apache/usergrid/persistence/actorsystem/ActorSystemManagerImpl.java
@@ -293,6 +293,16 @@ public class ActorSystemManagerImpl implements ActorSystemManager {
 
                 put( "akka", new HashMap<String, Object>() {{
 
+                    put( "blocking-io-dispatcher", new HashMap<String, Object>() {{
+                        put( "type", "Dispatcher" );
+                        put( "executor", actorSystemFig.getClusterIoExecutorType() );
+                        put( actorSystemFig.getClusterIoExecutorType() , new HashMap<String,
Object>() {{
+                            put( "fixed-pool-size", actorSystemFig.getClusterIoExecutorThreadPoolSize()
);
+                            put( "rejection-policy",actorSystemFig.getClusterIoExecutorRejectionPolicy()
);
+                        }} );
+                    }} );
+
+
                     put( "remote", new HashMap<String, Object>() {{
                         put( "netty.tcp", new HashMap<String, Object>() {{
                             put( "hostname", hostname );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/10ac8d08/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesRouter.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesRouter.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesRouter.java
index 376af66..7176202 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesRouter.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/uniquevalues/UniqueValuesRouter.java
@@ -42,7 +42,9 @@ public class UniqueValuesRouter extends UntypedActor {
     public UniqueValuesRouter(Injector injector ) {
 
         router = getContext().actorOf(
-            FromConfig.getInstance().props(Props.create(UniqueValueActor.class)), "router");
+            FromConfig.getInstance()
+                .props(Props.create(UniqueValueActor.class)
+                    .withDispatcher("blocking-io-dispatcher")), "router");
 
         // TODO: is there some way to pass the injector here without getting this exception:
         // NotSerializableException: No configured serialization-bindings for class [InjectorImpl]


Mime
View raw message