Skip to content

Commit

Permalink
More Txn renaming cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pveentjer committed Apr 6, 2012
1 parent 672a21d commit ec5d187
Show file tree
Hide file tree
Showing 126 changed files with 783 additions and 755 deletions.
26 changes: 13 additions & 13 deletions multiverse-core/generate.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TxnExecutor {
boolean lean
}

class TransactionalObject {
class TxnObject {
String type//the type of data it contains
String objectType//the type of data it contains
String initialValue//the initial value
Expand All @@ -32,7 +32,7 @@ class TransactionalObject {
VelocityEngine engine = new VelocityEngine();
engine.init();

def refs = createTransactionalObjects();
def refs = createTxnObjects();
def txnClosures = createClosures();TxnClosure
def txnExecutors = [new TxnExecutor(name: 'FatGammaTxnExecutor', lean: false),
new TxnExecutor(name: 'LeanGammaTxnExecutor', lean: true)]
Expand Down Expand Up @@ -94,9 +94,9 @@ List<TxnClosure> createClosures() {
result
}

List<TransactionalObject> createTransactionalObjects() {
List<TxnObject> createTxnObjects() {
def result = []
result.add new TransactionalObject(
result.add new TxnObject(
type: 'E',
objectType: '',
typeParameter: '<E>',
Expand All @@ -107,7 +107,7 @@ List<TransactionalObject> createTransactionalObjects() {
isNumber: false,
predicateClass: "Predicate",
incFunctionMethod: '')
result.add new TransactionalObject(
result.add new TxnObject(
type: 'int',
objectType: 'Integer',
referenceInterface: 'TxnInteger',
Expand All @@ -118,7 +118,7 @@ List<TransactionalObject> createTransactionalObjects() {
isNumber: true,
predicateClass: "IntPredicate",
incFunctionMethod: 'newIncIntFunction')
result.add new TransactionalObject(
result.add new TxnObject(
type: 'boolean',
objectType: 'Boolean',
referenceInterface: 'TxnBoolean',
Expand All @@ -129,7 +129,7 @@ List<TransactionalObject> createTransactionalObjects() {
isNumber: false,
predicateClass: "BooleanPredicate",
incFunctionMethod: '')
result.add new TransactionalObject(
result.add new TxnObject(
type: 'double',
objectType: 'Double',
referenceInterface: 'TxnDouble',
Expand All @@ -140,7 +140,7 @@ List<TransactionalObject> createTransactionalObjects() {
isNumber: true,
predicateClass: "DoublePredicate",
incFunctionMethod: '')
result.add new TransactionalObject(
result.add new TxnObject(
referenceInterface: 'TxnLong',
type: 'long',
objectType: 'Long',
Expand All @@ -151,7 +151,7 @@ List<TransactionalObject> createTransactionalObjects() {
isNumber: true,
predicateClass: "LongPredicate",
incFunctionMethod: 'newIncLongFunction')
result.add new TransactionalObject(
result.add new TxnObject(
type: '',
objectType: '',
typeParameter: '',
Expand Down Expand Up @@ -250,7 +250,7 @@ void generateStmUtils(VelocityEngine engine, List<TxnClosure> closures) {
file.text = writer.toString()
}

void generatePredicate(VelocityEngine engine, TransactionalObject transactionalObject) {
void generatePredicate(VelocityEngine engine, TxnObject transactionalObject) {
if (!transactionalObject.isReference) {
return
}
Expand All @@ -268,7 +268,7 @@ void generatePredicate(VelocityEngine engine, TransactionalObject transactionalO
file.text = writer.toString()
}

void generateFunction(VelocityEngine engine, TransactionalObject transactionalObject) {
void generateFunction(VelocityEngine engine, TxnObject transactionalObject) {
if (!transactionalObject.isReference) {
return
}
Expand All @@ -286,7 +286,7 @@ void generateFunction(VelocityEngine engine, TransactionalObject transactionalOb
file.text = writer.toString()
}

void generateRefs(VelocityEngine engine, TransactionalObject transactionalObject) {
void generateRefs(VelocityEngine engine, TxnObject transactionalObject) {
if (!transactionalObject.isReference) {
return;
}
Expand All @@ -304,7 +304,7 @@ void generateRefs(VelocityEngine engine, TransactionalObject transactionalObject
file.text = writer.toString()
}

void generateRefFactory(VelocityEngine engine, List<TransactionalObject> refs) {
void generateRefFactory(VelocityEngine engine, List<TxnObject> refs) {
Template t = engine.getTemplate('src/main/java/org/multiverse/api/references/TxnRefFactory.vm');

VelocityContext context = new VelocityContext()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import static java.util.concurrent.locks.LockSupport.parkNanos;

/**
* A {@link DefaultBackoffPolicy} that does an 'exponential' backoff. So each next attempt, the calculated delay is increased
* A {@link BackoffPolicy} that does an 'exponential' backoff. So each next attempt, the calculated delay is increased
* and randomized (so the next value can be smaller than the previous, but overall they will increase).
*
* @author Peter Veentjer.
Expand Down
6 changes: 3 additions & 3 deletions multiverse-core/src/main/java/org/multiverse/api/Lock.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.multiverse.api;

/**
* The Lock provides access to pessimistic behavior of a {@link TransactionalObject}. STM normally is very optimistic, but
* The Lock provides access to pessimistic behavior of a {@link TxnObject}. STM normally is very optimistic, but
* in some cases a more pessimistic approach (one with less retries) could be a better fitting solution.
* <p/>
* There are 4 different types of lockmodes:
Expand Down Expand Up @@ -30,7 +30,7 @@
* released once the transaction commits/aborts. This is essentially the same behavior you get with Oracle once
* a update/delete/insert is done, or when the record is locked manually by executing the 'select for update'. For
* this to work it is very important that the {@link org.multiverse.api.exceptions.ControlFlowError} is not caught
* by the logic executed in an atomicChecked block, but is caught by the TxnExecutor itself.
* by the logic executed in an transactional closure, but is caught by the TxnExecutor itself.
*
* <h3>Blocking</h3>
*
Expand Down Expand Up @@ -68,7 +68,7 @@
* <p>Locking can be done on the Txn level (see the {@link TxnFactoryBuilder#setReadLockMode(LockMode)} and
* {@link TxnFactoryBuilder#setWriteLockMode(LockMode)} where all reads or all writes (to do a write also a read
* is needed) are locked automatically. It can also be done on the reference level using
* getAndLock/setAndLock/getAndSetAndLock methods or by accessing the {@link TransactionalObject#getLock()}.
* getAndLock/setAndLock/getAndSetAndLock methods or by accessing the {@link TxnObject#getLock()}.
*
* <h3>Lock escalation</h3>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @see TxnFactoryBuilder#setWriteLockMode(LockMode)
* @see TxnConfig#getReadLockMode()
* @see TxnConfig#getWriteLockMode()
* @see org.multiverse.api.TransactionalObject#getLock()
* @see TxnObject#getLock()
* @see Lock
*/
public enum LockMode implements MultiverseConstants {
Expand Down Expand Up @@ -43,7 +43,7 @@ public enum LockMode implements MultiverseConstants {
* no other transaction can acquire any lock or can do any reading/writing (unless the transaction previously has read the
* transactional object).
*
* <p>The ExclusiveLock is the Lock acquired by the STM once a Txn is prepared for writing changes to a TransactionalObject.
* <p>The ExclusiveLock is the Lock acquired by the STM once a Txn is prepared for writing changes to a TxnObject.
*/
Exclusive(LOCKMODE_EXCLUSIVE);

Expand Down
8 changes: 4 additions & 4 deletions multiverse-core/src/main/java/org/multiverse/api/Stm.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/**
* The main interface for software transactional memory. The main tasks are done by the following structures:
* <ol>
* <li>{@link TransactionalObject}: the structure where state and identity are separated and where state change
* is coordinated through a transaction. An example of the TransactionalObject is the {@link org.multiverse.api.references.TxnRef},
* <li>{@link TxnObject}: the structure where state and identity are separated and where state change
* is coordinated through a transaction. An example of the TxnObject is the {@link org.multiverse.api.references.TxnRef},
* but it could just as easily by a more complex transactional datastructure that is enhanced by instrumentation.
* </li>
* <li>{@link Txn}: responsible for making sure that all changes on transactionalobjects are atomicChecked, isolated and consistent.
Expand Down Expand Up @@ -36,7 +36,7 @@
*
* <h3>Multiple Stm instances</h3>
*
* <p>It is important that an TransactionalObject only is used within a single Stm. If it is 'shared' between different
* <p>It is important that an TxnObject only is used within a single Stm. If it is 'shared' between different
* stm instances, isolation problems could happen. This can be caused by the fact that different stm instances
* probably use different clocks or completely different mechanisms for preventing isolation problems. It depends on the
* implementation if any checking is done (the GammaStm does check if there is a conflict).
Expand Down Expand Up @@ -69,7 +69,7 @@ public interface Stm {
Txn newDefaultTxn();

/**
* Returns the default {@link TxnExecutor} block that is useful for testing/experimentation purposes.
* Returns the default {@link TxnExecutor} that is useful for testing/experimentation purposes.
* This method is purely for easy to use access, but it doesn't provide any configuration options.
* See the {@link #newTxnFactoryBuilder()} for something more configurable.
*
Expand Down
18 changes: 9 additions & 9 deletions multiverse-core/src/main/java/org/multiverse/api/StmUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class StmUtils {
*
* @return the created TxnList.
*/
public static <E> TxnList<E> newLinkedList(){
public static <E> TxnList<E> newTxnLinkedList(){
return txnCollectionsFactory.newLinkedList();
}

Expand All @@ -42,7 +42,7 @@ public static <E> TxnList<E> newLinkedList(){
*
* @return the created TxnStack.
*/
public static <E> TxnStack<E> newStack(){
public static <E> TxnStack<E> newTxnStack(){
return txnCollectionsFactory.newStack();
}

Expand All @@ -53,7 +53,7 @@ public static <E> TxnStack<E> newStack(){
* @return the create TxnStack
* @throws IllegalArgumentException if capacity smaller than 0.
*/
public static <E> TxnStack<E> newStack(int capacity){
public static <E> TxnStack<E> newTxnStack(int capacity){
return txnCollectionsFactory.newStack(capacity);
}

Expand All @@ -62,7 +62,7 @@ public static <E> TxnStack<E> newStack(int capacity){
*
* @return the created TxnQueue.
*/
public static <E> TxnQueue<E> newQueue(){
public static <E> TxnQueue<E> newTxnQueue(){
return txnCollectionsFactory.newQueue();
}

Expand All @@ -73,7 +73,7 @@ public static <E> TxnQueue<E> newQueue(){
* @return the created TxnQueue
* @throws IllegalArgumentException if capacity smaller than 0.
*/
public static <E> TxnQueue<E> newQueue(int capacity){
public static <E> TxnQueue<E> newTxnQueue(int capacity){
return txnCollectionsFactory.newQueue(capacity);
}

Expand All @@ -82,7 +82,7 @@ public static <E> TxnQueue<E> newQueue(int capacity){
*
* @return the created TxnDeque
*/
public static <E> TxnDeque<E> newDeque(){
public static <E> TxnDeque<E> newTxnDeque(){
return txnCollectionsFactory.newDeque();
}

Expand All @@ -93,7 +93,7 @@ public static <E> TxnDeque<E> newDeque(){
* @return the created TxnDeque.
* @throws IllegalArgumentException if capacity is smaller than 0.
*/
public static <E> TxnDeque<E> newDeque(int capacity){
public static <E> TxnDeque<E> newTxnDeque(int capacity){
return txnCollectionsFactory.newDeque(capacity);
}

Expand All @@ -102,7 +102,7 @@ public static <E> TxnDeque<E> newDeque(int capacity){
*
* @return the created TxnSet.
*/
public static <E> TxnSet<E> newHashSet(){
public static <E> TxnSet<E> newTxnHashSet(){
return txnCollectionsFactory.newHashSet();
}

Expand All @@ -111,7 +111,7 @@ public static <E> TxnSet<E> newHashSet(){
*
* @return the created TxnMap
*/
public static <K, V> TxnMap<K, V> newHashMap(){
public static <K, V> TxnMap<K, V> newTxnHashMap(){
return txnCollectionsFactory.newHashMap();
}

Expand Down
18 changes: 9 additions & 9 deletions multiverse-core/src/main/java/org/multiverse/api/StmUtils.vm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class StmUtils {
*
* @return the created TxnList.
*/
public static <E> TxnList<E> newLinkedList(){
public static <E> TxnList<E> newTxnLinkedList(){
return txnCollectionsFactory.newLinkedList();
}

Expand All @@ -42,7 +42,7 @@ public final class StmUtils {
*
* @return the created TxnStack.
*/
public static <E> TxnStack<E> newStack(){
public static <E> TxnStack<E> newTxnStack(){
return txnCollectionsFactory.newStack();
}

Expand All @@ -53,7 +53,7 @@ public final class StmUtils {
* @return the create TxnStack
* @throws IllegalArgumentException if capacity smaller than 0.
*/
public static <E> TxnStack<E> newStack(int capacity){
public static <E> TxnStack<E> newTxnStack(int capacity){
return txnCollectionsFactory.newStack(capacity);
}

Expand All @@ -62,7 +62,7 @@ public final class StmUtils {
*
* @return the created TxnQueue.
*/
public static <E> TxnQueue<E> newQueue(){
public static <E> TxnQueue<E> newTxnQueue(){
return txnCollectionsFactory.newQueue();
}

Expand All @@ -73,7 +73,7 @@ public final class StmUtils {
* @return the created TxnQueue
* @throws IllegalArgumentException if capacity smaller than 0.
*/
public static <E> TxnQueue<E> newQueue(int capacity){
public static <E> TxnQueue<E> newTxnQueue(int capacity){
return txnCollectionsFactory.newQueue(capacity);
}

Expand All @@ -82,7 +82,7 @@ public final class StmUtils {
*
* @return the created TxnDeque
*/
public static <E> TxnDeque<E> newDeque(){
public static <E> TxnDeque<E> newTxnDeque(){
return txnCollectionsFactory.newDeque();
}

Expand All @@ -93,7 +93,7 @@ public final class StmUtils {
* @return the created TxnDeque.
* @throws IllegalArgumentException if capacity is smaller than 0.
*/
public static <E> TxnDeque<E> newDeque(int capacity){
public static <E> TxnDeque<E> newTxnDeque(int capacity){
return txnCollectionsFactory.newDeque(capacity);
}

Expand All @@ -102,7 +102,7 @@ public final class StmUtils {
*
* @return the created TxnSet.
*/
public static <E> TxnSet<E> newHashSet(){
public static <E> TxnSet<E> newTxnHashSet(){
return txnCollectionsFactory.newHashSet();
}

Expand All @@ -111,7 +111,7 @@ public final class StmUtils {
*
* @return the created TxnMap
*/
public static <K, V> TxnMap<K, V> newHashMap(){
public static <K, V> TxnMap<K, V> newTxnHashMap(){
return txnCollectionsFactory.newHashMap();
}

Expand Down
4 changes: 2 additions & 2 deletions multiverse-core/src/main/java/org/multiverse/api/Txn.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.multiverse.api.lifecycle.TxnListener;

/**
* The unit of work for {@link Stm}. The transaction make sure that changes on {@link TransactionalObject} instances are:
* The unit of work for {@link Stm}. The transaction make sure that changes on {@link TxnObject} instances are:
* <ol>
* <li>Atomic: all or nothing gets committed (Failure atomicity)</li>
* <li>Consistent : </li>
Expand All @@ -27,7 +27,7 @@
* <li>normal listeners: are registered during the execution of a transaction using the
* {@link Txn#register(org.multiverse.api.lifecycle.TxnListener)} method. If the transactions aborts/commits
* these listeners are removed. So if the transaction is retried, the listeners need to be registered (this is easy since
* the logic inside the atomicChecked block that did the register, is executed again.
* the logic inside the transactional closure that did the register, is executed again.
* </li>
* <li>permanent listeners: are registered once and will always remain. It can be done on the
* TxnExecutor level using the {@link TxnFactoryBuilder#addPermanentListener(org.multiverse.api.lifecycle.TxnListener)}
Expand Down
Loading

0 comments on commit ec5d187

Please sign in to comment.