Some additional information:

I added some logging to see exactly what resources are being acquired
and released when, and it looks like RequestVar is the culprit. Am I
just doing something really stupid with it? Here's the modified code
that's generating the logs:

class JNDIResource[T](val name : String) {
  private val context = new InitialContext()

  private val resource = new RequestVar[T](acquire) {
    override def cleanupFunc : Can[() => Unit] = Full(() => release(this.is))
  }

  protected def acquire() : T = {
    Log.debug("Acquiring JNDI resource " + name + "(" + this + ")");
    context.lookup(name).asInstanceOf[T]
  }

  protected def release(resource: T) {
    Log.debug("Releasing JNDI resource " + name + "(" + resource + ")")
  }

  def apply() : T = {
    Log.debug("Using JNDI resource " + name + "(" + resource + ")")
    resource.is
  }
}

DEBUG lift - Acquiring JNDI resource
java:comp/UserTransaction([EMAIL PROTECTED])
DEBUG lift - Using JNDI resource
java:comp/UserTransaction([EMAIL PROTECTED])
DEBUG lift - Acquiring JNDI resource
java:comp/env/persistence/em([EMAIL PROTECTED])
DEBUG lift - Using JNDI resource
java:comp/env/persistence/em([EMAIL PROTECTED])
DEBUG lift - Using JNDI resource
java:comp/env/persistence/em([EMAIL PROTECTED])
DEBUG lift - Releasing JNDI resource
java:comp/UserTransaction([EMAIL PROTECTED])
DEBUG lift - Using JNDI resource
java:comp/UserTransaction([EMAIL PROTECTED])


Doubtless I'll have to do something about the cleanup order, but how
is it that the RequestVar's contents in the UserTransaction resource
is getting overwritten by the EntityManager? I'm sure that this is the
same thing that's happening with the remote proxy in my initial post.

Thanks,

Kris

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to