The typical pattern for a custom classloader would also use:

    Thread thread = Thread.currentThread();
    ClassLoader oldLoader = thread.getContextClassLoader();
    try {
      thread.setContextClassLoader(myClassLoader);

      pageController.execute();
    } finally {
      thread.setContextClassLoader(oldLoader);
   }

That way, any dependent classes would get picked up properly even if
using reflection.
You're right, thanks - I'll adjust my code :)


Well, for 4.0.18, one of the bugs/features we need to put in is a way to
customize the persistence (primarily for jdbc-style sessions, but I
believe some others want to customize the capability.)

So I can keep this use-case in mind when I put together that API.
Nice, thanks :)
But it might be cleaner to use the ContextClassLoader pattern with a
session-config so you don't actually need to write a custom serializer.
This will actually not work properly, since ObjectInputStream.readObject does not honor the thread's contextclassloader when resolving classes, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4340158, dating back to 2000. (Resolved as Closed, Will Not Fix)

-- Edvin
_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to