KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ha > httpsession > beanimpl > ejb > ClientTCLInterceptor


1 /*
2 * JBoss, the OpenSource J2EE webOS
3 *
4 * Distributable under LGPL license.
5 * See terms of license at gnu.org.
6 */

7 package org.jboss.ha.httpsession.beanimpl.ejb;
8
9 import java.io.Serializable JavaDoc;
10
11 import org.jboss.invocation.Invocation;
12 import org.jboss.invocation.PayloadKey;
13 import org.jboss.proxy.Interceptor;
14
15 /** An InvokerInterceptor that places the client thread context ClassLoader
16  * into the invocation for use by the s ServerTCLInterceptor.
17  *
18  * @see org.jboss.ha.httpsession.beanimpl.ejb.ServerTCLInterceptor
19  *
20  * @author Scott.Stark@jboss.org
21  * @version $Revision: 1.2 $
22  */

23 public class ClientTCLInterceptor
24       extends Interceptor
25       implements Serializable JavaDoc
26 {
27    /** The serialVersionUID
28     * @since 1.1.2.1
29     */

30    private static final long serialVersionUID = 1092404482795617680L;
31
32    public ClientTCLInterceptor()
33    {
34    }
35
36    // Public --------------------------------------------------------
37

38    /** Add the current thread context ClassLoader to the invocation as a
39     * transient value under the key "org.jboss.invocation.TCL"
40     */

41    public Object JavaDoc invoke(Invocation invocation)
42          throws Throwable JavaDoc
43    {
44       ClassLoader JavaDoc tcl = Thread.currentThread().getContextClassLoader();
45       invocation.setValue("org.jboss.invocation.TCL", tcl, PayloadKey.TRANSIENT);
46       return getNext().invoke(invocation);
47    }
48 }
49
Popular Tags