站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 cluster API Documentation 英文版文档

ClusteredHTTPSessionService (JBoss Cluster API) - JBoss 4.0.1 sp1 cluster API Documentation 英文版文档


org.jboss.ha.httpsession.server
Class ClusteredHTTPSessionService

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.ha.httpsession.server.ClusteredHTTPSessionService
All Implemented Interfaces:
ClusteredHTTPSessionServiceMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class ClusteredHTTPSessionService
extends org.jboss.system.ServiceMBeanSupport
implements ClusteredHTTPSessionServiceMBean

JMX Service implementation for ClusteredHTTPSessionServiceMBean

Version:
$Revision: 1.11 $

Revisions:

31. decembre 2001 Sacha Labourey:

  • First implementation
Author:
Sacha Labourey.
See Also:
ClusteredHTTPSessionServiceMBean

Nested Class Summary
protected  class ClusteredHTTPSessionService.CleanupDaemon
           
 
Field Summary
protected  ClusteredHTTPSessionService.CleanupDaemon cleanup
           
protected static long CLEANUP_FREQUENCY
           
protected  MessageDigest digest
           
protected  ClusteredHTTPSessionHome httpSessionHome
           
protected  LocalClusteredHTTPSessionHome localHttpSessionHome
           
protected  Random random
           
protected static int SESSION_ID_BYTES
           
protected static String SESSION_ID_HASH_ALGORITHM
           
protected static String SESSION_ID_RANDOM_ALGORITHM
           
protected static String SESSION_ID_RANDOM_ALGORITHM_ALT
           
protected  long sessionTimeout
           
protected  boolean useLocalBean
           
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
ClusteredHTTPSessionService()
           
 
Method Summary
protected  ClusteredHTTPSessionBusiness createSession(String id, SerializableHttpSession session)
           
protected  String encode(byte[] data)
          Encode the bytes into a String with a slightly modified Base64-algorithm This code was written by Kevin Kelley and adapted by Thomas Peuss
protected  String generateSessionId()
          Generate a session-id that is not guessable
protected  MessageDigest getDigest()
          get a MessageDigest hash-generator
 SerializableHttpSession getHttpSession(String sessionId, ClassLoader tcl)
          Return the HttpSession associated to a session id.
protected  Random getRandom()
          get a random-number generator
 String getSessionId()
          Generates a new session id available cluster-wide
 long getSessionTimeout()
          Indicate the duration, in ms, after which the session can be cleaned if no access occurs.
 boolean getUseLocalBean()
           
protected  void initRefToBean()
           
 void removeHttpSession(String sessionId)
          Remove an HttpSession from the cluster (log off for example)
 void setHttpSession(String sessionId, SerializableHttpSession session)
          Associate a new session with the session id.
 void setSessionTimeout(long miliseconds)
          Indicate the duration, in ms, after which the session can be cleaned if no access occurs.
 void setUseLocalBean(boolean useLocal)
          Indicates whether the service should use the local and home interfaces of the entity bean or the remote and remote home interfaces (depending if they are in the same JVM).
protected  void startService()
           
protected  void stopService()
           
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

CLEANUP_FREQUENCY

protected static final long CLEANUP_FREQUENCY
See Also:
Constant Field Values

SESSION_ID_BYTES

protected static final int SESSION_ID_BYTES
See Also:
Constant Field Values

SESSION_ID_HASH_ALGORITHM

protected static final String SESSION_ID_HASH_ALGORITHM
See Also:
Constant Field Values

SESSION_ID_RANDOM_ALGORITHM

protected static final String SESSION_ID_RANDOM_ALGORITHM
See Also:
Constant Field Values

SESSION_ID_RANDOM_ALGORITHM_ALT

protected static final String SESSION_ID_RANDOM_ALGORITHM_ALT
See Also:
Constant Field Values

httpSessionHome

protected ClusteredHTTPSessionHome httpSessionHome

localHttpSessionHome

protected LocalClusteredHTTPSessionHome localHttpSessionHome

cleanup

protected ClusteredHTTPSessionService.CleanupDaemon cleanup

sessionTimeout

protected long sessionTimeout

useLocalBean

