KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ha > httpsession > server > ClusteredHTTPSessionServiceMBean


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

7
8 package org.jboss.ha.httpsession.server;
9
10 import javax.ejb.EJBException JavaDoc;
11
12 import org.jboss.ha.httpsession.interfaces.SerializableHttpSession;
13
14 /**
15  * Service that provide unified access to clustered HTTPSessions for servlets.
16  *
17  * @see org.jboss.ha.httpsession.beanimpl.interfaces.ClusteredHTTPSession
18  * @see org.jboss.ha.httpsession.beanimpl.interfaces.ClusteredHTTPSessionHome
19  *
20  * @author <a HREF="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>.
21  * @version $Revision: 1.3 $
22  *
23  * <p><b>Revisions:</b>
24  *
25  * <p><b>31. décembre 2001 Sacha Labourey:</b>
26  * <ul>
27  * <li> First implementation </li>
28  * </ul>
29  */

30
31 public interface ClusteredHTTPSessionServiceMBean extends org.jboss.system.ServiceMBean
32 {
33    /**
34     * Return the HttpSession associated to a session id.
35     * As all session id are shared for all Web Applications, all sessions ids accross
36     * all applications and all nodes must be distincts!
37     * The creation and last access time of the session may not be correct if they
38     * are the only thing that has been modified on a distant node (and no attribute).
39     * See setHttpSession for more information.
40     */

41    public SerializableHttpSession getHttpSession (String JavaDoc sessionId, ClassLoader JavaDoc tcl) throws EJBException JavaDoc;
42    /**
43     * Associate a new session with the session id. To reduce the cluster communication,
44     * if the only thing that has changed in the session is the last accessed time, the
45     * new session is kept in cache but not replicated on the other nodes. Thus, if you
46     * use a front-end load-balancer that support sticky session, that is not a problem
47     * because a client will always target the same node and receive the updated session
48     * available in cache.
49     * Nevertheless, as soon as an attribute is modified in the session, it is replicated
50     * in the cluster.
51     */

52    public void setHttpSession (String JavaDoc sessionId, SerializableHttpSession session) throws EJBException JavaDoc;
53    /**
54     * Remove an HttpSession from the cluster (log off for example)
55     */

56    public void removeHttpSession (String JavaDoc sessionId) throws EJBException JavaDoc;
57    /**
58     * Generates a new session id available cluster-wide
59     */

60    public String JavaDoc getSessionId ();
61    
62    /**
63     * Indicate the duration, in ms, after which the session can be cleaned if no
64     * access occurs.
65     */

66    public long getSessionTimeout (); // defaults to 15 minutes i.e. 15*60*1000 = 900'000
67
/**
68     * Indicate the duration, in ms, after which the session can be cleaned if no
69     * access occurs.
70     */

71    public void setSessionTimeout (long miliseconds);
72    
73    /**
74     * Indicates whether the service should use the local and home interfaces of the
75     * entity bean or the remote and remote home interfaces (depending if they are in
76     * the same JVM).
77     */

78    public void setUseLocalBean (boolean useLocal);
79    public boolean getUseLocalBean ();
80 }
81
Popular Tags