From 73b6d767e4df70cce7030fe63982230074b50c62 Mon Sep 17 00:00:00 2001 From: Anil Koyuncu Date: Wed, 4 Apr 2018 18:10:24 +0200 Subject: [PATCH] config --- .../violations/AkkaTreeLoader.java | 8 ++ .../lu/uni/serval/config/Configuration.java | 2 +- src/main/resource/application.conf | 73 +++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 src/main/resource/application.conf diff --git a/src/main/java/edu/lu/uni/serval/FixPatternParser/violations/AkkaTreeLoader.java b/src/main/java/edu/lu/uni/serval/FixPatternParser/violations/AkkaTreeLoader.java index 5f34090..2684f2b 100644 --- a/src/main/java/edu/lu/uni/serval/FixPatternParser/violations/AkkaTreeLoader.java +++ b/src/main/java/edu/lu/uni/serval/FixPatternParser/violations/AkkaTreeLoader.java @@ -9,6 +9,7 @@ import com.github.gumtreediff.matchers.Matcher; import com.github.gumtreediff.matchers.Matchers; import com.github.gumtreediff.tree.ITree; import com.github.gumtreediff.tree.Tree; +import com.typesafe.config.ConfigFactory; import edu.lu.uni.serval.FixPattern.utils.ASTNodeMap; import edu.lu.uni.serval.MultipleThreadsParser.*; import edu.lu.uni.serval.gumtree.regroup.HierarchicalActionSet; @@ -189,6 +190,13 @@ public class AkkaTreeLoader { ActorRef parsingActor = null; final WorkMessage msg = new WorkMessage(0, result,innerPort,inputPath,dbDir,serverWait); try { + + + + system = ActorSystem.create("my-dispatcher", + ConfigFactory.load().getConfig("MyDispatcherExample")); + + log.info("Akka begins..."); system = ActorSystem.create("Tree-System"); parsingActor = system.actorOf(TreeActor.props(Integer.valueOf(numOfWorkers),dbDir,innerPort,serverWait), "tree-actor"); diff --git a/src/main/java/edu/lu/uni/serval/config/Configuration.java b/src/main/java/edu/lu/uni/serval/config/Configuration.java index 9c60ae1..3325840 100644 --- a/src/main/java/edu/lu/uni/serval/config/Configuration.java +++ b/src/main/java/edu/lu/uni/serval/config/Configuration.java @@ -2,7 +2,7 @@ package edu.lu.uni.serval.config; public class Configuration { - public static final long SECONDS_TO_WAIT = 90L; + public static final long SECONDS_TO_WAIT = 900L; // public static String ROOT_PATH = "/Volumes/data/bugStudy/dataset/"; // The root path of all output data. public static String ROOT_PATH = "/Users/anilkoyuncu/bugStudy/dataset/"; // The root path of all output data. diff --git a/src/main/resource/application.conf b/src/main/resource/application.conf new file mode 100644 index 0000000..079b1d8 --- /dev/null +++ b/src/main/resource/application.conf @@ -0,0 +1,73 @@ +MyDispatcherExample{ + defaultDispatcher { + type = Dispatcher + executor = "fork-join-executor" + fork-join-executor { + parallelism-min = 2 + parallelism-factor = 2.0 + parallelism-max = 6 + } + } + + defaultDispatcher1 { + type = Dispatcher + executor = "thread-pool-executor" + thread-pool-executor { + core-pool-size-min = 1 + core-pool-size-factor = 2.0 + core-pool-size-max = 6 + } + } + pinnedDispatcher { + type = PinnedDispatcher + executor = "thread-pool-executor" + thread-pool-executor { + core-pool-size-min = 2 + core-pool-size-factor = 2.0 + core-pool-size-max = 10 + } + throughput = 5 + } + balancingDispatcher { + type = BalancingDispatcher + executor = "thread-pool-executor" + thread-pool-executor { + core-pool-size-min = 1 + core-pool-size-factor = 2.0 + core-pool-size-max = 2 + } + throughput = 5 + } + balancingDispatcher1 { + type = BalancingDispatcher + executor = "fork-join-executor" + fork-join-executor { + parallelism-min = 2 + parallelism-factor = 2.0 + parallelism-max = 6 + } + throughput = 5 + } + my-dispatcher { + # Dispatcher is the name of the event-based dispatcher + type = Dispatcher + # What kind of ExecutionService to use + executor = "fork-join-executor" + # Configuration for the fork join pool + fork-join-executor { + # Min number of threads to cap factor-based parallelism number to + parallelism-min = 2 + # Parallelism (threads) ... ceil(available processors * factor) + parallelism-factor = 2.0 + # Max number of threads to cap factor-based parallelism number to + parallelism-max = 10 + } + # Throughput defines the maximum number of messages to be + # processed per actor before the thread jumps to the next actor. + # Set to 1 for as fair as possible. + throughput = 100 + } + CallingThreadDispatcher { + type = akka.testkit.CallingThreadDispatcherConfigurator + } +} \ No newline at end of file