protected boolean useLocalBean

digest

protected MessageDigest digest

random

protected Random random
Constructor Detail

ClusteredHTTPSessionService

public ClusteredHTTPSessionService()
Method Detail

setHttpSession

public void setHttpSession(String sessionId,
                           SerializableHttpSession session)
                    throws javax.ejb.EJBException
Description copied from interface: ClusteredHTTPSessionServiceMBean
Associate a new session with the session id. To reduce the cluster communication, if the only thing that has changed in the session is the last accessed time, the new session is kept in cache but not replicated on the other nodes. Thus, if you use a front-end load-balancer that support sticky session, that is not a problem because a client will always target the same node and receive the updated session available in cache. Nevertheless, as soon as an attribute is modified in the session, it is replicated in the cluster.

Specified by:
setHttpSession in interface ClusteredHTTPSessionServiceMBean
Throws:
javax.ejb.EJBException

getHttpSession

public SerializableHttpSession getHttpSession(String sessionId,
                                              ClassLoader tcl)
                                       throws javax.ejb.EJBException
Description copied from interface: ClusteredHTTPSessionServiceMBean
Return the HttpSession associated to a session id. As all session id are shared for all Web Applications, all sessions ids accross all applications and all nodes must be distincts! The creation and last access time of the session may not be correct if they are the only thing that has been modified on a distant node (and no attribute). See setHttpSession for more information.

Specified by:
getHttpSession in interface ClusteredHTTPSessionServiceMBean
Throws:
javax.ejb.EJBException

removeHttpSession

public void removeHttpSession(String sessionId)
                       throws javax.ejb.EJBException
Description copied from interface: ClusteredHTTPSessionServiceMBean
Remove an HttpSession from the cluster (log off for example)

Specified by:
removeHttpSession in interface ClusteredHTTPSessionServiceMBean
Throws:
javax.ejb.EJBException

getSessionTimeout

public long getSessionTimeout()
Description copied from interface: ClusteredHTTPSessionServiceMBean
Indicate the duration, in ms, after which the session can be cleaned if no access occurs.

Specified by:
getSessionTimeout in interface ClusteredHTTPSessionServiceMBean

setSessionTimeout

public void setSessionTimeout(long miliseconds)
Description copied from interface: ClusteredHTTPSessionServiceMBean
Indicate the duration, in ms, after which the session can be cleaned if no access occurs.

Specified by:
setSessionTimeout in interface ClusteredHTTPSessionServiceMBean

getSessionId

public String getSessionId()
Description copied from interface: ClusteredHTTPSessionServiceMBean
Generates a new session id available cluster-wide

Specified by:
getSessionId in interface ClusteredHTTPSessionServiceMBean

setUseLocalBean

public void setUseLocalBean(boolean useLocal)
Description copied from interface: ClusteredHTTPSessionServiceMBean
Indicates whether the service should use the local and home interfaces of the entity bean or the remote and remote home interfaces (depending if they are in the same JVM).

Specified by:
setUseLocalBean in interface ClusteredHTTPSessionServiceMBean

getUseLocalBean

public boolean getUseLocalBean()
Specified by:
getUseLocalBean in interface ClusteredHTTPSessionServiceMBean

startService

protected void startService()
                     throws Exception
Throws:
Exception

stopService

protected void stopService()
                    throws Exception
Throws:
Exception

initRefToBean

protected void initRefToBean()
                      throws Exception
Throws:
Exception

createSession

protected ClusteredHTTPSessionBusiness createSession(String id,
                                                     SerializableHttpSession session)
                                              throws Exception
Throws:
Exception

generateSessionId

protected String generateSessionId()
Generate a session-id that is not guessable

Returns:
generated session-id

encode

protected String encode(byte[] data)
Encode the bytes into a String with a slightly modified Base64-algorithm This code was written by Kevin Kelley and adapted by Thomas Peuss

Parameters:
data - The bytes you want to encode
Returns:
the encoded String

getRandom

protected Random getRandom()
get a random-number generator

Returns:
a random-number generator

getDigest

protected MessageDigest getDigest()
get a MessageDigest hash-generator

Returns:
a hash generator


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.