package org.jboss.ha.httpsession.beanimpl.ejb;
import org.jboss.ejb.plugins.AbstractInterceptor;
import org.jboss.invocation.Invocation;
public class ServerTCLInterceptor extends AbstractInterceptor
{
public Object invokeHome(Invocation mi) throws Exception
{
ClassLoader prevTCL = Thread.currentThread().getContextClassLoader();
ClassLoader tcl = (ClassLoader) mi.getValue("org.jboss.invocation.TCL");
try
{
if( tcl != null )
Thread.currentThread().setContextClassLoader(tcl);
return getNext().invokeHome(mi);
}
finally
{
if( tcl != null )
Thread.currentThread().setContextClassLoader(prevTCL);
}
}
public Object invoke(Invocation mi) throws Exception
{
ClassLoader prevTCL = Thread.currentThread().getContextClassLoader();
ClassLoader tcl = (ClassLoader) mi.getValue("org.jboss.invocation.TCL");
try
{
if( tcl != null )
Thread.currentThread().setContextClassLoader(tcl);
return getNext().invoke(mi);
}
finally
{
if( tcl != null )
Thread.currentThread().setContextClassLoader(prevTCL);
}
}
}