Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
shrink the init a bit more. :)
Browse files Browse the repository at this point in the history
  • Loading branch information
Robey Pointer committed May 19, 2010
1 parent 5a4634c commit ed7e41c
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/main/scala/com/twitter/flockdb/FlockDB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,15 @@ object FlockDB {

val polymorphicJobParser = new PolymorphicJobParser
val jobParser = new LoggingJobParser(Stats, w3c, new JobWithTasksParser(polymorphicJobParser))

val schedulerMap = new mutable.HashMap[Int, JobScheduler]
List((Priority.High, "primary"), (Priority.Medium, "copy"),
(Priority.Low, "slow")).foreach { case (priority, configName) =>
val queueConfig = config.configMap("edges.queue")
val scheduler = JobScheduler(configName, queueConfig, jobParser)
schedulerMap(priority.id) = scheduler
}
val scheduler = new PrioritizingJobScheduler(schedulerMap)
val scheduler = PrioritizingJobScheduler(config.configMap("edges.queue"), jobParser,
Map(Priority.High.id -> "primary", Priority.Medium.id -> "copy", Priority.Low.id -> "slow"))

val forwardingManager = new ForwardingManager(nameServer)
val copyFactory = jobs.CopyFactory
nameServer.reload()

val singleJobParser = new jobs.single.JobParser(forwardingManager, OrderedUuidGenerator)
val multiJobParser = new jobs.multi.JobParser(forwardingManager, scheduler)
val copyJobParser = new BoundJobParser((nameServer, schedulerMap(Priority.Medium.id)))
val copyJobParser = new BoundJobParser((nameServer, scheduler(Priority.Medium.id)))

val future = new Future("EdgesFuture", config.configMap("edges.future"))

Expand All @@ -104,7 +96,7 @@ object FlockDB {

scheduler.start()

new FlockDB(new EdgesService(nameServer, forwardingManager, copyFactory, scheduler, future))
new FlockDB(new EdgesService(nameServer, forwardingManager, jobs.CopyFactory, scheduler, future))
}
}

Expand Down

0 comments on commit ed7e41c

Please sign in to comment.