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.eclipse.jetty.server.session
Class JDBCSessionIdManager

    java.lang.Object
      org.eclipse.jetty.util.component.AbstractLifeCycle
          org.eclipse.jetty.server.session.AbstractSessionIdManager
              org.eclipse.jetty.server.session.JDBCSessionIdManager

All Implemented Interfaces:
  SessionIdManager, LifeCycle

    public class JDBCSessionIdManager

extends AbstractSessionIdManager

JDBCSessionIdManager SessionIdManager implementation that uses a database to store in-use session ids, to support distributed sessions.

Nested Class Summary
`class` | `JDBCSessionIdManager.DatabaseAdaptor` DatabaseAdaptor Handles differences between databases.

Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`AbstractLifeCycle.AbstractLifeCycleListener`

Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
`LifeCycle.Listener`

Field Summary
`protected java.lang.String` | `_blobType`
`protected java.lang.String` | `_connectionUrl`
`protected java.lang.String` | `_createSessionIdTable`
`protected java.lang.String` | `_createSessionTable`
`protected javax.sql.DataSource` | `_datasource`
`protected JDBCSessionIdManager.DatabaseAdaptor` | `_dbAdaptor`
`protected java.lang.String` | `_deleteId`
`protected java.lang.String` | `_deleteOldExpiredSessions`
`protected java.lang.String` | `_driverClassName`
`protected java.lang.String` | `_insertId`
`protected java.lang.String` | `_jndiName`
`protected long` | `_lastScavengeTime`
`protected java.lang.String` | `_queryId`
`protected long` | `_scavengeIntervalMs`
`protected java.lang.String` | `_selectExpiredSessions`
`protected Server` | `_server`
`protected java.util.HashSet<java.lang.String>` | `_sessionIds`
`protected java.lang.String` | `_sessionIdTable`
`protected java.lang.String` | `_sessionTable`
`protected java.lang.String` | `_sessionTableRowId`
`protected java.util.TimerTask` | `_task`
`protected java.util.Timer` | `_timer`

Fields inherited from class org.eclipse.jetty.server.session.AbstractSessionIdManager
`_random, _weakRandom, _workerName`

Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING`

Constructor Summary
`JDBCSessionIdManager(Server server)`
`JDBCSessionIdManager(Server server, java.util.Random random)`

Method Summary
`void` | `addSession(HttpSession session)` Add a session to the list of known sessions for a given ID.
`void` | `doStart()` Start up the id manager.
`void` | `doStop()` Stop the scavenger.
`java.lang.String` | `getBlobType()`
`java.lang.String` | `getClusterId(java.lang.String nodeId)` Get the session id without any node identifier suffix.
`protected java.sql.Connection` | `getConnection()` Get a connection from the driver or datasource.
`java.lang.String` | `getConnectionUrl()`
`java.lang.String` | `getDatasourceName()`
`java.lang.String` | `getDriverClassName()`
`java.lang.String` | `getNodeId(java.lang.String clusterId, HttpServletRequest request)` Get the session id, including this node's id as a suffix.
`long` | `getScavengeInterval()`
`boolean` | `idInUse(java.lang.String id)`
`void` | `invalidateAll(java.lang.String id)` Invalidate the session matching the id on all contexts.
`void` | `removeSession(HttpSession session)` Remove session from the list of known sessions for a given ID.
`void` | `removeSession(java.lang.String id)`
`void` | `setBlobType(java.lang.String name)`
`void` | `setDatasourceName(java.lang.String jndi)`
`void` | `setDriverInfo(java.lang.String driverClassName, java.lang.String connectionUrl)` Configure jdbc connection information via a jdbc Driver
`void` | `setScavengeInterval(long sec)`

Methods inherited from class org.eclipse.jetty.server.session.AbstractSessionIdManager
`getRandom, getWorkerName, initRandom, newSessionId, setRandom, setWorkerName`

Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
`addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

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

Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
`addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop`

Field Detail

### _sessionIds

    protected final java.util.HashSet<java.lang.String> _sessionIds

### _server

    protected Server _server

### _driverClassName

    protected java.lang.String _driverClassName

### _connectionUrl

    protected java.lang.String _connectionUrl

### _datasource

    protected javax.sql.DataSource _datasource

### _jndiName

    protected java.lang.String _jndiName

### _sessionIdTable

    protected java.lang.String _sessionIdTable

### _sessionTable

    protected java.lang.String _sessionTable

### _sessionTableRowId

    protected java.lang.String _sessionTableRowId

### _timer

    protected java.util.Timer _timer

### _task

    protected java.util.TimerTask _task

### _lastScavengeTime

    protected long _lastScavengeTime

### _scavengeIntervalMs

    protected long _scavengeIntervalMs

### _blobType

    protected java.lang.String _blobType

### _createSessionIdTable

    protected java.lang.String _createSessionIdTable

### _createSessionTable

    protected java.lang.String _createSessionTable

### _selectExpiredSessions

    protected java.lang.String _selectExpiredSessions

### _deleteOldExpiredSessions

    protected java.lang.String _deleteOldExpiredSessions

### _insertId

    protected java.lang.String _insertId

### _deleteId

    protected java.lang.String _deleteId

### _queryId

    protected java.lang.String _queryId

### _dbAdaptor

    protected JDBCSessionIdManager.DatabaseAdaptor _dbAdaptor

Constructor Detail

### JDBCSessionIdManager

    public JDBCSessionIdManager(Server server)

### JDBCSessionIdManager

    public JDBCSessionIdManager(Server server,
                                java.util.Random random)

Method Detail

### setDriverInfo

    public void setDriverInfo(java.lang.String driverClassName,
                              java.lang.String connectionUrl)

  Configure jdbc connection information via a jdbc Driver

  Parameters:
    `driverClassName` -
    `connectionUrl` -

### getDriverClassName

    public java.lang.String getDriverClassName()

### getConnectionUrl

    public java.lang.String getConnectionUrl()

### setDatasourceName

    public void setDatasourceName(java.lang.String jndi)

### getDatasourceName

    public java.lang.String getDatasourceName()

### setBlobType

    public void setBlobType(java.lang.String name)

### getBlobType

    public java.lang.String getBlobType()

### setScavengeInterval

    public void setScavengeInterval(long sec)

### getScavengeInterval

    public long getScavengeInterval()

### addSession

    public void addSession(HttpSession session)

  Description copied from interface: `SessionIdManager`
  Add a session to the list of known sessions for a given ID.

  Parameters:
    `session` - The session

### removeSession

    public void removeSession(HttpSession session)

  Description copied from interface: `SessionIdManager`
  Remove session from the list of known sessions for a given ID.

### removeSession

    public void removeSession(java.lang.String id)

### getClusterId

    public java.lang.String getClusterId(java.lang.String nodeId)

  Get the session id without any node identifier suffix.

  Returns:
    the cluster id
  See Also:
    `SessionIdManager.getClusterId(java.lang.String)`

### getNodeId

    public java.lang.String getNodeId(java.lang.String clusterId,
                                      HttpServletRequest request)

  Get the session id, including this node's id as a suffix.

  Parameters:
    `clusterId` - The ID of the session
    `request` - The request that for the session (or null)
  Returns:
    The session ID qualified with the node ID.
  See Also:
    `SessionIdManager.getNodeId(java.lang.String, javax.servlet.http.HttpServletRequest)`

### idInUse

    public boolean idInUse(java.lang.String id)

  Parameters:
    `id` - The session ID without any cluster node extension
  Returns:
    True if the session ID is in use by at least one context.

### invalidateAll

    public void invalidateAll(java.lang.String id)

  Invalidate the session matching the id on all contexts.

  Parameters:
    `id` - The session ID without any cluster node extension
  See Also:
    `SessionIdManager.invalidateAll(java.lang.String)`

### doStart

    public void doStart()

  Start up the id manager. Makes necessary database tables and starts a Session scavenger thread.

  Overrides:
    `doStart` in class `AbstractSessionIdManager`

### doStop

    public void doStop()
                throws java.lang.Exception

  Stop the scavenger.

  Overrides:
    `doStop` in class `AbstractSessionIdManager`
  Throws:
    `java.lang.Exception`

### getConnection

    protected java.sql.Connection getConnection()
                                         throws java.sql.SQLException

  Get a connection from the driver or datasource.

  Returns:
    the connection for the datasource
  Throws:
    `java.sql.SQLException`

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 © 1995-2010 Mort Bay Consulting. All Rights Reserved.