Browse Source

Added some concurency properties to prevent the build failing on a meager build server.

master
Drew Short 11 years ago
parent
commit
e7f0239c3f
  1. 4
      src/main/resources/default.properties
  2. 3
      src/main/scala/com/sothr/imagetools/ConcurrentEngine.scala
  3. 3
      src/main/scala/com/sothr/imagetools/util/PropertiesEnum.scala
  4. 4
      src/test/resources/default.properties

4
src/main/resources/default.properties

@ -8,6 +8,10 @@ app.log.debug=false
app.log.info=false app.log.info=false
app.log.error=true app.log.error=true
#Concurrency Settings
app.engine.concurrent.similarity.limit=20
app.engine.concurrent.processing.limit=10
#Default Image Settings #Default Image Settings
#images must be 90% similar #images must be 90% similar
image.differenceThreshold=0.90 image.differenceThreshold=0.90

3
src/main/scala/com/sothr/imagetools/ConcurrentEngine.scala

@ -9,6 +9,7 @@ import akka.util.Timeout
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import scala.collection.mutable.{MutableList, HashSet} import scala.collection.mutable.{MutableList, HashSet}
import com.sothr.imagetools.image.{SimilarImages, ImageFilter, Image} import com.sothr.imagetools.image.{SimilarImages, ImageFilter, Image}
import com.sothr.imagetools.util.{PropertiesEnum, PropertiesService}
import scala.concurrent.{Await, blocking, Future} import scala.concurrent.{Await, blocking, Future}
import java.lang.Thread import java.lang.Thread
import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.ExecutionContext.Implicits.global
@ -114,7 +115,7 @@ class ConcurrentEngine extends Engine with grizzled.slf4j.Logging {
class ConcurrentEngineController extends Actor with ActorLogging { class ConcurrentEngineController extends Actor with ActorLogging {
val imageCache = AppConfig.cacheManager.getCache("images") val imageCache = AppConfig.cacheManager.getCache("images")
val numOfRouters = 10
val numOfRouters = PropertiesService.get(PropertiesEnum.ConcurrentProcessingLimit.toString).toInt
val router = context.actorOf(Props[ConcurrentEngineActor].withRouter(SmallestMailboxRouter(nrOfInstances = numOfRouters))) val router = context.actorOf(Props[ConcurrentEngineActor].withRouter(SmallestMailboxRouter(nrOfInstances = numOfRouters)))
var images:MutableList[Image] = new MutableList[Image]() var images:MutableList[Image] = new MutableList[Image]()

3
src/main/scala/com/sothr/imagetools/util/PropertiesEnum.scala

@ -8,6 +8,9 @@ object PropertiesEnum extends Enumeration {
val LogInfo = Value("app.log.info") val LogInfo = Value("app.log.info")
val LogError = Value("app.log.error") val LogError = Value("app.log.error")
val Timed = Value("app.timed") val Timed = Value("app.timed")
//default engine concurrency settings
val ConcurrentSimiliartyLimit = Value("app.engine.concurrent.similarity.limit")
val ConcurrentProcessingLimit = Value("app.engine.concurrent.processing.limit")
//default image settings //default image settings
val ImageDifferenceThreshold = Value("image.differenceThreshold") val ImageDifferenceThreshold = Value("image.differenceThreshold")
val HashPrecision = Value("image.hash.precision") val HashPrecision = Value("image.hash.precision")

4
src/test/resources/default.properties

@ -8,6 +8,10 @@ app.log.debug=true
app.log.info=true app.log.info=true
app.log.error=true app.log.error=true
#Concurrency Settings
app.engine.concurrent.similarity.limit=2
app.engine.concurrent.processing.limit=2
#Default Image Settings #Default Image Settings
#images must be 90% similar #images must be 90% similar
image.differenceThreshold=0.90 image.differenceThreshold=0.90

Loading…
Cancel
Save