summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2015-08-02 23:26:58 +0200
committerYves Fischer <yvesf-git@xapek.org>2015-08-02 23:26:58 +0200
commitab3a129bfd7572d6d3d9457b5ded57c1a811f748 (patch)
tree0cd3d381041334fcb112cff4ee3e4764dd8efb3b
parent2f55918ab64a9ae6edb407bd967a4c1ec188b2d9 (diff)
downloadinfluxdb-tools-ab3a129bfd7572d6d3d9457b5ded57c1a811f748.tar.gz
influxdb-tools-ab3a129bfd7572d6d3d9457b5ded57c1a811f748.zip
Remove dependency to quartz
-rw-r--r--pom.xml5
-rw-r--r--src/main/scala/org/xapek/influxdb/Main.scala34
2 files changed, 7 insertions, 32 deletions
diff --git a/pom.xml b/pom.xml
index 8cb399b..36f759f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,11 +59,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>com.enragedginger</groupId>
- <artifactId>akka-quartz-scheduler_${scala.version}</artifactId>
- <version>1.4.0-akka-2.3.x</version>
- </dependency>
- <dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
diff --git a/src/main/scala/org/xapek/influxdb/Main.scala b/src/main/scala/org/xapek/influxdb/Main.scala
index 89fcd2f..206183c 100644
--- a/src/main/scala/org/xapek/influxdb/Main.scala
+++ b/src/main/scala/org/xapek/influxdb/Main.scala
@@ -3,7 +3,6 @@ package org.xapek.influxdb
import java.util.Date
import java.util.Calendar
-
import akka.actor.Actor
import akka.actor.Props
import akka.event.Logging
@@ -11,13 +10,10 @@ import akka.actor.ActorDSL
import akka.actor.ActorRef
import akka.actor.ActorSystem
import akka.actor.ActorLogging
-
-import com.typesafe.akka.extension.quartz.QuartzSchedulerExtension
import com.typesafe.config.ConfigFactory
-import org.quartz.impl.StdSchedulerFactory
-
import org.xapek.influxdb.InfluxDB._
-
+import scala.concurrent.duration.Duration
+import java.util.concurrent.TimeUnit
case object TimerSignal
@@ -39,7 +35,6 @@ class ConsoleWriter extends Actor with ActorLogging {
}
object Main {
-
def main(args: Array[String]): Unit = {
val db: InfluxDB = fromUrl("http://root:root@db.2.localnet.cc:8086/query?db=data&user=root&password=root")
@@ -49,30 +44,15 @@ object Main {
calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + 1)
val date2 = calendar.getTime
- // Disable silly update check
- System.setProperty(StdSchedulerFactory.PROP_SCHED_SKIP_UPDATE_CHECK, "true");
-
- val akkaConfig = ConfigFactory.parseString("""
- akka {
- quartz {
- defaultTimezone = "UTC"
- schedules {
- cronEvery5Seconds {
- description = "A cron job that fires off every 10 seconds"
- expression = "*/5 * * ? * *"
- }
- }
- }
- }""".stripMargin)
-
- println(akkaConfig)
- val system = ActorSystem("test", akkaConfig)
- val scheduler = QuartzSchedulerExtension(system)
+ val system = ActorSystem("AkkaSystem")
val writer = system.actorOf(Props(new ConsoleWriter()), "writer")
val reader = system.actorOf(Props(new InfluxReader(db, date1, date2, writer)), "reader")
- scheduler.schedule("cronEvery5Seconds", reader, TimerSignal)
+ system.scheduler.schedule(
+ Duration.create(5, TimeUnit.SECONDS),
+ Duration.create(5, TimeUnit.SECONDS),
+ reader, TimerSignal)(system.dispatcher, null)
println("Press key to exit")
System.in.read()