Make it possible to use STM @TransactionalObject directly
Peter Veentjer (1 May):
Once the instrumentation works on Akka, you can say something like
(this is the same way the transaction collections in multiverse are
written):
You don't need to be worried anymore about the 'ref' awkwardness.
Multiverse uses an object granularity by default because it is likely
to perform better since less needs to be managed (although you will
have more unnecessary writeconflicts). If you need explicit field
granularity you can say something like
This will prevent unwanted conflicts on the head and tail so that
takes and puts can happen concurrently.
And with the static instrumentation, you don't need to rely on a
javaagent in production for this to work. And with the instrumentation
I can make access managed fields many times cheaper (in some cases
they can be at the speed of the original access).
Once the instrumentation works on Akka, you can say something like
(this is the same way the transaction collections in multiverse are
written):
@TransactionalObject
class Stack{
private Node head;
public void push(Object item){
head = new Node(head, item);
}
public Object pop(){
if(head == null) retry()
Node old = head;
head = old.next;
return old.value;
}
class Node{
final Node next;
fina Object value'
}
}
You don't need to be worried anymore about the 'ref' awkwardness.
Multiverse uses an object granularity by default because it is likely
to perform better since less needs to be managed (although you will
have more unnecessary writeconflicts). If you need explicit field
granularity you can say something like
@TransactionalObject
class Queue{
@FieldGranularity
Node head;
@FieldGranularity
Node tail;
...
}
This will prevent unwanted conflicts on the head and tail so that
takes and puts can happen concurrently.
And with the static instrumentation, you don't need to rely on a
javaagent in production for this to work. And with the instrumentation
I can make access managed fields many times cheaper (in some cases
they can be at the speed of the original access).
Leave a comment
on 2010-10-05 07:28 *
By Peter Vlugter
Milestone changed from 1.0-MILESTONE2 to Backlog
Status changed from New to Invalid
I'm going to close this one for now as Multiverse 0.7 will be skipping this.