deleted old project files
This commit is contained in:
parent
6702a5f307
commit
e4a4451533
2 changed files with 0 additions and 269 deletions
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module relativePaths="true" MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Protobuf" level="application" />
|
||||
<orderEntry type="library" exported="" name="Maven: org.guiceyfruit:guice-core:2.0-SNAPSHOT" level="project" />
|
||||
<orderEntry type="library" exported="" name="Maven: com.google.protobuf:protobuf-java:2.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="Maven: org.multiverse:multiverse:0.3" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
|
@ -1,251 +0,0 @@
|
|||
package se.scalablesolutions.akka.kernel.stm;
|
||||
|
||||
import static org.multiverse.api.StmUtils.retry;
|
||||
import org.multiverse.api.Transaction;
|
||||
import org.multiverse.api.exceptions.LoadUncommittedAtomicObjectException;
|
||||
import org.multiverse.api.exceptions.ReadonlyException;
|
||||
import org.multiverse.datastructures.refs.ManagedRef;
|
||||
import org.multiverse.stms.alpha.*;
|
||||
import org.multiverse.stms.alpha.mixins.FastAtomicObjectMixin;
|
||||
import org.multiverse.templates.AtomicTemplate;
|
||||
import org.multiverse.datastructures.refs.manual.*;
|
||||
|
||||
/**
|
||||
* A manual instrumented {@link org.multiverse.datastructures.refs.ManagedRef} implementation.
|
||||
* If this class is used, you don't need to worry about instrumentation/javaagents and
|
||||
* stuff like this.
|
||||
*
|
||||
* It is added to get the Akka project up and running, but probably will removed when the instrumentation
|
||||
* is 100% up and running and this can be done compiletime instead of messing with javaagents.
|
||||
*
|
||||
* @author Peter Veentjer
|
||||
*/
|
||||
public final class Ref<E> extends FastAtomicObjectMixin implements ManagedRef<E> {
|
||||
|
||||
public Ref() {
|
||||
new AtomicTemplate() {
|
||||
@Override
|
||||
public Object execute(Transaction t) throws Exception {
|
||||
|
||||
((Transaction) t).attachNew(new RefTranlocal(Ref.this));
|
||||
return null;
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public Ref(Transaction t) {
|
||||
((Transaction) t).attachNew(new RefTranlocal(Ref.this));
|
||||
}
|
||||
|
||||
public Ref(final E value) {
|
||||
new AtomicTemplate() {
|
||||
@Override
|
||||
public Object execute(Transaction t) throws Exception {
|
||||
((Transaction) t).attachNew(new RefTranlocal(Ref.this, value));
|
||||
return null;
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public Ref(Transaction t, final E value) {
|
||||
((Transaction) t).attachNew(new RefTranlocal(Ref.this, value));
|
||||
}
|
||||
|
||||
public E get() {
|
||||
return new AtomicTemplate<E>() {
|
||||
@Override
|
||||
public E execute(Transaction t) throws Exception {
|
||||
RefTranlocal<E> tranlocalRef = (RefTranlocal) ((Transaction) t).privatize(Ref.this);
|
||||
return tranlocalRef.get();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public E get(Transaction t) {
|
||||
RefTranlocal<E> tranlocalRef = (RefTranlocal) ((Transaction) t).privatize(Ref.this);
|
||||
return tranlocalRef.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E getOrAwait() {
|
||||
return new AtomicTemplate<E>() {
|
||||
@Override
|
||||
public E execute(Transaction t) throws Exception {
|
||||
RefTranlocal<E> tranlocalRef = (RefTranlocal) ((Transaction) t).privatize(Ref.this);
|
||||
return tranlocalRef.getOrAwait();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public E getOrAwait(Transaction t) {
|
||||
RefTranlocal<E> tranlocalRef = (RefTranlocal) ((Transaction) t).privatize(Ref.this);
|
||||
return tranlocalRef.getOrAwait();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public E set(final E newRef) {
|
||||
System.out.println("------------- REF SET 1: " + newRef);
|
||||
return new AtomicTemplate<E>() {
|
||||
@Override
|
||||
public E execute(Transaction t) throws Exception {
|
||||
System.out.println("------------- REF SET 2: " + newRef);
|
||||
System.out.println("------------- TX: " + t);
|
||||
RefTranlocal<E> tranlocalRef = (RefTranlocal) ((Transaction) t).privatize(Ref.this);
|
||||
return tranlocalRef.set(newRef);
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public E set(Transaction t, final E newRef) {
|
||||
RefTranlocal<E> tranlocalRef = (RefTranlocal) ((Transaction) t).privatize(Ref.this);
|
||||
return tranlocalRef.set(newRef);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull() {
|
||||
return new AtomicTemplate<Boolean>() {
|
||||
@Override
|
||||
public Boolean execute(Transaction t) throws Exception {
|
||||
RefTranlocal<E> tranlocalRef = (RefTranlocal) ((Transaction) t).privatize(Ref.this);
|
||||
return tranlocalRef.isNull();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public boolean isNull(Transaction t) {
|
||||
RefTranlocal<E> tranlocalRef = (RefTranlocal) ((Transaction) t).privatize(Ref.this);
|
||||
return tranlocalRef.isNull();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E clear() {
|
||||
return new AtomicTemplate<E>() {
|
||||
@Override
|
||||
public E execute(Transaction t) throws Exception {
|
||||
RefTranlocal<E> tranlocalRef = (RefTranlocal) ((Transaction) t).privatize(Ref.this);
|
||||
return tranlocalRef.clear();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public E clear(Transaction t) {
|
||||
RefTranlocal<E> tranlocalRef = (RefTranlocal) ((Transaction) t).privatize(Ref.this);
|
||||
return tranlocalRef.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RefTranlocal<E> privatize(long readVersion) {
|
||||
RefTranlocal<E> origin = (RefTranlocal<E>) load(readVersion);
|
||||
if (origin == null) {
|
||||
throw new LoadUncommittedAtomicObjectException();
|
||||
}
|
||||
return new RefTranlocal<E>(origin);
|
||||
}
|
||||
}
|
||||
|
||||
class RefTranlocal<E> extends Tranlocal {
|
||||
//field belonging to the stm.
|
||||
Ref atomicObject;
|
||||
RefTranlocal origin;
|
||||
|
||||
E ref;
|
||||
|
||||
RefTranlocal(RefTranlocal<E> origin) {
|
||||
this.version = origin.version;
|
||||
this.atomicObject = origin.atomicObject;
|
||||
this.ref = origin.ref;
|
||||
this.origin = origin;
|
||||
}
|
||||
|
||||
RefTranlocal(Ref<E> owner) {
|
||||
this(owner, null);
|
||||
}
|
||||
|
||||
RefTranlocal(Ref<E> owner, E ref) {
|
||||
this.version = Long.MIN_VALUE;
|
||||
this.atomicObject = owner;
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlphaAtomicObject getAtomicObject() {
|
||||
return atomicObject;
|
||||
}
|
||||
|
||||
public E clear() {
|
||||
E oldValue = ref;
|
||||
ref = null;
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
public boolean isNull() {
|
||||
return ref == null;
|
||||
}
|
||||
|
||||
public E get() {
|
||||
return ref;
|
||||
}
|
||||
|
||||
public E set(E newValue) {
|
||||
if (committed) {
|
||||
throw new ReadonlyException();
|
||||
}
|
||||
E oldValue = ref;
|
||||
this.ref = newValue;
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
public E getOrAwait() {
|
||||
if (isNull()) {
|
||||
retry();
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareForCommit(long writeVersion) {
|
||||
this.version = writeVersion;
|
||||
this.committed = true;
|
||||
this.origin = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranlocalSnapshot takeSnapshot() {
|
||||
return new RefTranlocalSnapshot<E>(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DirtinessStatus getDirtinessStatus() {
|
||||
if (committed) {
|
||||
return DirtinessStatus.committed;
|
||||
} else if (origin == null) {
|
||||
return DirtinessStatus.fresh;
|
||||
} else if (origin.ref != this.ref) {
|
||||
return DirtinessStatus.dirty;
|
||||
} else {
|
||||
return DirtinessStatus.clean;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class RefTranlocalSnapshot<E> extends TranlocalSnapshot {
|
||||
final RefTranlocal tranlocal;
|
||||
final E value;
|
||||
|
||||
RefTranlocalSnapshot(RefTranlocal<E> tranlocal) {
|
||||
this.tranlocal = tranlocal;
|
||||
this.value = tranlocal.ref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tranlocal getTranlocal() {
|
||||
return tranlocal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore() {
|
||||
tranlocal.ref = value;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue