completed remote active objects (1:st iteration) - left todo are: TX semantics, supervision and remote references + tests
This commit is contained in:
parent
8ff45daddc
commit
47abc143a4
22 changed files with 1228 additions and 314 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package se.scalablesolutions.akka.api;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class InMemFailer {
|
||||
public void fail() {
|
||||
throw new RuntimeException("expected");
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@ import se.scalablesolutions.akka.annotation.transactional;
|
|||
import se.scalablesolutions.akka.kernel.state.*;
|
||||
|
||||
public class InMemStateful {
|
||||
@state private TransactionalMap<String, String> mapState = new InMemoryTransactionalMap<String, String>();
|
||||
@state private TransactionalVector<String> vectorState = new InMemoryTransactionalVector<String>();
|
||||
@state private TransactionalRef<String> refState = new TransactionalRef<String>();
|
||||
private TransactionalState factory = new TransactionalState();
|
||||
private TransactionalMap mapState = factory.newMap(new InMemoryMapConfig());
|
||||
private TransactionalVector vectorState = factory.newVector(new InMemoryVectorConfig());;
|
||||
private TransactionalRef refState = factory.newRef(new InMemoryRefConfig());
|
||||
|
||||
@transactional
|
||||
public String getMapState(String key) {
|
||||
|
|
@ -47,11 +48,12 @@ public class InMemStateful {
|
|||
}
|
||||
|
||||
@transactional
|
||||
public void failure(String key, String msg, InMemFailer failer) {
|
||||
public String failure(String key, String msg, InMemFailer failer) {
|
||||
mapState.put(key, msg);
|
||||
vectorState.add(msg);
|
||||
refState.swap(msg);
|
||||
failer.fail();
|
||||
return msg;
|
||||
}
|
||||
|
||||
@transactional
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class InMemoryStateTest extends TestCase {
|
|||
//new Component("inmem-clasher", InMemClasher.class, InMemClasherImpl.class, new LifeCycle(new Permanent(), 1000), 100000)
|
||||
}).inject().supervise();
|
||||
}
|
||||
|
||||
|
||||
protected void tearDown() {
|
||||
conf.stop();
|
||||
}
|
||||
|
|
@ -87,7 +87,6 @@ public class InMemoryStateTest extends TestCase {
|
|||
} // expected
|
||||
assertEquals("init", stateful.getRefState()); // check that state is == init state
|
||||
}
|
||||
|
||||
/*
|
||||
public void testNestedNonTransactionalMethodHangs() {
|
||||
InMemStateful stateful = conf.getActiveObject(InMemStateful.class);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package se.scalablesolutions.akka.api;
|
||||
|
||||
public class NettyClient {
|
||||
public static void main(String[] args) {
|
||||
new se.scalablesolutions.akka.kernel.nio.NettyClient();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package se.scalablesolutions.akka.api;
|
||||
|
||||
public class NettyServer {
|
||||
public static void main(String[] args) {
|
||||
new se.scalablesolutions.akka.kernel.nio.NettyServer();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* Copyright (C) 2009 Scalable Solutions.
|
||||
*/
|
||||
|
||||
package se.scalablesolutions.akka.api;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import junit.framework.TestSuite;
|
||||
import se.scalablesolutions.akka.kernel.nio.ProxyServer;
|
||||
|
||||
public class NioTest extends TestSuite {
|
||||
|
||||
@BeforeClass
|
||||
public static void initialize() {
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void cleanup() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleRequestReply() {
|
||||
ProxyServer server = new ProxyServer();
|
||||
server.start();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue