public class SessionPoolingData extends Object implements Runnable
DefaultSessionPoolingHandler in the static method createSessionPoolingData.| Modifier and Type | Field and Description |
|---|---|
JDesktopPane | desktopPaneThe JDesktopPane used for the Server GUI (null if no GUI is displayed). |
Node | firstChildThe child nodes in the XML file data. |
static String[] | functionsThe names of the internal functions. |
int | hostIDThe host ID used (zero is 'A', i.e. |
Class<?> | implClassThe pool implementing class. |
int | maxSessionsThe maximum amount of sessions in the pool. |
int | minSessionsThe minimum amount of sessions in the pool. |
int | pingTimeThe ping time in seconds (zero or negative value for none). |
String | poolNameThe pool name. |
PhantomRuntime | runtimeThe runtime application data (null if none is used). |
String | runtimeIDThe runtime ID used for this pool. |
static int | SCRIPT_CHECKThe script method indexes: . |
static int | SCRIPT_DISPOSEThe script method indexes: dispose. |
static int | SCRIPT_PINGThe script method indexes: ping. |
static int | SCRIPT_RECLAIMThe script method indexes: reclaim. |
static int | SCRIPT_STARTThe script method indexes: start. |
String | scriptFileThe name of the XML script file. |
String[] | scriptNamesThe array contains the script names in the index order of the table of Element for the scripts. |
| Constructor and Description |
|---|
SessionPoolingData(String runtimeID, int hostID, int minSessions, int maxSessions, int pingTime, String scriptFile, PhantomRuntime runtime, Class<?> implClass, Node firstChild, JDesktopPane desktopPane)Creates the session pooling data instance. |
| Modifier and Type | Method and Description |
|---|---|
void | closeAllSessions(ClientSessionManager csm, boolean nicely)Closes "nicely" or not all the started sessions in the pool. |
void | dispose(ClientSessionManager csm, boolean nicely)Disposes "nicely" or not all the started sessions in the pool. |
boolean | executeScript(DefaultSessionPoolingHandler handler, int scriptIndex)Executes the specified script index (SCRIPT_nnn value). |
Method | getScriptTagMethod(String name)Gets a method from a script tag in the global pool data. |
protected boolean | getScriptTags()Gets the action scripts in a script file. |
Enumeration<DefaultSessionPoolingHandler> | getSessions()Gets all the started sessions. |
DefaultSessionPoolingHandler | grabSessionFromPool()Checks if there is a session pooling handler that can be used for this client session. |
boolean | isEnabled()Checks if a session pool is enabled or not. |
boolean | isReclaimRequired()Checks if a session should be reclaimed to the pool. |
protected void | logError(String txt)Logs an session pooling error event in the event log. |
protected void | logInfo(String txt)Logs an session pooling informational event in the event log. |
protected void | logWarning(String txt)Logs an session pooling warning event in the event log. |
protected void | registerInternalMethods()Registers all internal methods in the implementing script class. |
boolean | registerScriptMethod(Class<?> clazz, String methodName, String scriptName)This function registers a script method in the table. |
protected boolean | registerXMLScriptMethods()This function registers all script methods defined in the XML file. |
void | run()The session pooling ping thread. |
void | sessionDisposed(DefaultSessionPoolingHandler handler)Notifies that a session has been disposed of. |
void | sessionStarted()Notifies that a session has started correctly. |
void | setEnabled(boolean enable)Changes the enabled state of this pool. |
boolean | terminateSession(long connectionID)Terminates a single session. |
protected void | trace(String txt)Adds a trace output for session pooling if client verbose trace is turned on. |
public final String[] scriptNames
Element for the scripts. The names are case sensitive, as well as the parameters.public static final String[] functions
public static final int SCRIPT_START
public static final int SCRIPT_PING
public static final int SCRIPT_CHECK
public static final int SCRIPT_RECLAIM
public static final int SCRIPT_DISPOSE
public final String runtimeID
public final int hostID
public final int minSessions
public final int maxSessions
public final int pingTime
public final String scriptFile
public final PhantomRuntime runtime
public final Class<?> implClass
public final Node firstChild
public final JDesktopPane desktopPane
public final String poolName
public SessionPoolingData(String runtimeID, int hostID, int minSessions, int maxSessions, int pingTime, String scriptFile, PhantomRuntime runtime, Class<?> implClass, Node firstChild, JDesktopPane desktopPane)
This method cannot be overridden. For an extending class containing extra data members, the final variables runtimeID, hostID, minSessions, maxSessions, pingTime, runtime, implClass, firstChild, desktopPane and poolName must be initialized in the new constructor.
protected void trace(String txt)
protected void logError(String txt)
protected void logWarning(String txt)
protected void logInfo(String txt)
public final void closeAllSessions(ClientSessionManager csm, boolean nicely)
There is an inactivity timer that will kill the server if the method aliveNotification in the ClientSessionManager csm parameter that should be called at intervals e.g. when a session is about to be disposed.
This call blocks the caller thread until all sessions are stopped.
public final void dispose(ClientSessionManager csm, boolean nicely)
There is an inactivety timer that will kill the server if the method aliveNotification in the ClientSessionManager csm parameter that should be called at intervals e.g. when a session is about to be disposed.
This call blocks the caller thread until all sessions are stopped.
public boolean isEnabled()
public final void setEnabled(boolean enable)
When enabled, this includes starting the minimum amount of sessions.
public void sessionStarted()
public final void sessionDisposed(DefaultSessionPoolingHandler handler)
public Enumeration<DefaultSessionPoolingHandler> getSessions()
DefaultSessionPoolingHandler elements.DefaultSessionPoolingHandler elements.public boolean isReclaimRequired()
public DefaultSessionPoolingHandler grabSessionFromPool()
public boolean terminateSession(long connectionID)
protected void registerInternalMethods()
protected boolean registerXMLScriptMethods()
SessionPoolingScriptData. The name of the method is case insensitive in the script, but not when it is registered (the name must match a method in the declaring class).If the class registering the method is not an extended class from DefaultSessionPoolingHandler, then it must implement the interface SessionPoolingScriptMethodInterface that defines methods that will be called when the object is instantiated for each individual session in the pool.
protected boolean getScriptTags()
public Method getScriptTagMethod(String name)
Method instance.public boolean executeScript(DefaultSessionPoolingHandler handler, int scriptIndex) throws SessionPoolingDisposed
If the script is not defined in the XML file, true is returned.
SessionPoolingDisposed - if the session is disposed.public boolean registerScriptMethod(Class<?> clazz, String methodName, String scriptName)
SessionPoolingScriptData. The name of the method is case insensitive in the script, but not when it is registered (the name must match a method in the declaring class).If the class registering the method is not an extended class from DefaultSessionPoolingHandler, then it must implement the interface SessionPoolingScriptMethodInterface that defines methods that will be called when the object is instantiated for each individual session in the pool.
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© 2026 Mindus SARL. All rights reserved.