Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.ha.hasessionstate.server
Class HASessionStateImpl

    java.lang.Object
      org.jboss.ha.hasessionstate.server.HASessionStateImpl

All Implemented Interfaces:
  HAPartition.HAPartitionStateTransfer, HASessionState

public class HASessionStateImpl
extends Object
implements HASessionState, HAPartition.HAPartitionStateTransfer

Default implementation of HASessionState

Version:
  $Revision: 1.15 $

  Revisions:

  2002/01/09: billb

  1. ripped out sub partitioning stuff. It really belongs as a subclass of HAPartition
Author:
  sacha.labourey@cogito-info.ch, Bill Burke
See Also:
  `HASessionState`

Nested Class Summary

Nested classes inherited from class org.jboss.ha.hasessionstate.interfaces.HASessionState
`HASessionState.HASessionStateListener`

Field Summary
`protected String` | `_sessionStateName`
`protected Hashtable` | `appSessions`
`protected long` | `beanCleaningDelay`
`protected String` | `DEFAULT_PARTITION_JNDI_NAME`
`protected static String` | `HA_SESSION_STATE_STATE_TRANSFER`
`protected String` | `haPartitionJndiName`
`protected String` | `haPartitionName`
`protected HAPartition` | `hapGeneral`
`protected String` | `JNDI_FOLDER_NAME_FOR_HAPARTITION`
`protected String` | `JNDI_FOLDER_NAME_FOR_HASESSIONSTATE`
`protected Hashtable` | `listeners`
`protected Object` | `lockAppSession`
`protected HashMap` | `locks`
`protected org.jboss.logging.Logger` | `log`
`protected long` | `MAX_DELAY_BEFORE_CLEANING_UNRECLAIMED_STATE`
`protected String` | `myNodeName`
`protected String` | `sessionStateIdentifier`

Constructor Summary
`HASessionStateImpl()`
`HASessionStateImpl(String sessionStateName, String mainHAPartitionName, long beanCleaningDelay)`

