diff --git a/akka-core/src/main/scala/actor/ActorRef.scala b/akka-core/src/main/scala/actor/ActorRef.scala index a4a1d63490..42df4e1305 100644 --- a/akka-core/src/main/scala/actor/ActorRef.scala +++ b/akka-core/src/main/scala/actor/ActorRef.scala @@ -503,10 +503,6 @@ trait ActorRef extends TransactionManagement { /** * Invoking 'makeTransactionRequired' means that the actor will **start** a new transaction if non exists. * However, it will always participate in an existing transaction. - * If transactionality want to be completely turned off then do it by invoking: - *
-   *  TransactionManagement.disableTransactions
-   * 
*/ def makeTransactionRequired: Unit @@ -879,10 +875,6 @@ sealed class LocalActorRef private[akka]( /** * Invoking 'makeTransactionRequired' means that the actor will **start** a new transaction if non exists. * However, it will always participate in an existing transaction. - * If transactionality want to be completely turned off then do it by invoking: - *
-   *  TransactionManagement.disableTransactions
-   * 
*/ def makeTransactionRequired = guard.withGuard { if (!isRunning || isBeingRestarted) isTransactor = true diff --git a/akka-core/src/main/scala/stm/TransactionFactory.scala b/akka-core/src/main/scala/stm/TransactionFactory.scala index 26c255e6cf..a7a81c4212 100644 --- a/akka-core/src/main/scala/stm/TransactionFactory.scala +++ b/akka-core/src/main/scala/stm/TransactionFactory.scala @@ -15,7 +15,7 @@ import org.multiverse.templates.TransactionBoilerplate import org.multiverse.api.TraceLevel /** - * For configuring multiverse transactions. See TransactionConfig class for options. + * For configuring multiverse transactions. */ object TransactionConfig { // note: null values are so that we can default to Multiverse inference when not set @@ -41,6 +41,22 @@ object TransactionConfig { case _ => Transaction.TraceLevel.None } + /** + * For configuring multiverse transactions. + * + * @param familyName Family name for transactions. Useful for debugging. + * @param readonly Sets transaction as readonly. Readonly transactions are cheaper. + * @param maxRetries The maximum number of times a transaction will retry. + * @param timeout The maximum time a transaction will block for. + * @param trackReads Whether all reads should be tracked. Needed for blocking operations. + * @param writeSkew Whether writeskew is allowed. Disable with care. + * @param explicitRetries Whether explicit retries are allowed. + * @param interruptible Whether a blocking transaction can be interrupted. + * @param speculative Whether speculative configuration should be enabled. + * @param quickRelease Whether locks should be released as quickly as possible (before whole commit). + * @param traceLevel Transaction trace level. + * @param hooks Whether hooks for persistence modules and JTA should be added to the transaction. + */ def apply(familyName: String = FAMILY_NAME, readonly: JBoolean = READONLY, maxRetries: Int = MAX_RETRIES, @@ -60,19 +76,19 @@ object TransactionConfig { /** * For configuring multiverse transactions. - * - * @param familyName Family name for transactions. Useful for debugging. - * @param readonly Sets transaction as readonly. Readonly transactions are cheaper. - * @param maxRetries The maximum number of times a transaction will retry. - * @param timeout The maximum time a transaction will block for. - * @param trackReads Whether all reads should be tracked. Needed for blocking operations. - * @param writeSkew Whether writeskew is allowed. Disable with care. - * @param explicitRetries Whether explicit retries are allowed. - * @param interruptible Whether a blocking transaction can be interrupted. - * @param speculative Whether speculative configuration should be enabled. - * @param quickRelease Whether locks should be released as quickly as possible (before whole commit). - * @param traceLevel Transaction trace level. - * @param hooks Whether hooks for persistence modules and JTA should be added to the transaction. + * + *

familyName - Family name for transactions. Useful for debugging. + *

readonly - Sets transaction as readonly. Readonly transactions are cheaper. + *

maxRetries - The maximum number of times a transaction will retry. + *

timeout - The maximum time a transaction will block for. + *

trackReads - Whether all reads should be tracked. Needed for blocking operations. + *

writeSkew - Whether writeskew is allowed. Disable with care. + *

explicitRetries - Whether explicit retries are allowed. + *

interruptible - Whether a blocking transaction can be interrupted. + *

speculative - Whether speculative configuration should be enabled. + *

quickRelease - Whether locks should be released as quickly as possible (before whole commit). + *

traceLevel - Transaction trace level. + *

hooks - Whether hooks for persistence modules and JTA should be added to the transaction. */ class TransactionConfig(val familyName: String = TransactionConfig.FAMILY_NAME, val readonly: JBoolean = TransactionConfig.READONLY, @@ -91,24 +107,6 @@ object DefaultTransactionConfig extends TransactionConfig /** * Wrapper for transaction config, factory, and boilerplate. Used by atomic. - * Can be passed to atomic implicitly or explicitly. - *

- *

- * implicit val txFactory = TransactionFactory(readonly = true)
- * ...
- * atomic {
- *   // do something within a readonly transaction
- * }
- * 
- *

- * Can be created at different levels as needed. For example: as an implicit object - * used throughout a package, as a static implicit val within a singleton object and - * imported where needed, or as an implicit val within each instance of a class. - *

- * See TransactionConfig for configuration options. - *

- * If no explicit transactin factory is passed to atomic and there is no implicit - * transaction factory in scope, then a default transaction factory is used. */ object TransactionFactory { def apply(config: TransactionConfig) = new TransactionFactory(config) @@ -135,6 +133,24 @@ object TransactionFactory { /** * Wrapper for transaction config, factory, and boilerplate. Used by atomic. + * Can be passed to atomic implicitly or explicitly. + *

+ *

+ * implicit val txFactory = TransactionFactory(readonly = true)
+ * ...
+ * atomic {
+ *   // do something within a readonly transaction
+ * }
+ * 
+ *

+ * Can be created at different levels as needed. For example: as an implicit object + * used throughout a package, as a static implicit val within a singleton object and + * imported where needed, or as an implicit val within each instance of a class. + *

+ * If no explicit transaction factory is passed to atomic and there is no implicit + * transaction factory in scope, then a default transaction factory is used. + * + * @see TransactionConfig for configuration options. */ class TransactionFactory(val config: TransactionConfig = DefaultTransactionConfig, defaultName: String = TransactionConfig.FAMILY_NAME) { self => diff --git a/akka-core/src/main/scala/stm/TransactionManagement.scala b/akka-core/src/main/scala/stm/TransactionManagement.scala index 44cb76a6d3..5bc69c037d 100644 --- a/akka-core/src/main/scala/stm/TransactionManagement.scala +++ b/akka-core/src/main/scala/stm/TransactionManagement.scala @@ -119,7 +119,7 @@ class LocalStm extends TransactionManagement with Logging { /** * Global transaction management, global in the context of multiple threads. - * You this if you need to have one transaction span multiple threads (or Actors). + * Use this if you need to have one transaction span multiple threads (or Actors). *

* Example of atomic transaction management using the atomic block: *

@@ -169,8 +169,8 @@ trait StmUtil { def compensating[T](body: => T): Unit = MultiverseStmUtils.scheduleCompensatingTask(new Runnable { def run = body }) /** - * STM retry. Use within an atomic. - * Blocks the current transaction. Can be used to wait for a condition. + * STM retry for blocking transactions (use within an atomic). + * Can be used to wait for a condition. */ def retry = MultiverseStmUtils.retry diff --git a/akka-core/src/main/scala/stm/TransactionalMap.scala b/akka-core/src/main/scala/stm/TransactionalMap.scala index e5b2ebaba5..be7b9c5189 100644 --- a/akka-core/src/main/scala/stm/TransactionalMap.scala +++ b/akka-core/src/main/scala/stm/TransactionalMap.scala @@ -17,7 +17,7 @@ object TransactionalMap { } /** - * TODO: documentation + * Transactional map that implements the mutable map interface with an underlying ref and hash map. * * @author Jonas Bonér */ diff --git a/akka-core/src/main/scala/stm/TransactionalVector.scala b/akka-core/src/main/scala/stm/TransactionalVector.scala index e53bc0f362..e2ad6a2aeb 100644 --- a/akka-core/src/main/scala/stm/TransactionalVector.scala +++ b/akka-core/src/main/scala/stm/TransactionalVector.scala @@ -17,7 +17,7 @@ object TransactionalVector { } /** - * TODO: documentation + * Transactional vector that implements the indexed seq interface with an underlying ref and vector. * * @author Jonas Bonér */ diff --git a/akka-core/src/main/scala/util/Duration.scala b/akka-core/src/main/scala/util/Duration.scala index c2e08f68b4..f49e1ae04b 100644 --- a/akka-core/src/main/scala/util/Duration.scala +++ b/akka-core/src/main/scala/util/Duration.scala @@ -6,27 +6,6 @@ package se.scalablesolutions.akka.util import java.util.concurrent.TimeUnit -/** - * Utility for working with java.util.concurrent.TimeUnit durations. - *

- * Example: - *

- * import se.scalablesolutions.akka.util.Duration
- * import java.util.concurrent.TimeUnit
- * 
- * val duration = Duration(100, TimeUnit.MILLISECONDS)
- * val duration = Duration(100, "millis")
- * 
- * duration.toNanos
- * 
- *

- * Implicits are also provided for Int and Long. Example usage: - *

- * import se.scalablesolutions.akka.util.duration._
- *
- * val duration = 100.millis
- * 
- */ object Duration { def apply(length: Long, unit: TimeUnit) = new Duration(length, unit) def apply(length: Long, unit: String) = new Duration(length, timeUnit(unit)) @@ -39,6 +18,27 @@ object Duration { } } +/** + * Utility for working with java.util.concurrent.TimeUnit durations. + *

+ * Example: + *

+ * import se.scalablesolutions.akka.util.Duration
+ * import java.util.concurrent.TimeUnit
+ *
+ * val duration = Duration(100, TimeUnit.MILLISECONDS)
+ * val duration = Duration(100, "millis")
+ *
+ * duration.toNanos
+ * 
+ *

+ * Implicits are also provided for Int and Long. Example usage: + *

+ * import se.scalablesolutions.akka.util.duration._
+ *
+ * val duration = 100.millis
+ * 
+ */ class Duration(val length: Long, val unit: TimeUnit) { def toNanos = unit.toNanos(length) def toMicros = unit.toMicros(length) @@ -57,7 +57,7 @@ class DurationInt(n: Int) { def nanos = Duration(n, TimeUnit.NANOSECONDS) def nanosecond = Duration(n, TimeUnit.NANOSECONDS) def nano = Duration(n, TimeUnit.NANOSECONDS) - + def microseconds = Duration(n, TimeUnit.MICROSECONDS) def micros = Duration(n, TimeUnit.MICROSECONDS) def microsecond = Duration(n, TimeUnit.MICROSECONDS) @@ -77,7 +77,7 @@ class DurationLong(n: Long) { def nanos = Duration(n, TimeUnit.NANOSECONDS) def nanosecond = Duration(n, TimeUnit.NANOSECONDS) def nano = Duration(n, TimeUnit.NANOSECONDS) - + def microseconds = Duration(n, TimeUnit.MICROSECONDS) def micros = Duration(n, TimeUnit.MICROSECONDS) def microsecond = Duration(n, TimeUnit.MICROSECONDS)