logo
25.1
search
No matching documents found.
list
search
No matching documents found.
logo

Session Pool

Session Pool is a simple JAR application. The main purpose of this module is to start, manage and communicate with an application instance. It connects to a Cluster Server via a WebSocket and it is always connected to all Cluster Servers in the Cluster. It is not desired that there is a connection problem between a Session Pool and a Cluster Server and this kind of problem should be resolved ASAP.

Unlike Cluster Server, Session Pool is stateful. When a Session Pool encounters a fatal error which leads to termination, all of the application instance processes that this Session Pool has created will be terminated as well.

Session Pool can be configured using webswing-sesionpool.properties file. The table below describes the properties used in the file.

Property Description Default value
webswing.connection.secret Secret string for securing user sessions and websocket connections used by Webswing server. Should be a 128 characters long string. Use the same secret for every module inside cluster.
webswing.connection.secret.file Alternative way to specify secret string in a file.
sessionpool.id Id of the session pool. Will be generated if not provided.
sessionpool.priority Optional priority. Higher number means higher priority, you can use this value in a custom session pool load balancer algorithm in cluster server. 1
sessionpool.instances.max Maximum pool size. This is an overall maximum of all instances in the session pool. Set -1 for infinite. -1
sessionpool.reconnect.interval Reconnect interval (seconds) if session pool loses connection to cluster server. Use -1 for infinite interval.
Session pool will shut down if there are no active connections to cluster server.
60
sessionpool.reconnect.retries Number of retries to reconnect to a cluster server after session pool loses connection.
Session pool will shut down if there are no active connections to cluster server.
5
sessionpool.reconnect.delay Delay (milliseconds) between reconnects. 3000
webswing.websocketUrlLoader.type Type of websocket URL loader - define how should session pool get the websocket connection URL to cluster server(s).
(use propertyFile_noReload to disable reloading)
propertyFile
webswing.websocketUrlLoader.interval Websocket URL loader reloading interval in seconds. 5
webswing.server.websocketUrl Comma-separated list of websocket URLs to cluster servers.
(use with loader type propertyFile and propertyFile_noReload)
ws://localhost:8080
webswing.websocketUrlLoader.script Script that loads a comma-separated list of websocket URLs.
(use with loader type script)
webswing.logsDir Path where session pool logs should be stored. logs/

Cluster Session Pool handles everything related to the application instance, therefore it needs access too application binaries, libraries, fonts and application configuration (webswing-app.config).

Cluster Session Pool installation includes:

  • webswing.war
  • webswing-app.config
  • webswing-sessionpool.properties
  • sessionpool.bat / sessionpool.sh
  • application jar binaries and libraries
  • fonts

Here is an example of a webswing-app.config file:

{
    "/webswing-demo" : {
        "allowUpload" : true,
        "allowDownload" : true,
        "isolatedFs" : true,
        "sessionLogging" : false,
        "allowJsLink" : true,
        "javaFx" : true,
        "javaFxClassPathEntries" : [ "${webswing.rootDir}/apps/javafx/*.jar" ],
        "homeDir" : "${webswing.rootDir}/apps/WebswingDemo",
        "theme" : "Murrine",
        "directdraw" : true,
        "debug" : true,
        "jreExecutable" : "${java.home}/bin/java",
        "javaVersion" : "${java.version}",
        "launcherType" : "Desktop",
        "launcherConfig" : {
        "mainClass" : "org.webswing.demo.WebswingDemoApp"
        },
        "swingSessionTimeout" : 300,
        "timeoutIfInactive" : false,
        "allowDelete" : true,
        "allowAutoDownload" : true,
        "allowLocalClipboard" : true,
        "allowServerPrinting" : false,
        "dockMode" : "ALL",
        "allowStatisticsLogging" : true,
        "testMode" : false,
        "jsLinkWhitelist" : [ "*" ],
        "transferDir" : "${user}/upload",
        "clearTransferDir" : true,
        "sessionLogFileSize" : "${webswing.sessionLog.size:-10MB}",
        "transparentFileSave" : true,
        "sessionLogMaxFileSize" : "${webswing.sessionLog.maxSize:-1000MB}",
        "transparentFileOpen" : true,
        "fontConfig" : { },
        "classPathEntries" : [ "*.jar" ]
    }
}

Drain mode

Drain mode is useful when you want to shutdown a Session Pool or do some maintenance and you don't want to interfere with running sessions on that Session Pool. Drain mode will simply not allow to connect any more sessions. Note that drain mode does not automatically shutdown the Session Pool after all sessions finish. You can put Session Pool into drain mode in Admin Console.

Drain Mode

Session Pool resilience

When session pool crashes, all sessions running on this session pool are lost and cannot be recovered. To be able to recover running sessions you can use the following configuration in webswing-sessionpool.properties.

# enables instance resilience - session pool can recover connection to app instance processes after restart
# NOTE: recovered session pool MUST have the same sessionpool.id
sessionpool.instanceResilience.enabled = true
# path where instance descriptors and process streams are stored
sessionpool.instanceResilience.descriptors.dir = descriptors
# how long should instance wait for session pool to become available again after session pool goes down (in seconds)
sessionpool.instanceResilience.heartbeatTimeout.instance = 60

To be able to recover the sessions Webswing redirects the process I/O streams to files. Stream files with process/session descriptors are stored in descriptors directory. You can also setup the timeout how long will the session wait to be recovered after session pool crashes. Note that the restarted session pool must have the same id as the previous session pool that crashed, otherwise sessions cannot be recovered.