Method Summary
`PackagedSessionImpl` | `_createSession(String appName, Object keyId)`
`void` | `_removeSession(String appName, Object keyId)`
`Boolean` | `_setOwnership(String appName, Object keyId, String newOwner, Long remoteVersion)`
`void` | `_setState(String appName, PackagedSession session)`
`protected void` | `bind(String jndiName, Object who, Class classType, Context ctx)`
`void` | `createSession(String appName, Object keyId)` Share a new session state in the sub-partition of this cluster
`protected byte[]` | `deflate(Object object)`
`HAPartition` | `getCurrentHAPartition()`
`Serializable` | `getCurrentState()` Called when a new node need to be initialized.
`protected Hashtable` | `getHashtableForApp(String appName)`
`protected EDU.oswego.cs.dl.util.concurrent.Mutex` | `getLock(String appName, Object key)`
`String` | `getNodeName()` Return the name of this node as used in the computations
`PackagedSession` | `getState(String appName, Object keyId)` Get a particular state
`PackagedSession` | `getStateWithOwnership(String appName, Object keyId)` Get a state and, if it is not already the case, takes its ownership (a state is always owned by a node)
`protected Object` | `inflate(byte[] compressedContent)`
`void` | `init()`
`PackagedSession` | `localTakeOwnership(String appName, Object keyId)`
`protected boolean` | `lockExists(String appName, Object key)`
`void` | `ownedObjectExternallyModified(String appName, Object key, PackagedSession oldSession, PackagedSession newSession)`
`void` | `purgeState()`
`protected void` | `removeLock(String appName, Object key)`
`void` | `removeSession(String appName, Object keyId)` Remove a session from the sub-partition
`void` | `setCurrentState(Serializable newState)` This callback method is called when a new service starts on a new node: the state that it should hold is transfered to it through this callback
`void` | `setState(String appName, Object keyId, byte[] state)` Modifies a state already shared
`void` | `start()`
`void` | `stop()`
`void` | `subscribe(String appName, HASessionState.HASessionStateListener listener)` Subscribe to receive notifications when objects gets modified on another node.
`void` | `takeOwnership(String appName, Object keyId)` Take ownership of a state.
`void` | `unsubscribe(String appName, HASessionState.HASessionStateListener listener)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _sessionStateName

    protected String _sessionStateName

### log

    protected org.jboss.logging.Logger log

### hapGeneral

    protected HAPartition hapGeneral

### sessionStateIdentifier

    protected String sessionStateIdentifier

### myNodeName

    protected String myNodeName

### beanCleaningDelay

    protected long beanCleaningDelay

### haPartitionName

    protected String haPartitionName

### haPartitionJndiName

    protected String haPartitionJndiName

### DEFAULT_PARTITION_JNDI_NAME

    protected final String DEFAULT_PARTITION_JNDI_NAME

See Also:
  Constant Field Values

### JNDI_FOLDER_NAME_FOR_HASESSIONSTATE

    protected final String JNDI_FOLDER_NAME_FOR_HASESSIONSTATE

See Also:
  Constant Field Values

### JNDI_FOLDER_NAME_FOR_HAPARTITION

    protected final String JNDI_FOLDER_NAME_FOR_HAPARTITION

See Also:
  Constant Field Values

### MAX_DELAY_BEFORE_CLEANING_UNRECLAIMED_STATE

    protected final long MAX_DELAY_BEFORE_CLEANING_UNRECLAIMED_STATE

See Also:
  Constant Field Values

### HA_SESSION_STATE_STATE_TRANSFER

    protected static final String HA_SESSION_STATE_STATE_TRANSFER

See Also:
  Constant Field Values

### locks

    protected HashMap locks

### appSessions

    protected Hashtable appSessions

### lockAppSession

    protected Object lockAppSession

### listeners

    protected Hashtable listeners

Constructor Detail

### HASessionStateImpl

    public HASessionStateImpl()

### HASessionStateImpl

    public HASessionStateImpl(String sessionStateName,
                              String mainHAPartitionName,
                              long beanCleaningDelay)

Method Detail

### init

    public void init()
              throws Exception

  Specified by:
    `init` in interface `HASessionState`
  Throws:
    `Exception`

### bind

    protected void bind(String jndiName,
                        Object who,
                        Class classType,
                        Context ctx)
                 throws Exception

  Throws:
    `Exception`

### start

    public void start()
               throws Exception

  Specified by:
    `start` in interface `HASessionState`
  Throws:
    `Exception`

### stop

    public void stop()
              throws Exception

  Throws:
    `Exception`

### getNodeName

    public String getNodeName()

  Description copied from interface: `HASessionState`
  Return the name of this node as used in the computations

  Specified by:
    `getNodeName` in interface `HASessionState`

### getCurrentState

    public Serializable getCurrentState()

  Description copied from interface: `HAPartition.HAPartitionStateTransfer`
  Called when a new node need to be initialized. This is called on any existing node to determine a current state for this service.

  Specified by:
    `getCurrentState` in interface `HAPartition.HAPartitionStateTransfer`
  Returns:
    A serializable representation of the state

### setCurrentState

    public void setCurrentState(Serializable newState)

  Description copied from interface: `HAPartition.HAPartitionStateTransfer`
  This callback method is called when a new service starts on a new node: the state that it should hold is transfered to it through this callback

  Specified by:
    `setCurrentState` in interface `HAPartition.HAPartitionStateTransfer`
  Parameters:
    `newState` - The serialized representation of the state of the new service.

### purgeState

    public void purgeState()

### deflate

    protected byte[] deflate(Object object)
                      throws IOException

  Throws:
    `IOException`

### inflate

    protected Object inflate(byte[] compressedContent)
                      throws IOException

  Throws:
    `IOException`

### getHashtableForApp

    protected Hashtable getHashtableForApp(String appName)

### createSession

    public void createSession(String appName,
                              Object keyId)

  Description copied from interface: `HASessionState`
  Share a new session state in the sub-partition of this cluster

  Specified by:
    `createSession` in interface `HASessionState`
  Parameters:
    `appName` - Application name for which is state is shared
    `keyId` - Key identifier of the state

### _createSession

    public PackagedSessionImpl _createSession(String appName,
                                              Object keyId)

### setState

    public void setState(String appName,
                         Object keyId,
                         byte[] state)
                  throws RemoteException

  Description copied from interface: `HASessionState`
  Modifies a state already shared

  Specified by:
    `setState` in interface `HASessionState`
  Parameters:
    `appName` - Application name hosting this state
    `keyId` - Key identifier of the state to modify
    `state` - New state
  Throws:
    `RemoteException`

### _setState

    public void _setState(String appName,
                          PackagedSession session)

### getState

    public PackagedSession getState(String appName,
                                    Object keyId)

  Description copied from interface: `HASessionState`
  Get a particular state

  Specified by:
    `getState` in interface `HASessionState`
  Parameters:
    `appName` - Application hosting the state
    `keyId` - Key identifier of the state
  Returns:
    The state value

### getStateWithOwnership

    public PackagedSession getStateWithOwnership(String appName,
                                                 Object keyId)
                                          throws RemoteException

  Description copied from interface: `HASessionState`
  Get a state and, if it is not already the case, takes its ownership (a state is always owned by a node)

  Specified by:
    `getStateWithOwnership` in interface `HASessionState`
  Parameters:
    `appName` - Application hosting the state
    `keyId` - Key identifier of the state
  Returns:
    The state value
  Throws:
    `RemoteException` - Thrown if an exception occurs while getting the ownership of the state

### localTakeOwnership

    public PackagedSession localTakeOwnership(String appName,
                                              Object keyId)
                                       throws RemoteException

  Throws:
    `RemoteException`

### _setOwnership

    public Boolean _setOwnership(String appName,
                                 Object keyId,
                                 String newOwner,
                                 Long remoteVersion)

### takeOwnership

    public void takeOwnership(String appName,
                              Object keyId)
                       throws RemoteException

  Description copied from interface: `HASessionState`
  Take ownership of a state. Each state is owned by a node.

  Specified by:
    `takeOwnership` in interface `HASessionState`
  Parameters:
    `appName` - Application hosting the state
    `keyId` - Key identifier of the state
  Throws:
    `RemoteException` - Trown if a communication exception occurs while asking other node to get the ownership

### removeSession

    public void removeSession(String appName,
                              Object keyId)

  Description copied from interface: `HASessionState`
  Remove a session from the sub-partition

  Specified by:
    `removeSession` in interface `HASessionState`
  Parameters:
    `appName` - Application hosting the state
    `keyId` - Key identifier of the state

### _removeSession

    public void _removeSession(String appName,
                               Object keyId)

### subscribe

    public void subscribe(String appName,
                          HASessionState.HASessionStateListener listener)

  Description copied from interface: `HASessionState`
  Subscribe to receive notifications when objects gets modified on another node.

  Specified by:
    `subscribe` in interface `HASessionState`

### unsubscribe

    public void unsubscribe(String appName,
                            HASessionState.HASessionStateListener listener)

  Specified by:
    `unsubscribe` in interface `HASessionState`

### ownedObjectExternallyModified

    public void ownedObjectExternallyModified(String appName,
                                              Object key,
                                              PackagedSession oldSession,
                                              PackagedSession newSession)

### getCurrentHAPartition

    public HAPartition getCurrentHAPartition()

  Specified by:
    `getCurrentHAPartition` in interface `HASessionState`

### lockExists

    protected boolean lockExists(String appName,
                                 Object key)

### getLock

    protected EDU.oswego.cs.dl.util.concurrent.Mutex getLock(String appName,
                                                             Object key)

### removeLock

    protected void removeLock(String appName,
                              Object key)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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