fix fallout of Duration changes in STM tests
- document change in Java API
This commit is contained in:
parent
6a672747b9
commit
91e210ebbb
3 changed files with 15 additions and 12 deletions
|
|
@ -87,10 +87,13 @@ object Duration {
|
|||
* Parse TimeUnit from string representation.
|
||||
*/
|
||||
def timeUnit(unit: String) = unit.toLowerCase match {
|
||||
case "nanoseconds" | "nanos" | "nanosecond" | "nano" => NANOSECONDS
|
||||
case "microseconds" | "micros" | "microsecond" | "micro" => MICROSECONDS
|
||||
case "milliseconds" | "millis" | "millisecond" | "milli" => MILLISECONDS
|
||||
case _ => SECONDS
|
||||
case "d" | "day" | "days" => DAYS
|
||||
case "h" | "hour" | "hours" => HOURS
|
||||
case "min" | "minute" | "minutes" => MINUTES
|
||||
case "s" | "sec" | "second" | "seconds" => SECONDS
|
||||
case "ms" | "milli" | "millis" | "millisecond" | "milliseconds" => MILLISECONDS
|
||||
case "µs" | "micro" | "micros" | "microsecond" | "microseconds" => MICROSECONDS
|
||||
case "ns" | "nano" | "nanos" | "nanosecond" | "nanoseconds" => NANOSECONDS
|
||||
}
|
||||
|
||||
trait Infinite {
|
||||
|
|
@ -153,11 +156,11 @@ object Duration {
|
|||
* <p/>
|
||||
* Examples of usage from Java:
|
||||
* <pre>
|
||||
* import akka.util.Duration;
|
||||
* import akka.util.FiniteDuration;
|
||||
* import java.util.concurrent.TimeUnit;
|
||||
*
|
||||
* Duration duration = new Duration(100, MILLISECONDS);
|
||||
* Duration duration = new Duration(5, "seconds");
|
||||
* Duration duration = new FiniteDuration(100, MILLISECONDS);
|
||||
* Duration duration = new FiniteDuration(5, "seconds");
|
||||
*
|
||||
* duration.toNanos();
|
||||
* </pre>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import akka.transactor.Atomically;
|
|||
import akka.actor.ActorRef;
|
||||
import akka.actor.UntypedActor;
|
||||
import akka.stm.*;
|
||||
import akka.util.Duration;
|
||||
import akka.util.FiniteDuration;
|
||||
|
||||
import org.multiverse.api.StmUtils;
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ public class UntypedCoordinatedCounter extends UntypedActor {
|
|||
private String name;
|
||||
private Ref<Integer> count = new Ref(0);
|
||||
private TransactionFactory txFactory = new TransactionFactoryBuilder()
|
||||
.setTimeout(new Duration(3, TimeUnit.SECONDS))
|
||||
.setTimeout(new FiniteDuration(3, TimeUnit.SECONDS))
|
||||
.build();
|
||||
|
||||
public UntypedCoordinatedCounter(String name) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import akka.transactor.UntypedTransactor;
|
|||
import akka.transactor.SendTo;
|
||||
import akka.actor.ActorRef;
|
||||
import akka.stm.*;
|
||||
import akka.util.Duration;
|
||||
import akka.util.FiniteDuration;
|
||||
|
||||
import org.multiverse.api.StmUtils;
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ public class UntypedCounter extends UntypedTransactor {
|
|||
|
||||
@Override public TransactionFactory transactionFactory() {
|
||||
return new TransactionFactoryBuilder()
|
||||
.setTimeout(new Duration(3, TimeUnit.SECONDS))
|
||||
.setTimeout(new FiniteDuration(3, TimeUnit.SECONDS))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
@ -74,4 +74,4 @@ public class UntypedCounter extends UntypedTransactor {
|
|||
return true;
|
||||
} else return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue