Class MultiUserDbPool
java.lang.Object
org.tentackle.dbms.MultiUserDbPool
- All Implemented Interfaces:
MultiUserSessionPool
Implementation of a
The pool is actually a pool of
MultiUserSessionPool.The pool is actually a pool of
DbPools, one for each SessionInfo.-
Constructor Summary
ConstructorsConstructorDescriptionMultiUserDbPool(String name, ConnectionManager conMgr, int sessionGroupId, int maximumSize, int maximumTotalSize, long idleMinutes, long usageMinutes) Creates a multi-user session pool. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(SessionInfo sessionInfo) Closes all sessions currently open for given session info.
Useful to force logout for a user.
It is not an error if there were no open sessions for the session info at all.protected booleandetermineSessionCloned(SessionInfo sessionInfo, DbPool pool) Determines whether the next session to open should be cloned or not.get(SessionInfo sessionInfo) Gets a session from the pool for given session info.intGets the maximum pool size per session info.intGets the maximum pool size for all sessions.getName()Gets the name of this pool.intgetSize()Gets the current number of session instances.booleanReturns whether the pool is shutdown.protected booleanisSlotRemovable(PoolSlot<Session> slot) Determines whether the given pooled session can be removed from the pool due to timeout.
This method is provided to override the default inDbPool, which is used a private subclass inMultiUserDbPool.voidReturns a session to the pool.
Returning a closed session will remove it from the pool.voidshutdown()Closes all sessions in the pool, cleans up, and makes the pool unusable.
-
Constructor Details
-
MultiUserDbPool
public MultiUserDbPool(String name, ConnectionManager conMgr, int sessionGroupId, int maximumSize, int maximumTotalSize, long idleMinutes, long usageMinutes) Creates a multi-user session pool.- Parameters:
name- the name of the pool, null if "default-multi"conMgr- the connection manager for local sessions, null if remotesessionGroupId- the session group ID to use for all sessionsmaximumSize- the maximum number of sessions per session info, 0 = unlimitedmaximumTotalSize- the maximum total number of sessions, 0 = unlimitedidleMinutes- the idle timeout in minutes to close unused sessions per session info, 0 = unlimitedusageMinutes- the maximum used time in minutes per session info, 0 = unlimited
-
-
Method Details
-
get
Description copied from interface:MultiUserSessionPoolGets a session from the pool for given session info.- Specified by:
getin interfaceMultiUserSessionPool- Parameters:
sessionInfo- the session info- Returns:
- the session, never null
-
put
Description copied from interface:MultiUserSessionPoolReturns a session to the pool.
Returning a closed session will remove it from the pool.- Specified by:
putin interfaceMultiUserSessionPool- Parameters:
session- the session
-
close
Description copied from interface:MultiUserSessionPoolCloses all sessions currently open for given session info.
Useful to force logout for a user.
It is not an error if there were no open sessions for the session info at all.- Specified by:
closein interfaceMultiUserSessionPool- Parameters:
sessionInfo- the session info
-
getName
Description copied from interface:MultiUserSessionPoolGets the name of this pool.- Specified by:
getNamein interfaceMultiUserSessionPool- Returns:
- the name
-
getMaximumSize
public int getMaximumSize()Description copied from interface:MultiUserSessionPoolGets the maximum pool size per session info.- Specified by:
getMaximumSizein interfaceMultiUserSessionPool- Returns:
- the max. number of concurrent session instances, 0 = unlimited
-
getMaximumTotalSize
public int getMaximumTotalSize()Description copied from interface:MultiUserSessionPoolGets the maximum pool size for all sessions.- Specified by:
getMaximumTotalSizein interfaceMultiUserSessionPool- Returns:
- the max. number of concurrent session instances, 0 = unlimited
-
getSize
public int getSize()Description copied from interface:MultiUserSessionPoolGets the current number of session instances.- Specified by:
getSizein interfaceMultiUserSessionPool- Returns:
- the number of sessions managed by this pool
-
shutdown
public void shutdown()Description copied from interface:MultiUserSessionPoolCloses all sessions in the pool, cleans up, and makes the pool unusable.- Specified by:
shutdownin interfaceMultiUserSessionPool
-
isShutdown
public boolean isShutdown()Description copied from interface:MultiUserSessionPoolReturns whether the pool is shutdown.- Specified by:
isShutdownin interfaceMultiUserSessionPool- Returns:
- true if shutdown
-
determineSessionCloned
Determines whether the next session to open should be cloned or not.- Parameters:
sessionInfo- the session info requestedpool- the session pool for the given session info- Returns:
- true to be cloned
-
isSlotRemovable
Determines whether the given pooled session can be removed from the pool due to timeout.
This method is provided to override the default inDbPool, which is used a private subclass inMultiUserDbPool.- Parameters:
slot- the pool's session slot- Returns:
- true if it can be removed
-