From 3838411ec944a1799371967c8acfefe958f4056e Mon Sep 17 00:00:00 2001 From: Michael Kober Date: Wed, 22 Sep 2010 10:15:43 +0200 Subject: [PATCH 1/5] closing ticket423, implemented custom placeholder configurer --- .../actor/supervisor/SupervisorMiscSpec.scala | 0 .../akka/spring/akka-1.0-SNAPSHOT.xsd | 20 ++-- .../scala/ActorBeanDefinitionParser.scala | 21 ++++ .../src/main/scala/ActorFactoryBean.scala | 35 ++++--- akka-spring/src/main/scala/ActorParser.scala | 16 +-- .../src/main/scala/ActorProperties.scala | 14 ++- .../src/main/scala/AkkaNamespaceHandler.scala | 1 + .../scala/AkkaSpringConfigurationTags.scala | 4 + ...onfiggyPropertyPlaceholderConfigurer.scala | 37 +++++++ .../main/scala/SupervisionFactoryBean.scala | 5 +- akka-spring/src/test/resources/akka-test.conf | 13 +++ .../src/test/resources/property-config.xml | 22 +++++ .../src/test/scala/ActorFactoryBeanTest.scala | 6 +- ...ggyPropertyPlaceholderConfigurerSpec.scala | 42 ++++++++ .../scala/SupervisionFactoryBeanTest.scala | 6 +- config/akka.conf | 97 ++++++++++++++++++- 16 files changed, 294 insertions(+), 45 deletions(-) rename {akka-core => akka-actor}/src/test/scala/actor/supervisor/SupervisorMiscSpec.scala (100%) create mode 100644 akka-spring/src/main/scala/ConfiggyPropertyPlaceholderConfigurer.scala create mode 100644 akka-spring/src/test/resources/akka-test.conf create mode 100644 akka-spring/src/test/resources/property-config.xml create mode 100644 akka-spring/src/test/scala/ConfiggyPropertyPlaceholderConfigurerSpec.scala diff --git a/akka-core/src/test/scala/actor/supervisor/SupervisorMiscSpec.scala b/akka-actor/src/test/scala/actor/supervisor/SupervisorMiscSpec.scala similarity index 100% rename from akka-core/src/test/scala/actor/supervisor/SupervisorMiscSpec.scala rename to akka-actor/src/test/scala/actor/supervisor/SupervisorMiscSpec.scala diff --git a/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka-1.0-SNAPSHOT.xsd b/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka-1.0-SNAPSHOT.xsd index 84a382a78e..1014e7e592 100644 --- a/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka-1.0-SNAPSHOT.xsd +++ b/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka-1.0-SNAPSHOT.xsd @@ -106,7 +106,7 @@ - + Port of the remote host. @@ -152,10 +152,10 @@ - + - The default timeout for '!!' invocations. + The default timeout for '!!' invocations in milliseconds. @@ -198,10 +198,10 @@ - + - The default timeout for '!!' invocations. + The default timeout for '!!' invocations in milliseconds. @@ -260,7 +260,7 @@ - + Port of the remote host. @@ -334,6 +334,14 @@ + + + + + + + + diff --git a/akka-spring/src/main/scala/ActorBeanDefinitionParser.scala b/akka-spring/src/main/scala/ActorBeanDefinitionParser.scala index 55aa82b8e4..6c69886e2e 100644 --- a/akka-spring/src/main/scala/ActorBeanDefinitionParser.scala +++ b/akka-spring/src/main/scala/ActorBeanDefinitionParser.scala @@ -70,3 +70,24 @@ class ActorForBeanDefinitionParser extends AbstractSingleBeanDefinitionParser wi */ override def getBeanClass(element: Element): Class[_] = classOf[ActorForFactoryBean] } + +/** + * Parser for custom namespace configuration. + * @author michaelkober + */ +class ConfigBeanDefinitionParser extends AbstractSingleBeanDefinitionParser with ActorParser { + /* + * @see org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser#doParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext, org.springframework.beans.factory.support.BeanDefinitionBuilder) + */ + override def doParse(element: Element, parserContext: ParserContext, builder: BeanDefinitionBuilder) { + val location = element.getAttribute(LOCATION) + builder.addPropertyValue(LOCATION, location) + } + + /* + * @see org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser#getBeanClass(org.w3c.dom.Element) + */ + override def getBeanClass(element: Element): Class[_] = classOf[ConfiggyPropertyPlaceholderConfigurer] + + override def shouldGenerateId() = true +} \ No newline at end of file diff --git a/akka-spring/src/main/scala/ActorFactoryBean.scala b/akka-spring/src/main/scala/ActorFactoryBean.scala index caa344825a..fb35965418 100644 --- a/akka-spring/src/main/scala/ActorFactoryBean.scala +++ b/akka-spring/src/main/scala/ActorFactoryBean.scala @@ -6,10 +6,8 @@ package se.scalablesolutions.akka.spring import org.springframework.beans.{BeanUtils,BeansException,BeanWrapper,BeanWrapperImpl} import se.scalablesolutions.akka.remote.{RemoteClient, RemoteServer} -//import org.springframework.beans.factory.BeanFactory import org.springframework.beans.factory.config.AbstractFactoryBean import org.springframework.context.{ApplicationContext,ApplicationContextAware} -//import org.springframework.util.ReflectionUtils import org.springframework.util.StringUtils import se.scalablesolutions.akka.actor.{ActorRef, AspectInitRegistry, TypedActorConfiguration, TypedActor,Actor} @@ -42,10 +40,10 @@ class ActorFactoryBean extends AbstractFactoryBean[AnyRef] with Logging with App @BeanProperty var typed: String = "" @BeanProperty var interface: String = "" @BeanProperty var implementation: String = "" - @BeanProperty var timeout: Long = _ + @BeanProperty var timeoutStr: String = "" @BeanProperty var transactional: Boolean = false @BeanProperty var host: String = "" - @BeanProperty var port: Int = _ + @BeanProperty var port: String = "" @BeanProperty var serverManaged: Boolean = false @BeanProperty var serviceName: String = "" @BeanProperty var lifecycle: String = "" @@ -54,6 +52,20 @@ class ActorFactoryBean extends AbstractFactoryBean[AnyRef] with Logging with App @BeanProperty var property: PropertyEntries = _ @BeanProperty var applicationContext: ApplicationContext = _ + lazy val timeout = parseTimeout + + private def parseTimeout() : Long = { + var result = -1L + try { + result = if (!timeoutStr.isEmpty) timeoutStr.toLong else -1L + } catch { + case nfe: NumberFormatException => + log.error(nfe, "could not parse timeout %s", timeoutStr) + throw nfe + } + result + } + // Holds info about if deps have been set or not. Depends on // if interface is specified or not. We must set deps on // target instance if interface is specified @@ -95,7 +107,7 @@ class ActorFactoryBean extends AbstractFactoryBean[AnyRef] with Logging with App val typedActor: AnyRef = TypedActor.newInstance(interface.toClass, implementation.toClass, createConfig) if (isRemote && serverManaged) { - val server = RemoteServer.getOrCreateServer(new InetSocketAddress(host, port)) + val server = RemoteServer.getOrCreateServer(new InetSocketAddress(host, port.toInt)) if (serviceName.isEmpty) { server.registerTypedActor(interface, typedActor) } else { @@ -120,14 +132,14 @@ class ActorFactoryBean extends AbstractFactoryBean[AnyRef] with Logging with App } if (isRemote) { if (serverManaged) { - val server = RemoteServer.getOrCreateServer(new InetSocketAddress(host, port)) + val server = RemoteServer.getOrCreateServer(new InetSocketAddress(host, port.toInt)) if (serviceName.isEmpty) { server.register(actorRef) } else { server.register(serviceName, actorRef) } } else { - actorRef.makeRemote(host, port) + actorRef.makeRemote(host, port.toInt) } } if (hasDispatcher) { @@ -176,7 +188,7 @@ class ActorFactoryBean extends AbstractFactoryBean[AnyRef] with Logging with App private[akka] def createConfig: TypedActorConfiguration = { val config = new TypedActorConfiguration().timeout(Duration(timeout, "millis")) if (transactional) config.makeTransactionRequired - if (isRemote && !serverManaged) config.makeRemote(host, port) + if (isRemote && !serverManaged) config.makeRemote(host, port.toInt) if (hasDispatcher) { if (dispatcher.dispatcherType != THREAD_BASED) { config.dispatcher(dispatcherInstance()) @@ -220,9 +232,8 @@ class ActorForFactoryBean extends AbstractFactoryBean[AnyRef] with Logging with @BeanProperty var interface: String = "" @BeanProperty var host: String = "" - @BeanProperty var port: Int = _ + @BeanProperty var port: String = "" @BeanProperty var serviceName: String = "" - //@BeanProperty var scope: String = VAL_SCOPE_SINGLETON @BeanProperty var applicationContext: ApplicationContext = _ override def isSingleton = false @@ -237,9 +248,9 @@ class ActorForFactoryBean extends AbstractFactoryBean[AnyRef] with Logging with */ def createInstance: AnyRef = { if (interface.isEmpty) { - RemoteClient.actorFor(serviceName, host, port) + RemoteClient.actorFor(serviceName, host, port.toInt) } else { - RemoteClient.typedActorFor(interface.toClass, serviceName, host, port) + RemoteClient.typedActorFor(interface.toClass, serviceName, host, port.toInt) } } } diff --git a/akka-spring/src/main/scala/ActorParser.scala b/akka-spring/src/main/scala/ActorParser.scala index 9858e9ad7e..0947c6f944 100644 --- a/akka-spring/src/main/scala/ActorParser.scala +++ b/akka-spring/src/main/scala/ActorParser.scala @@ -8,8 +8,6 @@ import org.w3c.dom.Element import scala.collection.JavaConversions._ import se.scalablesolutions.akka.util.Logging -import se.scalablesolutions.akka.actor.IllegalActorStateException - /** * Parser trait for custom namespace configuration for typed-actor. * @author michaelkober @@ -32,7 +30,7 @@ trait ActorParser extends BeanParser with DispatcherParser { if (remoteElement != null) { objectProperties.host = mandatory(remoteElement, HOST) - objectProperties.port = mandatory(remoteElement, PORT).toInt + objectProperties.port = mandatory(remoteElement, PORT) objectProperties.serverManaged = (remoteElement.getAttribute(MANAGED_BY) != null) && (remoteElement.getAttribute(MANAGED_BY).equals(SERVER_MANAGED)) val serviceName = remoteElement.getAttribute(SERVICE_NAME) if ((serviceName != null) && (!serviceName.isEmpty)) { @@ -54,15 +52,7 @@ trait ActorParser extends BeanParser with DispatcherParser { objectProperties.propertyEntries.add(entry) } - try { - val timeout = element.getAttribute(TIMEOUT) - objectProperties.timeout = if ((timeout != null) && (!timeout.isEmpty)) timeout.toLong else -1L - } catch { - case nfe: NumberFormatException => - log.error(nfe, "could not parse timeout %s", element.getAttribute(TIMEOUT)) - throw nfe - } - + objectProperties.timeoutStr = element.getAttribute(TIMEOUT) objectProperties.target = mandatory(element, IMPLEMENTATION) objectProperties.transactional = if (element.getAttribute(TRANSACTIONAL).isEmpty) false else element.getAttribute(TRANSACTIONAL).toBoolean @@ -97,7 +87,7 @@ trait ActorForParser extends BeanParser { val objectProperties = new ActorForProperties() objectProperties.host = mandatory(element, HOST) - objectProperties.port = mandatory(element, PORT).toInt + objectProperties.port = mandatory(element, PORT) objectProperties.serviceName = mandatory(element, SERVICE_NAME) if (element.hasAttribute(INTERFACE)) { objectProperties.interface = element.getAttribute(INTERFACE) diff --git a/akka-spring/src/main/scala/ActorProperties.scala b/akka-spring/src/main/scala/ActorProperties.scala index 0f86942935..3f811644c7 100644 --- a/akka-spring/src/main/scala/ActorProperties.scala +++ b/akka-spring/src/main/scala/ActorProperties.scala @@ -15,11 +15,11 @@ import AkkaSpringConfigurationTags._ class ActorProperties { var typed: String = "" var target: String = "" - var timeout: Long = _ + var timeoutStr: String = "" var interface: String = "" var transactional: Boolean = false var host: String = "" - var port: Int = _ + var port: String = "" var serverManaged: Boolean = false var serviceName: String = "" var lifecycle: String = "" @@ -38,7 +38,7 @@ class ActorProperties { builder.addPropertyValue(PORT, port) builder.addPropertyValue("serverManaged", serverManaged) builder.addPropertyValue("serviceName", serviceName) - builder.addPropertyValue(TIMEOUT, timeout) + builder.addPropertyValue("timeoutStr", timeoutStr) builder.addPropertyValue(IMPLEMENTATION, target) builder.addPropertyValue(INTERFACE, interface) builder.addPropertyValue(TRANSACTIONAL, transactional) @@ -46,7 +46,11 @@ class ActorProperties { builder.addPropertyValue(SCOPE, scope) builder.addPropertyValue(DISPATCHER_TAG, dispatcher) builder.addPropertyValue(PROPERTYENTRY_TAG,propertyEntries) -} + } + + def timeout() : Long = { + if (!timeoutStr.isEmpty) timeoutStr.toLong else -1L + } } @@ -57,7 +61,7 @@ class ActorProperties { class ActorForProperties { var interface: String = "" var host: String = "" - var port: Int = _ + var port: String = "" var serviceName: String = "" /** diff --git a/akka-spring/src/main/scala/AkkaNamespaceHandler.scala b/akka-spring/src/main/scala/AkkaNamespaceHandler.scala index b1c58baa20..91c46c99e8 100644 --- a/akka-spring/src/main/scala/AkkaNamespaceHandler.scala +++ b/akka-spring/src/main/scala/AkkaNamespaceHandler.scala @@ -12,6 +12,7 @@ import AkkaSpringConfigurationTags._ */ class AkkaNamespaceHandler extends NamespaceHandlerSupport { def init = { + registerBeanDefinitionParser(CONFIG_TAG, new ConfigBeanDefinitionParser()); registerBeanDefinitionParser(TYPED_ACTOR_TAG, new TypedActorBeanDefinitionParser()) registerBeanDefinitionParser(UNTYPED_ACTOR_TAG, new UntypedActorBeanDefinitionParser()) registerBeanDefinitionParser(SUPERVISION_TAG, new SupervisionBeanDefinitionParser()) diff --git a/akka-spring/src/main/scala/AkkaSpringConfigurationTags.scala b/akka-spring/src/main/scala/AkkaSpringConfigurationTags.scala index 0e4de3576f..1eef274df6 100644 --- a/akka-spring/src/main/scala/AkkaSpringConfigurationTags.scala +++ b/akka-spring/src/main/scala/AkkaSpringConfigurationTags.scala @@ -13,6 +13,7 @@ object AkkaSpringConfigurationTags { // --- TAGS // // top level tags + val CONFIG_TAG = "property-placeholder" val TYPED_ACTOR_TAG = "typed-actor" val UNTYPED_ACTOR_TAG = "untyped-actor" val SUPERVISION_TAG = "supervision" @@ -73,6 +74,9 @@ object AkkaSpringConfigurationTags { val REJECTION_POLICY ="rejection-policy" val MAILBOX_CAPACITY ="mailbox-capacity" + // config attribute + val LOCATION = "location" + // --- VALUES // // Lifecycle diff --git a/akka-spring/src/main/scala/ConfiggyPropertyPlaceholderConfigurer.scala b/akka-spring/src/main/scala/ConfiggyPropertyPlaceholderConfigurer.scala new file mode 100644 index 0000000000..411c36d86d --- /dev/null +++ b/akka-spring/src/main/scala/ConfiggyPropertyPlaceholderConfigurer.scala @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2009-2010 Scalable Solutions AB + */ +package se.scalablesolutions.akka.spring + +import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer +import org.springframework.core.io.Resource +import net.lag.configgy.Configgy +import java.util.Properties + +/** + * ConfiggyPropertyPlaceholderConfigurer. Property resource configurer for configgy files. + */ +class ConfiggyPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { + + /** + * Sets the akka properties as local properties, leaves the location empty. + * @param configgyResource akka.conf + */ + override def setLocation(configgyResource: Resource) { + if (configgyResource == null) throw new IllegalArgumentException("Property 'config' must be set") + val properties = loadAkkaConfig(configgyResource) + setProperties(properties) + } + + /** + * Load the akka.conf and transform to properties. + */ + private def loadAkkaConfig(configgyResource: Resource) : Properties = { + Configgy.configure(configgyResource.getFile.getPath) + val config = Configgy.config + val properties = new Properties() + config.asMap.foreach {case (k, v) => properties.put(k, v); println("(k,v)=" + k + ", " + v)} + properties + } + +} \ No newline at end of file diff --git a/akka-spring/src/main/scala/SupervisionFactoryBean.scala b/akka-spring/src/main/scala/SupervisionFactoryBean.scala index 39d927a16c..a19b6fdeea 100644 --- a/akka-spring/src/main/scala/SupervisionFactoryBean.scala +++ b/akka-spring/src/main/scala/SupervisionFactoryBean.scala @@ -60,7 +60,8 @@ class SupervisionFactoryBean extends AbstractFactoryBean[AnyRef] { val isRemote = (props.host != null) && (!props.host.isEmpty) val withInterface = (props.interface != null) && (!props.interface.isEmpty) if (isRemote) { - val remote = new RemoteAddress(props.host, props.port) + //val remote = new RemoteAddress(props.host, props.port) + val remote = new RemoteAddress(props.host, props.port.toInt) if (withInterface) { new Component(props.interface.toClass, props.target.toClass, lifeCycle, props.timeout, props.transactional, remote) } else { @@ -91,7 +92,7 @@ class SupervisionFactoryBean extends AbstractFactoryBean[AnyRef] { } val supervise = if (isRemote) { - val remote = new SRemoteAddress(props.host, props.port) + val remote = new SRemoteAddress(props.host, props.port.toInt) Supervise(actorRef, lifeCycle.transform, remote) } else { Supervise(actorRef, lifeCycle.transform) diff --git a/akka-spring/src/test/resources/akka-test.conf b/akka-spring/src/test/resources/akka-test.conf new file mode 100644 index 0000000000..2ade509c06 --- /dev/null +++ b/akka-spring/src/test/resources/akka-test.conf @@ -0,0 +1,13 @@ +akka { + actor { + timeout = 2000 + } + remote { + server { + service = on + hostname = "localhost" # The hostname or IP that clients should connect to + port = 9995 # The port clients should connect to + connection-timeout = 1 + } + } +} diff --git a/akka-spring/src/test/resources/property-config.xml b/akka-spring/src/test/resources/property-config.xml new file mode 100644 index 0000000000..c61255aa9b --- /dev/null +++ b/akka-spring/src/test/resources/property-config.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + diff --git a/akka-spring/src/test/scala/ActorFactoryBeanTest.scala b/akka-spring/src/test/scala/ActorFactoryBeanTest.scala index 0bd373a408..29cd48017b 100644 --- a/akka-spring/src/test/scala/ActorFactoryBeanTest.scala +++ b/akka-spring/src/test/scala/ActorFactoryBeanTest.scala @@ -25,8 +25,8 @@ class ActorFactoryBeanTest extends Spec with ShouldMatchers with BeforeAndAfterA it("should have java getters and setters for all properties") { bean.setImplementation("java.lang.String") assert(bean.getImplementation == "java.lang.String") - bean.setTimeout(1000) - assert(bean.getTimeout == 1000) + bean.setTimeoutStr("1000") + assert(bean.getTimeoutStr === "1000") } it("should create a remote typed actor when a host is set") { @@ -50,7 +50,7 @@ class ActorFactoryBeanTest extends Spec with ShouldMatchers with BeforeAndAfterA val bean = new ActorFactoryBean() bean.setInterface("se.scalablesolutions.akka.spring.PojoInf") bean.setImplementation("se.scalablesolutions.akka.spring.Pojo") - bean.timeout = 1000 + bean.timeoutStr = "1000" bean.typed = AkkaSpringConfigurationTags.TYPED_ACTOR_TAG val entries = new PropertyEntries() val entry = new PropertyEntry() diff --git a/akka-spring/src/test/scala/ConfiggyPropertyPlaceholderConfigurerSpec.scala b/akka-spring/src/test/scala/ConfiggyPropertyPlaceholderConfigurerSpec.scala new file mode 100644 index 0000000000..4f28b2fc8f --- /dev/null +++ b/akka-spring/src/test/scala/ConfiggyPropertyPlaceholderConfigurerSpec.scala @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2009-2010 Scalable Solutions AB + */ +package se.scalablesolutions.akka.spring + + +import foo.{IMyPojo, MyPojo, PingActor} +import se.scalablesolutions.akka.dispatch._ +import org.scalatest.FeatureSpec +import org.scalatest.matchers.ShouldMatchers +import org.scalatest.junit.JUnitRunner +import org.junit.runner.RunWith +import org.springframework.beans.factory.support.DefaultListableBeanFactory +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader +import org.springframework.context.ApplicationContext +import org.springframework.context.support.ClassPathXmlApplicationContext +import org.springframework.core.io.{ClassPathResource, Resource} +import java.util.concurrent._ +import se.scalablesolutions.akka.actor.{UntypedActor, Actor, ActorRef} + + + + +/** + * Tests for spring configuration of typed actors. + * @author michaelkober + */ +@RunWith(classOf[JUnitRunner]) +class ConfiggyPropertyPlaceholderConfigurerSpec extends FeatureSpec with ShouldMatchers { + val EVENT_DRIVEN_PREFIX = "akka:event-driven:dispatcher:" + + feature("The ConfiggyPropertyPlaceholderConfigurator") { + + scenario("should provide the akkka config for spring") { + val context = new ClassPathXmlApplicationContext("/property-config.xml") + val actor1 = context.getBean("actor-1").asInstanceOf[ActorRef] + assert(actor1.remoteAddress.get.getHostName === "localhost") + assert(actor1.remoteAddress.get.getPort === 9995) + assert(actor1.timeout === 2000) + } + } +} \ No newline at end of file diff --git a/akka-spring/src/test/scala/SupervisionFactoryBeanTest.scala b/akka-spring/src/test/scala/SupervisionFactoryBeanTest.scala index 2d7baf2b3e..79872b18d4 100644 --- a/akka-spring/src/test/scala/SupervisionFactoryBeanTest.scala +++ b/akka-spring/src/test/scala/SupervisionFactoryBeanTest.scala @@ -16,12 +16,12 @@ private[akka] class Foo class SupervisionFactoryBeanTest extends Spec with ShouldMatchers { val restartStrategy = new RestartStrategy(new AllForOne(), 3, 1000, Array(classOf[Throwable])) - val typedActors = List(createTypedActorProperties("se.scalablesolutions.akka.spring.Foo", 1000L)) + val typedActors = List(createTypedActorProperties("se.scalablesolutions.akka.spring.Foo", "1000")) - def createTypedActorProperties(target: String, timeout: Long) : ActorProperties = { + private def createTypedActorProperties(target: String, timeout: String) : ActorProperties = { val properties = new ActorProperties() properties.target = target - properties.timeout = timeout + properties.timeoutStr = timeout properties } diff --git a/config/akka.conf b/config/akka.conf index 84b9bfbbcf..ebbf27b8e8 100644 --- a/config/akka.conf +++ b/config/akka.conf @@ -1,5 +1,100 @@ # This config imports the Akka reference configuration. -include "akka-reference.conf" +#include "akka-reference.conf" # In this file you can override any option defined in the 'akka-reference.conf' file. # Copy in all or parts of the 'akka-reference.conf' file and modify as you please. + +akka { + actor { + timeout = 5 + } +remote { +server { + service = on + hostname = "laptop-mike.local" # The hostname or IP that clients should connect to + port = 9995 # The port clients should connect to + connection-timeout = 1 + } +} + + +monitoring { + jmx { + # jmx monitoring + # + # port for jmx registry + port = 1099 + + # service url for jmx connector + service-url = "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi" + } + + snmp { + # snmp monitoring + # + # port for snmp agent + port = 1611 + } + + web { + # web dashboard + # + # port for dashboard web server + port = 9999 + } + + attributes { + + # time interval to reset all statistic counters by a ResetTask + # m = minutes + # h = hours + # s = seconds + # example reset every 5 minutes: reset-interval = "5m" + # + reset-interval = "30s" # default + + # delay for the first time the ResetTask is scheduled + reset-delay = "30s" # default + + # Sampling rate for time based sampling + # 0 < sampling-rate <= 1 + # + # i.e. sampling-rate = 0.5 means that only one half of the interval will be measured + # (assuming a uniformly distribution of hits over the complete interval) + sampling-rate = 0.5 + + # Enabled list: + # - list of enabled attributes, for id see Definitions.scala + # - "all" for full monitoring + # + # [ "NrOfActors", "NrOfCreatedActors", "NrOfStartedActors", "NrOfStoppedActors", + # "NrOfBangs", "NrOfBangBangs", "NrOfBangBangBangs", "NrOfFailures", "NrOfRestarts", + # "NrOfProcessedMessages_", "NrOfRestarts_", "NrOfFailures_", "TimeInQueue", "TimeToProcess", + # "RemoteClientEvent_", "RemoteServerEvent_", "RemoteMessage_" ] + enabled = [ "all" ] + + # Disabled list: + # - list of disabled attributes, for id see Definitions.scala + # disabled = [ "NrOfBangs" ] + + # Sampling list: + # use sampling for the specified attributes (can only be used for averages): + # sampling = [ "TimeInQueue", "TimeToProcess" ] + + # Watermarks list: + # use watermarks for the specified attributes (can only be used for averages): + watermarks = [ "TimeInQueue", "TimeToProcess", "MailboxSize_" ] + + # Sampling and Watermarks list: + # use watermarks and watermarks for the specified attributes (can only be used for averages): + # watermarks-sampling = [ "MailboxSize_" ] + } + } +} + + + + + +} + From 00949a213f2b7a7ad3e5bbaa14b436c7e69bb7fe Mon Sep 17 00:00:00 2001 From: Michael Kober Date: Wed, 22 Sep 2010 12:56:22 +0200 Subject: [PATCH 2/5] fixed missing aop.xml in akka-typed-actor jar --- .../src/main}/resources/META-INF/aop.xml | 0 akka-typed-actor/src/test/resources/META-INF/aop.xml | 8 -------- 2 files changed, 8 deletions(-) rename {akka-remote/src/test => akka-typed-actor/src/main}/resources/META-INF/aop.xml (100%) delete mode 100644 akka-typed-actor/src/test/resources/META-INF/aop.xml diff --git a/akka-remote/src/test/resources/META-INF/aop.xml b/akka-typed-actor/src/main/resources/META-INF/aop.xml similarity index 100% rename from akka-remote/src/test/resources/META-INF/aop.xml rename to akka-typed-actor/src/main/resources/META-INF/aop.xml diff --git a/akka-typed-actor/src/test/resources/META-INF/aop.xml b/akka-typed-actor/src/test/resources/META-INF/aop.xml deleted file mode 100644 index be133a51b8..0000000000 --- a/akka-typed-actor/src/test/resources/META-INF/aop.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - From 5a74789323b6b0a436a9efa99fb93bdebd94ed7e Mon Sep 17 00:00:00 2001 From: Michael Kober Date: Wed, 22 Sep 2010 13:14:02 +0200 Subject: [PATCH 3/5] fixed merge error in conf --- config/akka.conf | 97 +----------------------------------------------- 1 file changed, 1 insertion(+), 96 deletions(-) diff --git a/config/akka.conf b/config/akka.conf index ebbf27b8e8..84b9bfbbcf 100644 --- a/config/akka.conf +++ b/config/akka.conf @@ -1,100 +1,5 @@ # This config imports the Akka reference configuration. -#include "akka-reference.conf" +include "akka-reference.conf" # In this file you can override any option defined in the 'akka-reference.conf' file. # Copy in all or parts of the 'akka-reference.conf' file and modify as you please. - -akka { - actor { - timeout = 5 - } -remote { -server { - service = on - hostname = "laptop-mike.local" # The hostname or IP that clients should connect to - port = 9995 # The port clients should connect to - connection-timeout = 1 - } -} - - -monitoring { - jmx { - # jmx monitoring - # - # port for jmx registry - port = 1099 - - # service url for jmx connector - service-url = "service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi" - } - - snmp { - # snmp monitoring - # - # port for snmp agent - port = 1611 - } - - web { - # web dashboard - # - # port for dashboard web server - port = 9999 - } - - attributes { - - # time interval to reset all statistic counters by a ResetTask - # m = minutes - # h = hours - # s = seconds - # example reset every 5 minutes: reset-interval = "5m" - # - reset-interval = "30s" # default - - # delay for the first time the ResetTask is scheduled - reset-delay = "30s" # default - - # Sampling rate for time based sampling - # 0 < sampling-rate <= 1 - # - # i.e. sampling-rate = 0.5 means that only one half of the interval will be measured - # (assuming a uniformly distribution of hits over the complete interval) - sampling-rate = 0.5 - - # Enabled list: - # - list of enabled attributes, for id see Definitions.scala - # - "all" for full monitoring - # - # [ "NrOfActors", "NrOfCreatedActors", "NrOfStartedActors", "NrOfStoppedActors", - # "NrOfBangs", "NrOfBangBangs", "NrOfBangBangBangs", "NrOfFailures", "NrOfRestarts", - # "NrOfProcessedMessages_", "NrOfRestarts_", "NrOfFailures_", "TimeInQueue", "TimeToProcess", - # "RemoteClientEvent_", "RemoteServerEvent_", "RemoteMessage_" ] - enabled = [ "all" ] - - # Disabled list: - # - list of disabled attributes, for id see Definitions.scala - # disabled = [ "NrOfBangs" ] - - # Sampling list: - # use sampling for the specified attributes (can only be used for averages): - # sampling = [ "TimeInQueue", "TimeToProcess" ] - - # Watermarks list: - # use watermarks for the specified attributes (can only be used for averages): - watermarks = [ "TimeInQueue", "TimeToProcess", "MailboxSize_" ] - - # Sampling and Watermarks list: - # use watermarks and watermarks for the specified attributes (can only be used for averages): - # watermarks-sampling = [ "MailboxSize_" ] - } - } -} - - - - - -} - From 75ab1f9934eed4d32f06437ca6140f6038762ef0 Mon Sep 17 00:00:00 2001 From: Michael Kober Date: Wed, 22 Sep 2010 14:10:44 +0200 Subject: [PATCH 4/5] fixed TypedActorBeanDefinitionParserTest --- .../src/test/scala/TypedActorBeanDefinitionParserTest.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/akka-spring/src/test/scala/TypedActorBeanDefinitionParserTest.scala b/akka-spring/src/test/scala/TypedActorBeanDefinitionParserTest.scala index bd0b018e75..52663afe63 100644 --- a/akka-spring/src/test/scala/TypedActorBeanDefinitionParserTest.scala +++ b/akka-spring/src/test/scala/TypedActorBeanDefinitionParserTest.scala @@ -65,7 +65,7 @@ class TypedActorBeanDefinitionParserTest extends Spec with ShouldMatchers { val props = parser.parseActor(dom(xml).getDocumentElement); assert(props != null) assert(props.host === "com.some.host") - assert(props.port === 9999) + assert(props.port === "9999") assert(!props.serverManaged) } @@ -77,7 +77,7 @@ class TypedActorBeanDefinitionParserTest extends Spec with ShouldMatchers { val props = parser.parseActor(dom(xml).getDocumentElement); assert(props != null) assert(props.host === "com.some.host") - assert(props.port === 9999) + assert(props.port === "9999") assert(props.serviceName === "my-service") assert(props.serverManaged) } From d652d0c2b888f6806d2186861a3b2affcdfb7dba Mon Sep 17 00:00:00 2001 From: David Greco Date: Wed, 22 Sep 2010 14:41:19 +0200 Subject: [PATCH 5/5] Corrected a bug, now the hbase quorum is read correctly from the configuration --- .../src/main/scala/HbaseStorageBackend.scala | 2 +- .../akka-persistence-hbase/src/test/scala/SimpleHbaseTest.scala | 2 +- config/akka-reference.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/akka-persistence/akka-persistence-hbase/src/main/scala/HbaseStorageBackend.scala b/akka-persistence/akka-persistence-hbase/src/main/scala/HbaseStorageBackend.scala index 4b887add31..69c393f455 100644 --- a/akka-persistence/akka-persistence-hbase/src/main/scala/HbaseStorageBackend.scala +++ b/akka-persistence/akka-persistence-hbase/src/main/scala/HbaseStorageBackend.scala @@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.util.Bytes private[akka] object HbaseStorageBackend extends MapStorageBackend[Array[Byte], Array[Byte]] with VectorStorageBackend[Array[Byte]] with RefStorageBackend[Array[Byte]] with Logging { val EMPTY_BYTE_ARRAY = new Array[Byte](0) - val HBASE_ZOOKEEPER_QUORUM = config.getString("akka.storage.hbase.zookeeper.quorum", "localhost") + val HBASE_ZOOKEEPER_QUORUM = config.getString("akka.storage.hbase.zookeeper-quorum", "localhost") val CONFIGURATION = new HBaseConfiguration val REF_TABLE_NAME = "__REF_TABLE" val VECTOR_TABLE_NAME = "__VECTOR_TABLE" diff --git a/akka-persistence/akka-persistence-hbase/src/test/scala/SimpleHbaseTest.scala b/akka-persistence/akka-persistence-hbase/src/test/scala/SimpleHbaseTest.scala index 82e8f32533..f59e3ae55e 100644 --- a/akka-persistence/akka-persistence-hbase/src/test/scala/SimpleHbaseTest.scala +++ b/akka-persistence/akka-persistence-hbase/src/test/scala/SimpleHbaseTest.scala @@ -48,7 +48,7 @@ class PersistenceSpec extends Spec with BeforeAndAfterAll with ShouldMatchers { import org.apache.hadoop.hbase.client.HBaseAdmin import org.apache.hadoop.hbase.client.HTable - val HBASE_ZOOKEEPER_QUORUM = config.getString("akka.storage.hbase.zookeeper.quorum", "0") + val HBASE_ZOOKEEPER_QUORUM = config.getString("akka.storage.hbase.zookeeper-quorum", "0") HBASE_ZOOKEEPER_QUORUM should not equal ("0") HBASE_ZOOKEEPER_QUORUM should equal("localhost") diff --git a/config/akka-reference.conf b/config/akka-reference.conf index 09e1f39ed3..728f269170 100644 --- a/config/akka-reference.conf +++ b/config/akka-reference.conf @@ -166,7 +166,7 @@ akka { } hbase { - zookeeper.quorum = "localhost" + zookeeper-quorum = "localhost" } } }