## org.apache.catalina.session
Class StoreBase

    java.lang.Object
      org.apache.catalina.session.StoreBase

All Implemented Interfaces:
  Lifecycle, java.lang.Runnable, Store

Direct Known Subclasses:
  FileStore, JDBCStore

public abstract class StoreBase
extends java.lang.Object
implements Lifecycle, java.lang.Runnable, Store

Abstract implementation of the Store interface to support most of the functionality required by a Store.

Version:
  $Revision: 466595 $, $Date: 2006-10-21 23:24:41 +0100 (Sat, 21 Oct 2006) $
Author:
  Bip Thelin

Field Summary
`protected int` `checkInterval` The interval (in seconds) between checks for expired sessions.
`protected int` `debug` The debugging detail level for this component.
`protected static java.lang.String` `info` The descriptive information about this implementation.
`protected LifecycleSupport` `lifecycle` The lifecycle event support for this component.
`protected Manager` `manager` The Manager with which this JDBCStore is associated.
`protected StringManager` `sm` The string manager for this package.
`protected boolean` `started` Has this component been started yet?
`protected static java.lang.String` `storeName` Name to register for this Store, used for logging.
`protected java.beans.PropertyChangeSupport` `support` The property change support for this component.
`protected java.lang.Thread` `thread` The background thread.
`protected boolean` `threadDone` The background thread completion semaphore.
`protected java.lang.String` `threadName` Name to register for the background thread.

Fields inherited from interface org.apache.catalina.Lifecycle
`AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, START_EVENT, STOP_EVENT`

Constructor Summary
`StoreBase()`

Method Summary
`void` `addLifecycleListener(LifecycleListener listener)` Add a lifecycle event listener to this component.
`void` `addPropertyChangeListener(java.beans.PropertyChangeListener listener)` Add a property change listener to this component.
`LifecycleListener[]` `findLifecycleListeners()` Get the lifecycle listeners associated with this lifecycle.
`int` `getCheckInterval()` Return the check interval (in seconds) for this Store.
`int` `getDebug()` Return the debugging detail level for this Store.
`java.lang.String` `getInfo()` Return the info for this Store.
`Manager` `getManager()` Return the Manager with which the Store is associated.
`java.lang.String` `getStoreName()` Return the name for this Store, used for logging.
`java.lang.String` `getThreadName()` Return the thread name for this Store.
`protected void` `log(java.lang.String message)` Log a message on the Logger associated with our Container (if any).
`protected void` `processExpires()` Called by our background reaper thread to check if Sessions saved in our store are subject of being expired.
`void` `removeLifecycleListener(LifecycleListener listener)` Remove a lifecycle event listener from this component.
`void` `removePropertyChangeListener(java.beans.PropertyChangeListener listener)` Remove a property change listener from this component.
`void` `run()` The background thread that checks for session timeouts and shutdown.
`void` `setCheckInterval(int checkInterval)` Set the check interval (in seconds) for this Store.
`void` `setDebug(int debug)` Set the debugging detail level for this Store.
`void` `setManager(Manager manager)` Set the Manager with which this Store is associated.
`void` `start()` Prepare for the beginning of active use of the public methods of this component.
`void` `stop()` Gracefully terminate the active use of the public methods of this component.
`protected void` `threadSleep()` Sleep for the duration specified by the `checkInterval` property.
`protected void` `threadStart()` Start the background thread that will periodically check for session timeouts.
`protected void` `threadStop()` Stop the background thread that is periodically checking for session timeouts.

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

Methods inherited from interface org.apache.catalina.Store
`clear, getSize, keys, load, remove, save`

Field Detail

### info

    protected static java.lang.String info

  The descriptive information about this implementation.

### checkInterval

    protected int checkInterval

  The interval (in seconds) between checks for expired sessions.

### threadName

    protected java.lang.String threadName

  Name to register for the background thread.

### storeName

    protected static java.lang.String storeName

  Name to register for this Store, used for logging.

### thread

    protected java.lang.Thread thread

  The background thread.

### threadDone

    protected boolean threadDone

  The background thread completion semaphore.

### debug

    protected int debug

  The debugging detail level for this component.

### started

    protected boolean started

  Has this component been started yet?

### lifecycle

    protected LifecycleSupport lifecycle

  The lifecycle event support for this component.

### support

    protected java.beans.PropertyChangeSupport support

  The property change support for this component.

### sm

    protected StringManager sm

  The string manager for this package.

### manager

    protected Manager manager

  The Manager with which this JDBCStore is associated.

Constructor Detail

### StoreBase

    public StoreBase()

Method Detail

### getInfo

    public java.lang.String getInfo()

  Return the info for this Store.

  Specified by:
    `getInfo` in interface `Store`

### getThreadName

    public java.lang.String getThreadName()

  Return the thread name for this Store.

### getStoreName

    public java.lang.String getStoreName()

  Return the name for this Store, used for logging.

### setDebug

    public void setDebug(int debug)

  Set the debugging detail level for this Store.

  Parameters:
    `debug` - The new debugging detail level

### getDebug

    public int getDebug()

  Return the debugging detail level for this Store.

### setCheckInterval

    public void setCheckInterval(int checkInterval)

  Set the check interval (in seconds) for this Store.

  Parameters:
    `checkInterval` - The new check interval

### getCheckInterval

    public int getCheckInterval()

  Return the check interval (in seconds) for this Store.

### setManager

    public void setManager(Manager manager)

  Set the Manager with which this Store is associated.

  Specified by:
    `setManager` in interface `Store`
  Parameters:
    `manager` - The newly associated Manager

### getManager

    public Manager getManager()

  Return the Manager with which the Store is associated.

  Specified by:
    `getManager` in interface `Store`

### addLifecycleListener

    public void addLifecycleListener(LifecycleListener listener)

  Add a lifecycle event listener to this component.

  Specified by:
    `addLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to add

### findLifecycleListeners

    public LifecycleListener[] findLifecycleListeners()

  Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.

  Specified by:
    `findLifecycleListeners` in interface `Lifecycle`

### removeLifecycleListener

    public void removeLifecycleListener(LifecycleListener listener)

  Remove a lifecycle event listener from this component.

  Specified by:
    `removeLifecycleListener` in interface `Lifecycle`
  Parameters:
    `listener` - The listener to add

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

  Add a property change listener to this component.

  Specified by:
    `addPropertyChangeListener` in interface `Store`
  Parameters:
    `listener` - a value of type 'PropertyChangeListener'

### removePropertyChangeListener

    public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

  Remove a property change listener from this component.

  Specified by:
    `removePropertyChangeListener` in interface `Store`
  Parameters:
    `listener` - The listener to remove

### processExpires

    protected void processExpires()

  Called by our background reaper thread to check if Sessions saved in our store are subject of being expired. If so expire the Session and remove it from the Store.

### log

    protected void log(java.lang.String message)

  Log a message on the Logger associated with our Container (if any).

  Parameters:
    `message` - Message to be logged

### run

    public void run()

  The background thread that checks for session timeouts and shutdown.

  Specified by:
    `run` in interface `java.lang.Runnable`

### start

    public void start()
               throws LifecycleException

  Prepare for the beginning of active use of the public methods of this component. This method should be called after `configure()`, and before any of the public methods of the component are utilized.

  Specified by:
    `start` in interface `Lifecycle`
  Throws:
    `LifecycleException` - if this component detects a fatal error that prevents this component from being used

### stop

    public void stop()
              throws LifecycleException

  Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.

  Specified by:
    `stop` in interface `Lifecycle`
  Throws:
    `LifecycleException` - if this component detects a fatal error that needs to be reported

### threadStart

    protected void threadStart()

  Start the background thread that will periodically check for session timeouts.

### threadSleep

    protected void threadSleep()

  Sleep for the duration specified by the `checkInterval` property.

### threadStop

    protected void threadStop()

  Stop the background thread that is periodically checking for session timeouts.

Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.