Class JDBCSessionIdManager

  • All Implemented Interfaces:
    SessionIdManager, org.eclipse.jetty.util.component.LifeCycle

    public class JDBCSessionIdManager
    extends AbstractSessionIdManager
    JDBCSessionIdManager SessionIdManager implementation that uses a database to store in-use session ids, to support distributed sessions.
    • Field Detail

      • _server

        protected Server _server
      • _driver

        protected Driver _driver
      • _driverClassName

        protected String _driverClassName
      • _connectionUrl

        protected String _connectionUrl
      • _jndiName

        protected String _jndiName
      • _deleteBlockSize

        protected int _deleteBlockSize
      • _task

        protected org.eclipse.jetty.util.thread.Scheduler.Task _task
      • _scheduler

        protected org.eclipse.jetty.util.thread.Scheduler _scheduler
      • _ownScheduler

        protected boolean _ownScheduler
      • _lastScavengeTime

        protected long _lastScavengeTime
      • _scavengeIntervalMs

        protected long _scavengeIntervalMs
      • _createSessionIdTable

        protected String _createSessionIdTable
      • _createSessionTable

        protected String _createSessionTable
      • _selectBoundedExpiredSessions

        protected String _selectBoundedExpiredSessions
      • _insertId

        protected String _insertId
      • _deleteId

        protected String _deleteId
      • _queryId

        protected String _queryId
      • _insertSession

        protected String _insertSession
      • _deleteSession

        protected String _deleteSession
      • _updateSession

        protected String _updateSession
      • _updateSessionNode

        protected String _updateSessionNode
      • _updateSessionAccessTime

        protected String _updateSessionAccessTime
    • Constructor Detail

      • JDBCSessionIdManager

        public JDBCSessionIdManager​(Server server)
      • JDBCSessionIdManager

        public JDBCSessionIdManager​(Server server,
                                    Random random)
    • Method Detail

      • setDriverInfo

        public void setDriverInfo​(String driverClassName,
                                  String connectionUrl)
        Configure jdbc connection information via a jdbc Driver
        Parameters:
        driverClassName - the driver classname
        connectionUrl - the driver connection url
      • setDriverInfo

        public void setDriverInfo​(Driver driverClass,
                                  String connectionUrl)
        Configure jdbc connection information via a jdbc Driver
        Parameters:
        driverClass - the driver class
        connectionUrl - the driver connection url
      • setDatasource

        public void setDatasource​(DataSource ds)
      • getDataSource

        public DataSource getDataSource()
      • getDriverClassName

        public String getDriverClassName()
      • getConnectionUrl

        public String getConnectionUrl()
      • setDatasourceName

        public void setDatasourceName​(String jndi)
      • getDatasourceName

        public String getDatasourceName()
      • setBlobType

        @Deprecated
        public void setBlobType​(String name)
        Deprecated.
        see DbAdaptor.setBlobType
        Parameters:
        name - the name of the blob
      • getBlobType

        @Deprecated
        public String getBlobType()
        Deprecated.
        see DbAdaptor.getBlobType
        Returns:
        the blob type
      • getLongType

        @Deprecated
        public String getLongType()
        Deprecated.
        see DbAdaptor.getLogType
        Returns:
        the long type
      • setLongType

        @Deprecated
        public void setLongType​(String longType)
        Deprecated.
        see DbAdaptor.setLongType
        Parameters:
        longType - the long type
      • setDeleteBlockSize

        public void setDeleteBlockSize​(int bsize)
      • getDeleteBlockSize

        public int getDeleteBlockSize()
      • setScavengeInterval

        public void setScavengeInterval​(long sec)
      • getScavengeInterval

        public long getScavengeInterval()
      • addSession

        public void addSession​(javax.servlet.http.HttpSession session)
        Description copied from interface: SessionIdManager
        Add a session to the list of known sessions for a given ID.
        Parameters:
        session - The session
      • addSession

        public void addSession​(String id)
      • removeSession

        public void removeSession​(javax.servlet.http.HttpSession session)
        Description copied from interface: SessionIdManager
        Remove session from the list of known sessions for a given ID.
        Parameters:
        session - the session to remove
      • removeSession

        public void removeSession​(String id)
      • idInUse

        public boolean idInUse​(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.
      • getConnection

        protected Connection getConnection()
                                    throws SQLException
        Get a connection from the driver or datasource.
        Returns:
        the connection for the datasource
        Throws:
        SQLException - if unable to get the connection