fixed @inittransactionalstate, updated pom for spring java tests
changed timeout in declarative config from Int to Long
This commit is contained in:
parent
59e4b53bf4
commit
0368d9bca8
10 changed files with 102 additions and 90 deletions
|
|
@ -185,8 +185,8 @@ object ActiveObject {
|
|||
val proxy = Proxy.newInstance(target, false, true)
|
||||
actor.initialize(target, proxy)
|
||||
actor.timeout = timeout
|
||||
actor.start
|
||||
AspectInitRegistry.register(proxy, AspectInit(target, actor, remoteAddress, timeout))
|
||||
actor.start
|
||||
proxy.asInstanceOf[T]
|
||||
}
|
||||
|
||||
|
|
@ -194,8 +194,8 @@ object ActiveObject {
|
|||
val proxy = Proxy.newInstance(Array(intf), Array(target), false, true)
|
||||
actor.initialize(target.getClass, target)
|
||||
actor.timeout = timeout
|
||||
actor.start
|
||||
AspectInitRegistry.register(proxy, AspectInit(intf, actor, remoteAddress, timeout))
|
||||
actor.start
|
||||
proxy.asInstanceOf[T]
|
||||
}
|
||||
|
||||
|
|
@ -408,9 +408,9 @@ private[akka] class Dispatcher(transactionalRequired: Boolean, val callbacks: Op
|
|||
if (postRestart.isDefined) postRestart.get.setAccessible(true)
|
||||
|
||||
// see if we have a method annotated with @inittransactionalstate, if so invoke it
|
||||
//initTxState = methods.find(m => m.isAnnotationPresent(Annotations.inittransactionalstate))
|
||||
//if (initTxState.isDefined && initTxState.get.getParameterTypes.length != 0) throw new IllegalStateException("Method annotated with @inittransactionalstate must have a zero argument definition")
|
||||
//if (initTxState.isDefined) initTxState.get.setAccessible(true)
|
||||
initTxState = methods.find(m => m.isAnnotationPresent(Annotations.inittransactionalstate))
|
||||
if (initTxState.isDefined && initTxState.get.getParameterTypes.length != 0) throw new IllegalStateException("Method annotated with @inittransactionalstate must have a zero argument definition")
|
||||
if (initTxState.isDefined) initTxState.get.setAccessible(true)
|
||||
}
|
||||
|
||||
def receive = {
|
||||
|
|
@ -434,11 +434,11 @@ private[akka] class Dispatcher(transactionalRequired: Boolean, val callbacks: Op
|
|||
} catch { case e: InvocationTargetException => throw e.getCause }
|
||||
}
|
||||
|
||||
//override protected def initTransactionalState = {
|
||||
// try {
|
||||
// if (initTxState.isDefined && target.isDefined) initTxState.get.invoke(target.get, ZERO_ITEM_OBJECT_ARRAY: _*)
|
||||
// } catch { case e: InvocationTargetException => throw e.getCause }
|
||||
//}
|
||||
override protected def initTransactionalState = {
|
||||
try {
|
||||
if (initTxState.isDefined && target.isDefined) initTxState.get.invoke(target.get, ZERO_ITEM_OBJECT_ARRAY: _*)
|
||||
} catch { case e: InvocationTargetException => throw e.getCause }
|
||||
}
|
||||
|
||||
private def serializeArguments(joinPoint: JoinPoint) = {
|
||||
val args = joinPoint.getRtti.asInstanceOf[MethodRtti].getParameterValues
|
||||
|
|
|
|||
|
|
@ -458,6 +458,7 @@ trait Actor extends TransactionManagement with Logging {
|
|||
messageDispatcher.start
|
||||
_isRunning = true
|
||||
init
|
||||
initTransactionalState
|
||||
}
|
||||
Actor.log.debug("[%s] has started", toString)
|
||||
ActorRegistry.register(this)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ object ScalaConfig {
|
|||
class Component(_intf: Class[_],
|
||||
val target: Class[_],
|
||||
val lifeCycle: LifeCycle,
|
||||
val timeout: Int,
|
||||
val timeout: Long,
|
||||
val transactionRequired: Boolean,
|
||||
_dispatcher: MessageDispatcher, // optional
|
||||
_remoteAddress: RemoteAddress // optional
|
||||
|
|
@ -69,52 +69,52 @@ object ScalaConfig {
|
|||
val remoteAddress: Option[RemoteAddress] = if (_remoteAddress eq null) None else Some(_remoteAddress)
|
||||
}
|
||||
object Component {
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int) =
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long) =
|
||||
new Component(intf, target, lifeCycle, timeout, false, null, null)
|
||||
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Int) =
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Long) =
|
||||
new Component(null, target, lifeCycle, timeout, false, null, null)
|
||||
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, dispatcher: MessageDispatcher) =
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, dispatcher: MessageDispatcher) =
|
||||
new Component(intf, target, lifeCycle, timeout, false, dispatcher, null)
|
||||
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Int, dispatcher: MessageDispatcher) =
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Long, dispatcher: MessageDispatcher) =
|
||||
new Component(null, target, lifeCycle, timeout, false, dispatcher, null)
|
||||
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, remoteAddress: RemoteAddress) =
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, remoteAddress: RemoteAddress) =
|
||||
new Component(intf, target, lifeCycle, timeout, false, null, remoteAddress)
|
||||
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Int, remoteAddress: RemoteAddress) =
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Long, remoteAddress: RemoteAddress) =
|
||||
new Component(null, target, lifeCycle, timeout, false, null, remoteAddress)
|
||||
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
new Component(intf, target, lifeCycle, timeout, false, dispatcher, remoteAddress)
|
||||
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Int, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Long, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
new Component(null, target, lifeCycle, timeout, false, dispatcher, remoteAddress)
|
||||
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean) =
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean) =
|
||||
new Component(intf, target, lifeCycle, timeout, transactionRequired, null, null)
|
||||
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean) =
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean) =
|
||||
new Component(null, target, lifeCycle, timeout, transactionRequired, null, null)
|
||||
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean, dispatcher: MessageDispatcher) =
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean, dispatcher: MessageDispatcher) =
|
||||
new Component(intf, target, lifeCycle, timeout, transactionRequired, dispatcher, null)
|
||||
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean, dispatcher: MessageDispatcher) =
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean, dispatcher: MessageDispatcher) =
|
||||
new Component(null, target, lifeCycle, timeout, transactionRequired, dispatcher, null)
|
||||
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean, remoteAddress: RemoteAddress) =
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean, remoteAddress: RemoteAddress) =
|
||||
new Component(intf, target, lifeCycle, timeout, transactionRequired, null, remoteAddress)
|
||||
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean, remoteAddress: RemoteAddress) =
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean, remoteAddress: RemoteAddress) =
|
||||
new Component(null, target, lifeCycle, timeout, transactionRequired, null, remoteAddress)
|
||||
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
new Component(intf, target, lifeCycle, timeout, transactionRequired, dispatcher, remoteAddress)
|
||||
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
def apply(target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
new Component(null, target, lifeCycle, timeout, transactionRequired, dispatcher, remoteAddress)
|
||||
}
|
||||
}
|
||||
|
|
@ -174,52 +174,52 @@ object JavaConfig {
|
|||
class Component(@BeanProperty val intf: Class[_],
|
||||
@BeanProperty val target: Class[_],
|
||||
@BeanProperty val lifeCycle: LifeCycle,
|
||||
@BeanProperty val timeout: Int,
|
||||
@BeanProperty val timeout: Long,
|
||||
@BeanProperty val transactionRequired: Boolean, // optional
|
||||
@BeanProperty val dispatcher: MessageDispatcher, // optional
|
||||
@BeanProperty val remoteAddress: RemoteAddress // optional
|
||||
) extends Server {
|
||||
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int) =
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long) =
|
||||
this(intf, target, lifeCycle, timeout, false, null, null)
|
||||
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Int) =
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Long) =
|
||||
this(null, target, lifeCycle, timeout, false, null, null)
|
||||
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, remoteAddress: RemoteAddress) =
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, remoteAddress: RemoteAddress) =
|
||||
this(intf, target, lifeCycle, timeout, false, null, remoteAddress)
|
||||
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Int, remoteAddress: RemoteAddress) =
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Long, remoteAddress: RemoteAddress) =
|
||||
this(null, target, lifeCycle, timeout, false, null, remoteAddress)
|
||||
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, dispatcher: MessageDispatcher) =
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, dispatcher: MessageDispatcher) =
|
||||
this(intf, target, lifeCycle, timeout, false, dispatcher, null)
|
||||
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Int, dispatcher: MessageDispatcher) =
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Long, dispatcher: MessageDispatcher) =
|
||||
this(null, target, lifeCycle, timeout, false, dispatcher, null)
|
||||
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Int, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Long, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
this(null, target, lifeCycle, timeout, false, dispatcher, remoteAddress)
|
||||
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean) =
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean) =
|
||||
this(intf, target, lifeCycle, timeout, transactionRequired, null, null)
|
||||
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean) =
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean) =
|
||||
this(null, target, lifeCycle, timeout, transactionRequired, null, null)
|
||||
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean, remoteAddress: RemoteAddress) =
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean, remoteAddress: RemoteAddress) =
|
||||
this(intf, target, lifeCycle, timeout, transactionRequired, null, remoteAddress)
|
||||
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean, remoteAddress: RemoteAddress) =
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean, remoteAddress: RemoteAddress) =
|
||||
this(null, target, lifeCycle, timeout, transactionRequired, null, remoteAddress)
|
||||
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean, dispatcher: MessageDispatcher) =
|
||||
def this(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean, dispatcher: MessageDispatcher) =
|
||||
this(intf, target, lifeCycle, timeout, transactionRequired, dispatcher, null)
|
||||
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean, dispatcher: MessageDispatcher) =
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean, dispatcher: MessageDispatcher) =
|
||||
this(null, target, lifeCycle, timeout, transactionRequired, dispatcher, null)
|
||||
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Int, transactionRequired: Boolean, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
def this(target: Class[_], lifeCycle: LifeCycle, timeout: Long, transactionRequired: Boolean, dispatcher: MessageDispatcher, remoteAddress: RemoteAddress) =
|
||||
this(null, target, lifeCycle, timeout, transactionRequired, dispatcher, remoteAddress)
|
||||
|
||||
def transform =
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
<name>Akka Spring Tests in Java</name>
|
||||
<artifactId>akka-spring-test-java</artifactId>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<version>0.7</version>
|
||||
<version>0.8</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<scala.version>2.7.7</scala.version>
|
||||
<scala.version>2.8.0.Beta1</scala.version>
|
||||
<atmosphere.version>0.5.2</atmosphere.version>
|
||||
<jersey.version>1.1.5</jersey.version>
|
||||
<grizzly.version>1.9.18-i</grizzly.version>
|
||||
|
|
@ -131,26 +131,38 @@
|
|||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<!-- Scala -->
|
||||
<dependency>
|
||||
<groupId>org.scala-lang</groupId>
|
||||
<artifactId>scala-compiler</artifactId>
|
||||
<version>2.8.0.Beta1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scala-lang</groupId>
|
||||
<artifactId>scala-library</artifactId>
|
||||
<version>2.8.0.Beta1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- akka -->
|
||||
<dependency>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<artifactId>akka-core_2.7.7</artifactId>
|
||||
<version>0.7</version>
|
||||
<artifactId>akka-core_2.8.0.Beta1</artifactId>
|
||||
<version>0.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<artifactId>akka-util_2.7.7</artifactId>
|
||||
<version>0.7</version>
|
||||
<artifactId>akka-util_2.8.0.Beta1</artifactId>
|
||||
<version>0.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<artifactId>akka-util-java_2.7.7</artifactId>
|
||||
<version>0.7</version>
|
||||
<artifactId>akka-util-java_2.8.0.Beta1</artifactId>
|
||||
<version>0.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<artifactId>akka-spring_2.7.7</artifactId>
|
||||
<version>0.7</version>
|
||||
<artifactId>akka-spring_2.8.0.Beta1</artifactId>
|
||||
<version>0.8</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
|
@ -173,7 +185,7 @@
|
|||
<dependency>
|
||||
<groupId>net.lag</groupId>
|
||||
<artifactId>configgy</artifactId>
|
||||
<version>1.4.7</version>
|
||||
<version>2.8.0.Beta1-1.5-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.aspectwerkz</groupId>
|
||||
|
|
@ -217,24 +229,24 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.databinder</groupId>
|
||||
<artifactId>dispatch-json_2.7.7</artifactId>
|
||||
<version>0.6.4</version>
|
||||
<artifactId>dispatch-json_2.8.0.Beta1</artifactId>
|
||||
<version>0.6.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.databinder</groupId>
|
||||
<artifactId>dispatch-http_2.7.7</artifactId>
|
||||
<version>0.6.4</version>
|
||||
<artifactId>dispatch-http_2.8.0.Beta1</artifactId>
|
||||
<version>0.6.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>sjson.json</groupId>
|
||||
<artifactId>sjson</artifactId>
|
||||
<version>0.4</version>
|
||||
<version>0.5-SNAPSHOT-2.8.Beta1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sbinary</groupId>
|
||||
<artifactId>sbinary</artifactId>
|
||||
<version>0.3</version>
|
||||
<version>2.8.0.Beta1-2.8.0.Beta1-0.3.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
|
|
@ -251,22 +263,8 @@
|
|||
<artifactId>h2-lzf</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scala-tools</groupId>
|
||||
<artifactId>javautils</artifactId>
|
||||
<version>2.7.4-0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scala-lang</groupId>
|
||||
<artifactId>scala-library</artifactId>
|
||||
<version>2.7.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scala-lang</groupId>
|
||||
<artifactId>scala-library</artifactId>
|
||||
<version>2.7.7</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- test -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package se.scalablesolutions.akka.spring.foo;
|
||||
|
||||
import se.scalablesolutions.akka.actor.annotation.inittransactionalstate;
|
||||
import se.scalablesolutions.akka.stm.TransactionalMap;
|
||||
import se.scalablesolutions.akka.stm.TransactionalVector;
|
||||
import se.scalablesolutions.akka.stm.TransactionalRef;
|
||||
|
|
@ -11,15 +12,17 @@ public class StatefulPojo {
|
|||
private TransactionalRef<String> refState;
|
||||
private boolean isInitialized = false;
|
||||
|
||||
public void init() {
|
||||
@inittransactionalstate
|
||||
public void init() {
|
||||
if (!isInitialized) {
|
||||
mapState = TransactionalState.newMap();
|
||||
mapState = TransactionalState.newMap();
|
||||
vectorState = TransactionalState.newVector();
|
||||
refState = TransactionalState.newRef();
|
||||
isInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String getMapState(String key) {
|
||||
return (String)mapState.get(key).get();
|
||||
}
|
||||
|
|
@ -44,4 +47,8 @@ public class StatefulPojo {
|
|||
refState.swap(msg);
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
return isInitialized;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
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">
|
||||
http://scalablesolutions.se/akka/akka.xsd">
|
||||
|
||||
|
||||
<akka:active-object id="active-object-with-dispatcher" target="se.scalablesolutions.akka.spring.foo.MyPojo"
|
||||
|
|
@ -26,7 +26,8 @@
|
|||
fairness="true"
|
||||
core-pool-size="1"
|
||||
max-pool-size="20"
|
||||
keep-alive="3000"/>
|
||||
keep-alive="3000"
|
||||
rejection-policy="caller-runs-policy"/>
|
||||
</akka:dispatcher>
|
||||
|
||||
<!-- executor-event-driven-dispatcher with bounded-linked-blocking-queue with unbounded capacity-->
|
||||
|
|
@ -51,7 +52,7 @@
|
|||
<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" />
|
||||
|
|
@ -76,6 +77,6 @@
|
|||
</akka:active-objects>
|
||||
</akka:supervision>
|
||||
|
||||
|
||||
|
||||
|
||||
</beans>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
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">
|
||||
http://scalablesolutions.se/akka/akka.xsd">
|
||||
|
||||
<akka:supervision id="supervision1">
|
||||
<akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
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">
|
||||
http://scalablesolutions.se/akka/akka.xsd">
|
||||
|
||||
<bean id="wrappedService"
|
||||
class="se.scalablesolutions.akka.actor.ActiveObject"
|
||||
|
|
|
|||
|
|
@ -5,12 +5,14 @@ package se.scalablesolutions.akka.spring;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import se.scalablesolutions.akka.actor.ActiveObject;
|
||||
import se.scalablesolutions.akka.config.ActiveObjectConfigurator;
|
||||
import se.scalablesolutions.akka.spring.foo.Foo;
|
||||
import se.scalablesolutions.akka.spring.foo.IBar;
|
||||
|
|
@ -49,7 +51,6 @@ public class SupervisorConfigurationTest {
|
|||
public void testTransactionalState() {
|
||||
ActiveObjectConfigurator conf = (ActiveObjectConfigurator) context.getBean("supervision2");
|
||||
StatefulPojo stateful = conf.getInstance(StatefulPojo.class);
|
||||
stateful.init();
|
||||
stateful.setMapState("testTransactionalState", "some map state");
|
||||
stateful.setVectorState("some vector state");
|
||||
stateful.setRefState("some ref state");
|
||||
|
|
@ -57,6 +58,12 @@ public class SupervisorConfigurationTest {
|
|||
assertEquals("some vector state", stateful.getVectorState());
|
||||
assertEquals("some ref state", stateful.getRefState());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitTransactionalState() {
|
||||
StatefulPojo stateful = ActiveObject.newInstance(StatefulPojo.class, 1000, true);
|
||||
assertTrue("should be inititalized", stateful.isInitialized());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSupervisionWithDispatcher() {
|
||||
|
|
|
|||
|
|
@ -43,20 +43,18 @@ class SupervisionFactoryBean extends AbstractFactoryBean[ActiveObjectConfigurato
|
|||
val lifeCycle = if (!props.lifecyclye.isEmpty && props.lifecyclye.equalsIgnoreCase(VAL_LIFECYCYLE_TEMPORARY)) new LifeCycle(new Temporary()) else new LifeCycle(new Permanent())
|
||||
val isRemote = (props.host != null) && (!props.host.isEmpty)
|
||||
val withInterface = (props.interface != null) && (!props.interface.isEmpty)
|
||||
// FIXME: timeout int vs long
|
||||
val timeout = props.timeout.asInstanceOf[Int]
|
||||
if (isRemote) {
|
||||
val remote = new RemoteAddress(props.host, props.port)
|
||||
if (withInterface) {
|
||||
new Component(props.interface.toClass, props.target.toClass, lifeCycle, timeout, props.transactional, remote)
|
||||
new Component(props.interface.toClass, props.target.toClass, lifeCycle, props.timeout, props.transactional, remote)
|
||||
} else {
|
||||
new Component(props.target.toClass, lifeCycle, timeout, props.transactional, remote)
|
||||
new Component(props.target.toClass, lifeCycle, props.timeout, props.transactional, remote)
|
||||
}
|
||||
} else {
|
||||
if (withInterface) {
|
||||
new Component(props.interface.toClass, props.target.toClass, lifeCycle, timeout, props.transactional)
|
||||
new Component(props.interface.toClass, props.target.toClass, lifeCycle, props.timeout, props.transactional)
|
||||
} else {
|
||||
new Component(props.target.toClass, lifeCycle, timeout, props.transactional)
|
||||
new Component(props.target.toClass, lifeCycle, props.timeout, props.transactional)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue