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 maxSize, int maxTotalSize, long maxIdleMinutes, long maxUsageMinutes) Creates a multi-user session pool. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(SessionInfo sessionInfo) Closes all sessions currently open for a 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 a 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.protected booleanisPooledDbRemovable(PooledDb pooledDb) 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.booleanReturns whether the pool is shutdown.voidReturns a session back 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 maxSize, int maxTotalSize, long maxIdleMinutes, long maxUsageMinutes) 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 sessionsmaxSize- the maximum number of sessions per session info, 0 = unlimitedmaxTotalSize- the maximum total number of sessions, 0 = unlimitedmaxIdleMinutes- the idle timeout in minutes to close unused sessions per session info, 0 = unlimitedmaxUsageMinutes- the max. used time in minutes per session info, 0 = unlimited
-
-
Method Details
-
get
Description copied from interface:MultiUserSessionPoolGets a session from the pool for a 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 back 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 a 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
-
getMaxSize
public int getMaxSize()Description copied from interface:MultiUserSessionPoolGets the maximum pool size per session info.- Specified by:
getMaxSizein interfaceMultiUserSessionPool- Returns:
- the max. number of concurrent session instances, 0 = unlimited
-
getMaxTotalSize
public int getMaxTotalSize()Description copied from interface:MultiUserSessionPoolGets the maximum pool size for all sessions.- Specified by:
getMaxTotalSizein 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
-
isPooledDbRemovable
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:
pooledDb- the pooled session- Returns:
- true if it can be removed
-