From 9f7d78173caa91b551e97b4f1de33e33d3ee35bf Mon Sep 17 00:00:00 2001 From: Peter Vlugter Date: Fri, 13 Aug 2010 11:08:55 +1200 Subject: [PATCH] Small changes to Ref --- akka-core/src/main/scala/stm/Ref.scala | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/akka-core/src/main/scala/stm/Ref.scala b/akka-core/src/main/scala/stm/Ref.scala index 7d99c673a6..d660de1377 100644 --- a/akka-core/src/main/scala/stm/Ref.scala +++ b/akka-core/src/main/scala/stm/Ref.scala @@ -42,13 +42,12 @@ class Ref[T](initialOpt: Option[T] = None) def swap(elem: T) = set(elem) def alter(f: T => T): T = { - ensureNotNull val value = f(this.get) set(value) value } - def getOption: Option[T] = Option(this.get) + def opt: Option[T] = Option(this.get) def getOrWait: T = getOrAwait @@ -94,7 +93,4 @@ class Ref[T](initialOpt: Option[T] = None) def toLeft[X](right: => X) = if (isEmpty) Right(right) else Left(this.get) - - private def ensureNotNull = - if (isNull) throw new RuntimeException("Cannot alter Ref's value when it is null") }