Preparing Akka Camel for bin compat

This commit is contained in:
Viktor Klang 2012-05-23 15:17:49 +02:00
parent 5bafa2d3a0
commit b45cec3da4
18 changed files with 109 additions and 125 deletions

View file

@ -2,12 +2,12 @@ package akka.camel.internal
import akka.actor.ActorSystem
import component.{ DurationTypeConverter, ActorComponent }
import org.apache.camel.CamelContext
import org.apache.camel.impl.DefaultCamelContext
import scala.Predef._
import akka.event.Logging
import akka.camel.Camel
import akka.util.{ NonFatal, Duration }
import org.apache.camel.{ ProducerTemplate, CamelContext }
/**
* For internal use only.
@ -33,14 +33,14 @@ private[camel] class DefaultCamel(val system: ActorSystem) extends Camel {
ctx
}
lazy val template = context.createProducerTemplate()
lazy val template: ProducerTemplate = context.createProducerTemplate()
/**
* Starts camel and underlying camel context and template.
* Only the creator of Camel should start and stop it.
* @see akka.camel.DefaultCamel#stop()
*/
def start = {
def start(): this.type = {
context.start()
try template.start() catch { case NonFatal(e) context.stop(); throw e }
log.debug("Started CamelContext[{}] for ActorSystem[{}]", context.getName, system.name)
@ -54,9 +54,9 @@ private[camel] class DefaultCamel(val system: ActorSystem) extends Camel {
*
* @see akka.camel.DefaultCamel#start()
*/
def shutdown() {
def shutdown(): Unit = {
try context.stop() finally {
try { template.stop() } catch { case NonFatal(e) log.debug("Swallowing non-fatal exception [{}] on stopping Camel producer template", e) }
try template.stop() catch { case NonFatal(e) log.debug("Swallowing non-fatal exception [{}] on stopping Camel producer template", e) }
}
log.debug("Stopped CamelContext[{}] for ActorSystem[{}]", context.getName, system.name)
}