[Lift] Re: Weird RequestVar behavior (or something else?)

2008-09-29 Thread David Pollak
Kris, If your goal is to have some cleanup function added at the end of the request, you can do the following: trait Cleanable {def cleanup: Unit} class MyStuff { var needsCleanup: Can[Cleanable] = Empty S.addCleanupFunc(() = needsCleanup.foreach(_.cleanup)) } So, in the above code, if

[Lift] Re: Weird RequestVar behavior (or something else?)

2008-09-29 Thread David Pollak
Kris, I'd do something like: object MyTransactionThingy extends LoanWrapper { private val transactions = new ThreadGlobal[Map[String, Transaction]] def apply[T](f: = T): T = { transactions.doWith(Map.empty){ val ret = f transactions.value.values.foreach(_.cleanup) }

[Lift] Re: Weird RequestVar behavior (or something else?)

2008-09-26 Thread Kris Nuttycombe
Well, I figured out what's going on. RequestVar and SessionVar depend upon their *class name* for uniqueness. So, you can't just create a RequestVar instance and expect uniqueness, and in fact if you create a RequestVar as a member of a reusable superclass like my JNDIResource, even with a