fixed bug with init of tx datastructs + changed actor id management

This commit is contained in:
Jonas Bonér 2010-02-26 17:42:44 +01:00
parent 924661368b
commit b4a46016eb
11 changed files with 33 additions and 20 deletions

View file

@ -29,11 +29,12 @@ public class PersistentSimpleService {
private String KEY = "COUNTER";
private boolean hasStartedTicking = false;
private PersistentMap<byte[], byte[]> storage = CassandraStorage.newMap();
private PersistentMap<byte[], byte[]> storage;
@GET
@Produces({"application/html"})
public String count() {
if (storage == null) storage = CassandraStorage.newMap();
if (!hasStartedTicking) {
storage.put(KEY.getBytes(), ByteBuffer.allocate(2).putInt(0).array());
hasStartedTicking = true;

View file

@ -27,11 +27,12 @@ public class SimpleService {
private String KEY = "COUNTER";
private boolean hasStartedTicking = false;
private TransactionalMap storage = TransactionalState.newMap();
private TransactionalMap<String, Integer> storage;
@GET
@Produces({"application/json"})
public String count() {
if (storage == null) storage = TransactionalState.newMap();
if (!hasStartedTicking) {
storage.put(KEY, 0);
hasStartedTicking = true;