Permalink
Browse files

added spring dispatcher configuration

  • Loading branch information...
1 parent e33c586 commit 8ae90fdfdaef1284e02faa2042e17ac2536e8fe1 @kobmic kobmic committed Mar 30, 2010
Showing with 1,402 additions and 474 deletions.
  1. +81 −0 ...ka-spring-test-java/src/main/resources/se/scalablesolutions/akka/spring/foo/dispatcher-config.xml
  2. +87 −0 ...ka-spring-test-java/src/main/resources/se/scalablesolutions/akka/spring/foo/supervisor-config.xml
  3. +64 −65 ...ing/akka-spring-test-java/src/main/resources/se/scalablesolutions/akka/spring/foo/test-config.xml
  4. +99 −0 ...pring-test-java/src/test/java/se/scalablesolutions/akka/spring/ActiveObjectConfigurationTest.java
  5. +143 −0 ...-spring-test-java/src/test/java/se/scalablesolutions/akka/spring/DispatcherConfigurationTest.java
  6. +0 −120 ...akka-spring-test-java/src/test/java/se/scalablesolutions/akka/spring/SpringConfigurationTest.java
  7. +70 −0 ...-spring-test-java/src/test/java/se/scalablesolutions/akka/spring/SupervisorConfigurationTest.java
  8. +217 −154 akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka.xsd
  9. +14 −73 akka-spring/src/main/scala/ActiveObjectBeanDefinitionParser.scala
  10. +52 −27 akka-spring/src/main/scala/ActiveObjectFactoryBean.scala
  11. +66 −0 akka-spring/src/main/scala/ActiveObjectParser.scala
  12. +3 −0 akka-spring/src/main/scala/ActiveObjectProperties.scala
  13. +2 −1 akka-spring/src/main/scala/AkkaNamespaceHandler.scala
  14. +54 −2 akka-spring/src/main/scala/AkkaSpringConfigurationTags.scala
  15. +42 −0 akka-spring/src/main/scala/BeanParser.scala
  16. +7 −9 ...ring/src/main/scala/{AkkaObjectBeanDefinitionParser.scala → DispatcherBeanDefinitionParser.scala}
  17. +83 −0 akka-spring/src/main/scala/DispatcherFactoryBean.scala
  18. +87 −0 akka-spring/src/main/scala/DispatcherParser.scala
  19. +58 −0 akka-spring/src/main/scala/DispatcherProperties.scala
  20. +1 −1 akka-spring/src/main/scala/SupervisionBeanDefinitionParser.scala
  21. +33 −18 akka-spring/src/test/scala/ActiveObjectBeanDefinitionParserTest.scala
  22. +12 −4 akka-spring/src/test/scala/ActiveObjectFactoryBeanTest.scala
  23. +99 −0 akka-spring/src/test/scala/DispatcherBeanDefinitionParserTest.scala
  24. +28 −0 akka-spring/src/test/scala/DispatcherFactoryBeanTest.scala
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:akka="http://www.akkasource.org/schema/akka" xmlns:beans="http://www.springframework.org/schema/lang"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.akkasource.org/schema/akka
+ file:////Users/michaelkober/akka/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka.xsd">
+
+
+ <akka:active-object id="active-object-with-dispatcher" target="se.scalablesolutions.akka.spring.foo.MyPojo"
+ timeout="1000">
+ <akka:dispatcher type="executor-based-event-driven" name="test"/>
+ </akka:active-object>
+
+ <akka:active-object id="active-object-with-dispatcher-ref" target="se.scalablesolutions.akka.spring.foo.MyPojo"
+ timeout="1000">
+ <akka:dispatcher ref="executor-event-driven-dispatcher-1"/>
+ </akka:active-object>
+
+
+ <!-- executor-event-driven-dispatcher with bounded-array-blocking-queue -->
+ <akka:dispatcher id="executor-event-driven-dispatcher-1" type="executor-based-event-driven" name="myDispatcher">
+ <akka:thread-pool queue="bounded-array-blocking-queue"
+ capacity="100"
+ fairness="true"
+ core-pool-size="1"
+ max-pool-size="20"
+ keep-alive="3000"/>
+ </akka:dispatcher>
+
+ <!-- executor-event-driven-dispatcher with bounded-linked-blocking-queue with unbounded capacity-->
+ <akka:dispatcher id="executor-event-driven-dispatcher-2" type="executor-based-event-driven" name="myDispatcher">
+ <akka:thread-pool queue="bounded-linked-blocking-queue"
+ bound="10" />
+ </akka:dispatcher>
+
+ <!-- executor-event-driven-dispatcher with unbounded-linked-blocking-queue with bounded capacity-->
+ <akka:dispatcher id="executor-event-driven-dispatcher-4" type="executor-based-event-driven" name="myDispatcher">
+ <akka:thread-pool queue="unbounded-linked-blocking-queue"
+ capacity="55" />
+ </akka:dispatcher>
+
+ <!-- executor-event-driven-dispatcher with unbounded-linked-blocking-queue with unbounded capacity-->
+ <akka:dispatcher id="executor-event-driven-dispatcher-5" type="executor-based-event-driven" name="myDispatcher">
+ <akka:thread-pool queue="unbounded-linked-blocking-queue" />
+ </akka:dispatcher>
+
+
+ <!-- executor-event-driven-dispatcher with synchronous-queue -->
+ <akka:dispatcher id="executor-event-driven-dispatcher-6" type="executor-based-event-driven" name="myDispatcher">
+ <akka:thread-pool queue="synchronous-queue" fairness="true" />
+ </akka:dispatcher>
+
+ <!-- reactor-based-thread-pool-event-driven-dispatcher with synchronous-queue -->
+ <akka:dispatcher id="reactor-based-thread-pool-event-driven-dispatcher" type="reactor-based-thread-pool-event-driven" name="myDispatcher">
+ <akka:thread-pool queue="synchronous-queue" fairness="true" />
+ </akka:dispatcher>
+
+ <akka:dispatcher id="reactor-based-single-thread-event-driven-dispatcher" type="reactor-based-single-thread-event-driven" name="myDispatcher" />
+
+ <akka:supervision id="supervision1">
+ <akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
+ <akka:trap-exits>
+ <akka:trap-exit>java.io.IOException</akka:trap-exit>
+ <akka:trap-exit>java.lang.NullPointerException</akka:trap-exit>
+ </akka:trap-exits>
+ </akka:restart-strategy>
+ <akka:active-objects>
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.Foo" lifecycle="permanent" timeout="1000"/>
+ <akka:active-object interface="se.scalablesolutions.akka.spring.foo.IBar"
+ target="se.scalablesolutions.akka.spring.foo.Bar" lifecycle="permanent" timeout="1000"/>
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.MyPojo" lifecycle="temporary" timeout="1000">
+ <akka:restart-callbacks pre="preRestart" post="postRestart"/>
+ </akka:active-object>
+ </akka:active-objects>
+ </akka:supervision>
+
+
+
+</beans>
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:akka="http://www.akkasource.org/schema/akka" xmlns:beans="http://www.springframework.org/schema/lang"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.akkasource.org/schema/akka
+ file:////Users/michaelkober/akka/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka.xsd">
+
+ <akka:supervision id="supervision1">
+ <akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
+ <akka:trap-exits>
+ <akka:trap-exit>java.io.IOException</akka:trap-exit>
+ <akka:trap-exit>java.lang.NullPointerException</akka:trap-exit>
+ </akka:trap-exits>
+ </akka:restart-strategy>
+ <akka:active-objects>
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.Foo" lifecycle="permanent" timeout="1000"/>
+ <akka:active-object interface="se.scalablesolutions.akka.spring.foo.IBar"
+ target="se.scalablesolutions.akka.spring.foo.Bar" lifecycle="permanent" timeout="1000"/>
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.MyPojo" lifecycle="temporary" timeout="1000">
+ <akka:restart-callbacks pre="preRestart" post="postRestart"/>
+ </akka:active-object>
+ </akka:active-objects>
+ </akka:supervision>
+
+ <akka:supervision id="supervision2">
+ <akka:restart-strategy failover="AllForOne" retries="3" timerange="5000">
+ <akka:trap-exits>
+ <akka:trap-exit>java.lang.Exception</akka:trap-exit>
+ </akka:trap-exits>
+ </akka:restart-strategy>
+ <akka:active-objects>
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.StatefulPojo" lifecycle="permanent"
+ timeout="10000" transactional="true"/>
+ </akka:active-objects>
+ </akka:supervision>
+
+ <akka:dispatcher id="mydispatcher" type="executor-based-event-driven" name="myDispatcher">
+ <akka:thread-pool queue="bounded-array-blocking-queue"
+ capacity="100"
+ fairness="true"
+ core-pool-size="1"
+ max-pool-size="20"
+ keep-alive="3000"/>
+ </akka:dispatcher>
+
+ <akka:supervision id="supervision-with-dispatcher">
+ <akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
+ <akka:trap-exits>
+ <akka:trap-exit>java.lang.Exception</akka:trap-exit>
+ </akka:trap-exits>
+ </akka:restart-strategy>
+ <akka:active-objects>
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.Foo" lifecycle="permanent" timeout="1000">
+ <akka:dispatcher ref="mydispatcher" />
+ </akka:active-object>
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.MyPojo" lifecycle="temporary" timeout="1000">
+ <akka:restart-callbacks pre="preRestart" post="postRestart"/>
+ <akka:dispatcher ref="mydispatcher" />
+ </akka:active-object>
+ </akka:active-objects>
+ </akka:supervision>
+
+ <akka:supervision id="parent-supervision">
+ <akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
+ <akka:trap-exits>
+ <akka:trap-exit>java.lang.Exception</akka:trap-exit>
+ </akka:trap-exits>
+ </akka:restart-strategy>
+ <akka:active-objects>
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.Foo" lifecycle="permanent" timeout="1000" />
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.MyPojo" lifecycle="temporary" timeout="1000" />
+ </akka:active-objects>
+ <akka:supervision id="nested-supervision">
+ <akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
+ <akka:trap-exits>
+ <akka:trap-exit>java.lang.IOException</akka:trap-exit>
+ </akka:trap-exits>
+ </akka:restart-strategy>
+ <akka:active-objects>
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.Bar" lifecycle="permanent" timeout="1000" />
+ </akka:active-objects>
+ </akka:supervision>
+ </akka:supervision>
+
+</beans>
@@ -1,76 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:akka="http://www.akkasource.org/schema/akka"
+ xmlns:akka="http://www.akkasource.org/schema/akka" xmlns:beans="http://www.springframework.org/schema/lang"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.akkasource.org/schema/akka
file:////Users/michaelkober/akka/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka.xsd">
-
- <bean id="wrappedService"
- class="se.scalablesolutions.akka.actor.ActiveObject"
- factory-method="newInstance">
- <constructor-arg index="0" type="java.lang.Class" value="se.scalablesolutions.akka.spring.foo.MyPojo"/>
- <constructor-arg index="1" value="1000"/>
- </bean>
-
- <akka:active-object id="simple-active-object"
- target="se.scalablesolutions.akka.spring.foo.MyPojo"
- timeout="1000"/>
- <akka:active-object id="simple-active-object-long-timeout"
- target="se.scalablesolutions.akka.spring.foo.MyPojo"
- timeout="10000"/>
-
- <akka:active-object id="transactional-active-object"
- target="se.scalablesolutions.akka.spring.foo.MyPojo"
- timeout="2000"
- transactional="true"/>
-
- <akka:active-object id="active-object-callbacks"
- target="se.scalablesolutions.akka.spring.foo.MyPojo"
- timeout="2000"
- transactional="true">
- <akka:restart-callbacks pre="preRestart" post="postRestart"/>
- </akka:active-object>
-
- <akka:active-object id="remote-active-object"
- target="se.scalablesolutions.akka.spring.foo.MyPojo"
- timeout="2000"
- transactional="true">
+ <bean id="wrappedService"
+ class="se.scalablesolutions.akka.actor.ActiveObject"
+ factory-method="newInstance">
+ <constructor-arg index="0" type="java.lang.Class" value="se.scalablesolutions.akka.spring.foo.MyPojo"/>
+ <constructor-arg index="1" value="1000"/>
+ </bean>
+
+ <akka:active-object id="simple-active-object"
+ target="se.scalablesolutions.akka.spring.foo.MyPojo"
+ timeout="1000"/>
+
+ <akka:active-object id="simple-active-object-long-timeout"
+ target="se.scalablesolutions.akka.spring.foo.MyPojo"
+ timeout="10000"/>
+
+ <akka:active-object id="transactional-active-object"
+ target="se.scalablesolutions.akka.spring.foo.MyPojo"
+ timeout="2000"
+ transactional="true"/>
+
+ <akka:active-object id="active-object-callbacks"
+ target="se.scalablesolutions.akka.spring.foo.MyPojo"
+ timeout="2000"
+ transactional="true">
+ <akka:restart-callbacks pre="preRestart" post="postRestart"/>
+ </akka:active-object>
+
+ <akka:active-object id="remote-active-object"
+ target="se.scalablesolutions.akka.spring.foo.MyPojo"
+ timeout="2000"
+ transactional="true">
+ <akka:restart-callbacks pre="preRestart" post="postRestart"/>
+ <akka:remote host="localhost" port="9999"/>
+ </akka:active-object>
+
+ <akka:active-object id="remote-service1" target="se.scalablesolutions.akka.spring.foo.MyPojo" timeout="1000">
+ <akka:remote host="localhost" port="9999"/>
+ </akka:active-object>
+
+ <akka:dispatcher id="dispatcher1" type="executor-based-event-driven" name="myDispatcher">
+ <akka:thread-pool queue="bounded-array-blocking-queue"
+ capacity="100"
+ fairness="true"
+ core-pool-size="3"
+ max-pool-size="40"
+ keep-alive="2000"/>
+ </akka:dispatcher>
+
+ <akka:supervision id="supervision1">
+ <akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
+ <akka:trap-exits>
+ <akka:trap-exit>java.io.IOException</akka:trap-exit>
+ <akka:trap-exit>java.lang.NullPointerException</akka:trap-exit>
+ </akka:trap-exits>
+ </akka:restart-strategy>
+ <akka:active-objects>
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.Foo" lifecycle="permanent" timeout="1000"/>
+ <akka:active-object interface="se.scalablesolutions.akka.spring.foo.IBar"
+ target="se.scalablesolutions.akka.spring.foo.Bar" lifecycle="permanent" timeout="1000"/>
+ <akka:active-object target="se.scalablesolutions.akka.spring.foo.MyPojo" lifecycle="temporary" timeout="1000">
<akka:restart-callbacks pre="preRestart" post="postRestart"/>
- <akka:remote host="localhost" port="9999" />
- </akka:active-object>
-
- <akka:active-object id="remote-service1" target="se.scalablesolutions.akka.spring.foo.MyPojo" timeout="1000">
- <akka:remote host="localhost" port="9999" />
- </akka:active-object>
-
- <akka:supervision id="supervision1">
- <akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
- <akka:trap-exits>
- <akka:trap-exit>java.io.IOException</akka:trap-exit>
- <akka:trap-exit>java.lang.NullPointerException</akka:trap-exit>
- </akka:trap-exits>
- </akka:restart-strategy>
- <akka:active-objects>
- <akka:active-object target="se.scalablesolutions.akka.spring.foo.Foo" lifecycle="permanent" timeout="1000"/>
- <akka:active-object interface="se.scalablesolutions.akka.spring.foo.IBar" target="se.scalablesolutions.akka.spring.foo.Bar" lifecycle="permanent" timeout="1000"/>
- <akka:active-object target="se.scalablesolutions.akka.spring.foo.MyPojo" lifecycle="temporary" timeout="1000">
- <akka:restart-callbacks pre="preRestart" post="postRestart"/>
- </akka:active-object>
- </akka:active-objects>
- </akka:supervision>
+ </akka:active-object>
+ </akka:active-objects>
+ </akka:supervision>
- <akka:supervision id="supervision2">
- <akka:restart-strategy failover="AllForOne" retries="3" timerange="5000">
- <akka:trap-exits>
- <akka:trap-exit>java.lang.Exception</akka:trap-exit>
- </akka:trap-exits>
- </akka:restart-strategy>
- <akka:active-objects>
- <akka:active-object target="se.scalablesolutions.akka.spring.foo.StatefulPojo" lifecycle="permanent" timeout="10000" transactional="true"/>
- </akka:active-objects>
- </akka:supervision>
-
</beans>
Oops, something went wrong.

0 comments on commit 8ae90fd

Please sign in to comment.