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.ejb.plugins
Class StatefulSessionFilePersistenceManager

    java.lang.Object
      org.jboss.mx.util.JBossNotificationBroadcasterSupport
          org.jboss.system.ServiceMBeanSupport
              org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager

All Implemented Interfaces:
  AllowedOperationsFlags, ContainerPlugin, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean, StatefulSessionFilePersistenceManagerMBean, StatefulSessionPersistenceManager

public class StatefulSessionFilePersistenceManager
extends org.jboss.system.ServiceMBeanSupport
implements StatefulSessionPersistenceManager, StatefulSessionFilePersistenceManagerMBean

A file-based stateful session bean persistence manager.

Reads and writes session bean objects to files by using the standard Java serialization mechanism.

Passivated state files are stored under: `jboss-server-data-dir/storeDirectoryName/ejb-name-unique-id`.

Since ejb-name is not unique across deployments we generate a unique-id to make sure that beans with the same EJB name do not collide.

Version:
  `$Revision: 1.43 $`
Author:
  Rickard �berg, Marc Fleury, Sebastien Alborini, Jason Dillon

Field Summary
`static String` | `DEFAULT_STORE_DIRECTORY_NAME` The default store directory name ("`sessions`").

Fields inherited from class org.jboss.system.ServiceMBeanSupport
`log, server, SERVICE_CONTROLLER_SIG, serviceName`

Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags
`IN_AFTER_BEGIN, IN_AFTER_COMPLETION, IN_BEFORE_COMPLETION, IN_BUSINESS_METHOD, IN_EJB_ACTIVATE, IN_EJB_CREATE, IN_EJB_FIND, IN_EJB_HOME, IN_EJB_LOAD, IN_EJB_PASSIVATE, IN_EJB_POST_CREATE, IN_EJB_REMOVE, IN_EJB_STORE, IN_EJB_TIMEOUT, IN_INTERCEPTOR_METHOD, IN_SERVICE_ENDPOINT_METHOD, IN_SET_ENTITY_CONTEXT, IN_SET_MESSAGE_DRIVEN_CONTEXT, IN_SET_SESSION_CONTEXT, IN_UNSET_ENTITY_CONTEXT, NOT_ALLOWED`

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
`StatefulSessionFilePersistenceManager()`

Method Summary
`void` | `activateSession(StatefulSessionEnterpriseContext ctx)` Restores session state from the serialized file & invokes `SessionBean.ejbActivate()` on the target bean.
`void` | `createdSession(StatefulSessionEnterpriseContext ctx)` Non-operation.
`Object` | `createId(StatefulSessionEnterpriseContext ctx)` Create a unique identifier for the given SFSB context.
`protected void` | `createService()` Setup the session data storage directory.
`protected void` | `destroyService()` Purge any data in the store, and then the store directory too.
`boolean` | `getPurgeEnabled()` Get the stale session state purge enabled flag.
`File` | `getStoreDirectory()` Returns the directory used to store session passivation state files.
`String` | `getStoreDirectoryName()` Get the sub-directory name under the server data directory where session data is stored.
`void` | `passivateSession(StatefulSessionEnterpriseContext ctx)` Invokes `SessionBean.ejbPassivate()` on the target bean and saves the state of the session to a file.
`void` | `removePassivated(Object id)` Removes the saved state file (if any) for the given session id.
`void` | `removeSession(StatefulSessionEnterpriseContext ctx)` Invokes `SessionBean.ejbRemove()` on the target bean.
`void` | `setContainer(Container con)` Saves a reference to the `StatefulSessionContainer` for its bean type.
`void` | `setPurgeEnabled(boolean flag)` Set the stale session state purge enabled flag.
`void` | `setStoreDirectoryName(String dirName)` Set the sub-directory name under the server data directory where session data will be stored.

Methods inherited from class org.jboss.system.ServiceMBeanSupport
`create, destroy, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, startService, stop, stopService`

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.Service
`create, destroy, start, stop`

Methods inherited from interface org.jboss.system.ServiceMBean
`getName, getState, getStateString, jbossInternalLifecycle`

Field Detail

### DEFAULT_STORE_DIRECTORY_NAME

    public static final String DEFAULT_STORE_DIRECTORY_NAME

  The default store directory name ("`sessions`").

  See Also:
    Constant Field Values

Constructor Detail

