Top Description Fields Constructors Methods
org.hsqldb

public Class SessionManager

extends Object
Class Inheritance
Imports
org.hsqldb.HsqlNameManager.HsqlName, org.hsqldb.lib.Iterator, .LongKeyHashMap, org.hsqldb.rights.User, java.util.concurrent.atomic.AtomicLong, java.util.TimeZone

Container that maintains a map of session id's to Session objects. Responsible for managing opening and closing of sessions.
Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
1.7.2
Version
2.7.3

Field Summary

Modifier and TypeField and Description
pack-priv AtomicLong
private final LongKeyHashMap<Session>
private final Session
private final Session

Constructor Summary

AccessConstructor and Description
public
SessionManager(Database db)

Constructs a new SessionManager handling the specified Database.

Method Summary

Modifier and TypeMethod and Description
pack-priv synchronized void
close()

Closes all sessions and system

public void
closeAllSessions()

Closes all Sessions registered with this SessionManager.

public synchronized Session[]
pack-priv synchronized Session
getSession(long id)

Retrieves the Session with the specified Session identifier or null if no such Session is registered with this SessionManager.

public Session
public Session
getSysSession()

Retrieves the common SYS Session.

public Session
getSysSessionForScript(Database db)

Retrieves a new SYS Session.

public synchronized Session[]
getVisibleSessions(Session session)

Retrieves a list of the Sessions in this container that are visible to the specified Session, given the access rights of the Session User.

pack-priv synchronized boolean
isEmpty()

Returns true if no session exists beyond the sys session.

public synchronized boolean
isUserActive(String userName)

public synchronized Session

Returns:

Session
newSession
(Database
the database to which the new Session is initially connected
db
,
User
the Session User
user
,
boolean
the ReadOnly attribute for the new Session
readonly
,
boolean autoCommit, TimeZone
the session time zone
zone
)

Binds the specified Session object into this SessionManager's active Session registry.

public synchronized Session
public synchronized Session
newSysSession()

Retrieves a transient transaction session.

public synchronized Session
public synchronized void
pack-priv synchronized void
removeSession(Session session)

Removes the session from management and disconnects.

public synchronized void
public synchronized long
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

sessionIdCountback to summary
pack-priv AtomicLong sessionIdCount
sessionMapback to summary
private final LongKeyHashMap<Session> sessionMap
sysLobSessionback to summary
private final Session sysLobSession
sysSessionback to summary
private final Session sysSession

Constructor Detail

SessionManagerback to summary
public SessionManager(Database db)

Constructs a new SessionManager handling the specified Database. Creates a SYS User.

Method Detail

closeback to summary
pack-priv synchronized void close()

Closes all sessions and system

closeAllSessionsback to summary
public void closeAllSessions()

Closes all Sessions registered with this SessionManager.

getAllSessionsback to summary
public synchronized Session[] getAllSessions()
getSessionback to summary
pack-priv synchronized Session getSession(long id)

Retrieves the Session with the specified Session identifier or null if no such Session is registered with this SessionManager.

getSysLobSessionback to summary
public Session getSysLobSession()
getSysSessionback to summary
public Session getSysSession()

Retrieves the common SYS Session.

getSysSessionForScriptback to summary
public Session getSysSessionForScript(Database db)

Retrieves a new SYS Session.

getVisibleSessionsback to summary
public synchronized Session[] getVisibleSessions(Session session)

Retrieves a list of the Sessions in this container that are visible to the specified Session, given the access rights of the Session User.

isEmptyback to summary
pack-priv synchronized boolean isEmpty()

Returns true if no session exists beyond the sys session.

isUserActiveback to summary
public synchronized boolean isUserActive(String userName)
newSessionback to summary
public synchronized Session newSession(Database db, User user, boolean readonly, boolean autoCommit, TimeZone zone)

Binds the specified Session object into this SessionManager's active Session registry. This method is typically called internally as the final step, when a successful connection has been made.

Parameters
db:Database

the database to which the new Session is initially connected

user:User

the Session User

readonly:boolean

the ReadOnly attribute for the new Session

zone:TimeZone

the session time zone

Returns:Session

Session

newSessionForLogback to summary
public synchronized Session newSessionForLog(Database db)
newSysSessionback to summary
public synchronized Session newSysSession()

Retrieves a transient transaction session.

newSysSessionback to summary
public synchronized Session newSysSession(HsqlNameManager.HsqlName schema, User user)
removeSchemaReferenceback to summary
public synchronized void removeSchemaReference(HsqlNameManager.HsqlName schemaName)
removeSessionback to summary
pack-priv synchronized void removeSession(Session session)

Removes the session from management and disconnects.

resetLoggedSchemasback to summary
public synchronized void resetLoggedSchemas()
resetNewLobIDsback to summary
public synchronized long resetNewLobIDs()