Skip to content

Commit

Permalink
Remove unnecessary synchronization while getting/setting ContainerVar…
Browse files Browse the repository at this point in the history
… values. Refs issue lift#1629.
  • Loading branch information
davewhittaker committed Oct 22, 2014
1 parent a03b4ce commit 521e5f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/webkit/src/main/scala/net/liftweb/http/Vars.scala
Expand Up @@ -181,14 +181,14 @@ private[http] trait HasLogUnreadVal {
* provides a subset of these.
*/
abstract class ContainerVar[T](dflt: => T)(implicit containerSerializer: ContainerSerializer[T]) extends AnyVar[T, ContainerVar[T]](dflt) with LazyLoggable {

override protected def findFunc(name: String): Box[T] = S.session match {
case Full(session) => {
localGet(session, name) match {
case Full(array: Array[Byte]) => Full(containerSerializer.deserialize(array))
case _ => Empty
}
}

case _ => {
if (showWarningWhenAccessedOutOfSessionScope_?)
logger.warn("Getting a SessionVar " + name + " outside session scope") // added warning per issue 188
Expand Down Expand Up @@ -233,7 +233,7 @@ abstract class ContainerVar[T](dflt: => T)(implicit containerSerializer: Contain
* In the case of ContainerVar, we synchronize on the ContainerVar
* instance itself.
*/
def doSync[F](f: => F): F = this.synchronized(f)
def doSync[F](f: => F): F = f

def showWarningWhenAccessedOutOfSessionScope_? = false

Expand Down

0 comments on commit 521e5f0

Please sign in to comment.