### StatefulSessionFilePersistenceManager

    public StatefulSessionFilePersistenceManager()

Method Detail

### setContainer

    public void setContainer(Container con)

  Saves a reference to the `StatefulSessionContainer` for its bean type.

  Specified by:
    `setContainer` in interface `ContainerPlugin`
  Parameters:
    `con` - The container using this plugin. This may be null if the plugin is being disassociated from a container.
  Throws:
    `ClassCastException` - Container is not a StatefulSessionContainer.

### setStoreDirectoryName

    public void setStoreDirectoryName(String dirName)

  Set the sub-directory name under the server data directory where session data will be stored.

  This value will be appened to the value of `jboss-server-data-dir`.

  This value is only used during creation and will not dynamically change the store directory when set after the create step has finished.

  Specified by:
    `setStoreDirectoryName` in interface `StatefulSessionFilePersistenceManagerMBean`
  Parameters:
    `dirName` - A sub-directory name.

### getStoreDirectoryName

    public String getStoreDirectoryName()

  Get the sub-directory name under the server data directory where session data is stored. jmx:managed-attribute

  Returns:
    A sub-directory name.
  See Also:
    `setStoreDirectoryName(java.lang.String)`

### setPurgeEnabled

    public void setPurgeEnabled(boolean flag)

  Set the stale session state purge enabled flag. jmx:managed-attribute

  Parameters:
    `flag` - The toggle flag to enable or disable purging.

### getPurgeEnabled

    public boolean getPurgeEnabled()

  Get the stale session state purge enabled flag. jmx:managed-attribute

  Returns:
    True if purge is enabled.

### getStoreDirectory

    public File getStoreDirectory()

  Returns the directory used to store session passivation state files. jmx:managed-attribute

  Returns:
    The directory used to store session passivation state files.

### createService

    protected void createService()
                          throws Exception

  Setup the session data storage directory.

  Purges any existing session data found.

  Throws:
    `Exception`

### destroyService

    protected void destroyService()
                           throws Exception

  Purge any data in the store, and then the store directory too.

  Throws:
    `Exception`

### createId

    public Object createId(StatefulSessionEnterpriseContext ctx)
                    throws Exception

  Description copied from interface: `StatefulSessionPersistenceManager`
  Create a unique identifier for the given SFSB context.

  Specified by:
    `createId` in interface `StatefulSessionPersistenceManager`
  Parameters:
    `ctx` - The context of the SFSB to create an unique identifier for.
  Returns:
    A `UID`.
  Throws:
    `Exception` - Failed to create unique identifier.

### createdSession

    public void createdSession(StatefulSessionEnterpriseContext ctx)
                        throws Exception

  Non-operation.

  Specified by:
    `createdSession` in interface `StatefulSessionPersistenceManager`
  Parameters:
    `ctx` - The context of the SFSB which was created.
  Throws:
    `Exception`

### activateSession

    public void activateSession(StatefulSessionEnterpriseContext ctx)
                         throws RemoteException

  Restores session state from the serialized file & invokes `SessionBean.ejbActivate()` on the target bean.

  Specified by:
    `activateSession` in interface `StatefulSessionPersistenceManager`
  Parameters:
    `ctx` - The context of the SFSB to activate.
  Throws:
    `RemoteException`

### passivateSession

    public void passivateSession(StatefulSessionEnterpriseContext ctx)
                          throws RemoteException

  Invokes `SessionBean.ejbPassivate()` on the target bean and saves the state of the session to a file.

  Specified by:
    `passivateSession` in interface `StatefulSessionPersistenceManager`
  Parameters:
    `ctx` - The context of the SFSB to passivate.
  Throws:
    `RemoteException`

### removeSession

    public void removeSession(StatefulSessionEnterpriseContext ctx)
                       throws RemoteException,
                              javax.ejb.RemoveException

  Invokes `SessionBean.ejbRemove()` on the target bean.

  Specified by:
    `removeSession` in interface `StatefulSessionPersistenceManager`
  Parameters:
    `ctx` - The context of the SFSB to remove.
  Throws:
    `RemoteException`
    `javax.ejb.RemoveException`

### removePassivated

    public void removePassivated(Object id)

  Removes the saved state file (if any) for the given session id.

  Specified by:
    `removePassivated` in interface `StatefulSessionPersistenceManager`
  Parameters:
    `id` - The identifier of the SFSB to remove passivate state for.

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.