public class LibrarySessionPool extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MAXIMUM_POOL_SIZE_DEFAULT
The default pool size.
|
Constructor and Description |
---|
LibrarySessionPool()
Constructs a LibrarySessionPool.
|
LibrarySessionPool(int maxPoolSize)
Constructs a LibrarySessionPool.
|
LibrarySessionPool(int maxPoolSize,
String serviceName,
String appName,
SystemUserCredential cred)
Constructs a LibrarySessionPool.
|
Modifier and Type | Method and Description |
---|---|
LibrarySession |
acquireSession()
Acquires a session from the session pool.
|
void |
activatePool()
Activates the session pool.
|
protected LibrarySession |
constructSession()
Constructs a new LibrarySession.
|
void |
deactivatePool()
De-activates the session pool, by disconnecting all sessions.
|
protected void |
disposeService()
Disposes the LibraryService that this instance is associated with.
|
String |
getApplicationName()
Gets the application name.
|
int |
getMaximumPoolSize()
Gets the maximum pool size setting.
|
String |
getServiceName()
Gets the service name.
|
int |
getSessionConnectCount()
Gets the number of sessions that have been connected.
|
int |
getSessionDisconnectCount()
Gets the number of sessions that have been disconnected.
|
void |
releaseSession(LibrarySession session)
Releases a session back to the session pool.
|
void |
setApplicationName(String appName)
Sets the application name.
|
void |
setMaximumPoolSize(int maxPoolSize)
Updates the maximum session count.
|
void |
setServiceName(String serviceName)
Sets the service name.
|
protected void |
setSessionProperties(LibrarySession session)
Sets up a newly created LibrarySession.
|
void |
setSystemUserCredential(SystemUserCredential cred)
Sets the system user credential
|
public static final int MAXIMUM_POOL_SIZE_DEFAULT
public LibrarySessionPool()
public LibrarySessionPool(int maxPoolSize)
maxPoolSize
- the maximum pool sizepublic LibrarySessionPool(int maxPoolSize, String serviceName, String appName, SystemUserCredential cred)
maxPoolSize
- the maximum number pool sizeserviceName
- the service nameappName
- the application name (for DB connection metadata)cred
- the system user credentialspublic void setMaximumPoolSize(int maxPoolSize)
maxPoolSize
- the maximum pool sizepublic void setServiceName(String serviceName)
serviceName
- the service namepublic void setApplicationName(String appName)
appName
- the application name to associate with the sessionpublic void setSystemUserCredential(SystemUserCredential cred)
cred
- the system user credentialpublic int getMaximumPoolSize()
public String getServiceName()
public String getApplicationName()
public int getSessionConnectCount()
public int getSessionDisconnectCount()
NOTE: this only counts the number of sessions that were disconnected
via calling disconnectSession
on this class. Any sessions
that are disconnected externally are not counted.
public void activatePool()
public void deactivatePool() throws IfsException
IfsException
- if the operation failspublic LibrarySession acquireSession() throws IfsException
IfsException
- if the operation failspublic void releaseSession(LibrarySession session)
session
- session to put back in the poolprotected LibrarySession constructSession() throws IfsException
IfsException
- if the operation failsprotected void setSessionProperties(LibrarySession session) throws IfsException
session
- the newly created sessionIfsException
- if the operation failsprotected void disposeService() throws IfsException
Obviously this is a harsh action, and should only be called by other runtime components (e.g. Node) when indicated.
IfsException
- if the operation failsCopyright © 2023. All rights reserved.