Class ActiveUserSessions
- Author:
- Christopher Mindus
Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionaddUser(ServerShell server, SessionInfo appSessionInfo, ClientParams clientParams) Adds a new client connection as a NEW AppSession of the application, under the user label the connection names.getAppSessionGyro(ServerShell server, ClientParams clientParams) Gets the AppSession a new client connection belongs to beforeaddUser(ServerShell, SessionInfo, ClientParams)creates it, so that the connection's first worker starts in that AppSession's thread group: alwaysnull, since every new connection starts a new AppSession (seeaddUser(ServerShell, SessionInfo, ClientParams)).intGets the current count of active application sessions.intGets the currently open AppSession count: every application session alive, the ones before their sign-in included, regardless of the same user - a session in the sense of HUB-DESIGN 1 (R-19).intGets the current amount of different users signed in: distinct users with at least one AppSession that has them.Gets the licence counter: the licence status ServerAdmin shows (T1-154).intGets the peak count of active application sessions.intGets the peak open AppSession count.intGets the peak count of (user, application) pairs with at least one AppSession.intGets the peak amount of different users signed in.getUserAppSession(VSViewerParams params) Gets the application gyro for an application, user and session ID for the VS Viewer.Gets the user sessions open.getUserSessions(String appID, String userID) Gets the user session for a client session.booleanonAppSessionUserChanged(AppSessionGyro appGyro) Called when the AppSessionGyro changes its user due to external login: the AppSession moves from the entry-URL key to the key of its real user,userName\tappID, joining theUserSessionsof that user and application when there is one and getting a session ID of that instance (HUB-DESIGN 11 item 1), and the user is counted (item 2).protected voidonUserReleased(long uid, String appID) Called inside the monitor when the last AppSession of a user and application ends, or changes to another user.protected voidonUserSignedIn(long uid, String appID, AppSessionGyro appSession) Called inside the monitor when an AppSession gets its user: at creation for an application with its own sign-in, at the external login otherwise.
Constructor Details
ActiveUserSessions
public ActiveUserSessions()Constructor: the server's licence counter.
Method Details
getLicenseCounter
Gets the licence counter: the licence status ServerAdmin shows (T1-154).- Returns:
- The counter.
getCurrentUserCount
public int getCurrentUserCount()Gets the current amount of different users signed in: distinct users with at least one AppSession that has them. Each user may have several sessions open. An AppSession before its sign-in is counted bygetCurrentSessionCount()and not here (R-19).- Returns:
- The number of concurrent users signed in.
getPeakUserCount
public int getPeakUserCount()Gets the peak amount of different users signed in. Each user may have several sessions open.- Returns:
- The number of peak concurrent users.
getCurrentSessionCount
public int getCurrentSessionCount()Gets the currently open AppSession count: every application session alive, the ones before their sign-in included, regardless of the same user - a session in the sense of HUB-DESIGN 1 (R-19). A client session is one connected client of an AppSession and is not what is counted here.- Returns:
- The count of the currently open application sessions to the server.
getPeakSessionCount
public int getPeakSessionCount()Gets the peak open AppSession count.- Returns:
- The peak count of open application sessions to the server, regardless of the same user.
getPeakUserApplicationCount
public int getPeakUserApplicationCount()Gets the peak count of (user, application) pairs with at least one AppSession.- Returns:
- The peak count of users per application, summed over the applications.
getCurrentAppSessionCount
public int getCurrentAppSessionCount()Gets the current count of active application sessions. The same user may run several apps and/or sessions at the same time.- Returns:
- The current amount of concurrent application sessions.
getPeakAppSessionCount
public int getPeakAppSessionCount()Gets the peak count of active application sessions. The same user may run several apps and/or sessions at the same time.- Returns:
- The peak amount of concurrent application sessions.
getUserSessions
getUserSessions
Gets the user session for a client session.- Parameters:
appID- The application ID, or null for all application IDs.userID- The user ID, or null for all user IDs.- Returns:
- A new list of user sessions.
getUserAppSession
Gets the application gyro for an application, user and session ID for the VS Viewer.- Parameters:
params- The VS Viewer parameters.- Returns:
- The application gyro or null if not found.
addUser
public AppSessionGyro addUser(ServerShell server, SessionInfo appSessionInfo, ClientParams clientParams) throws UserException Adds a new client connection as a NEW AppSession of the application, under the user label the connection names. This can fail for the following reasons:- the application is not found or not loaded yet, or its environment failed,
- for an application without external login,
UserAuthentication.validateUserrefuses the user label or the password, - the application refuses the session at its admission (
AppSessionGyro), - the licence refuses a user not counted yet (
LicenseCounter, LICENSE-V2-DESIGN 6.3 and 8.4) - never in this release, whose enforcement switch is off (LV-19), - FUTURE: User not allowed to run more than one application (not implemented yet).
Every new connection starts a new AppSession, for every application: the session ID the client sent (
sid=,"-1"for the newest) never selects an existing one. Until CC-L15-SESSION-RESUME a connection that named a live session ID of a user label joined that AppSession with no password, for an application without external login while parallel sessions were allowed (the default). The authenticated switch into an existing AppSession of the signed-in user is HUB B-6b. A dropped connection that reconnects (reconnect=<id>&serial=) keeps its client session and does not come here.For an application without external login this method verifies the user label and the password the client sent (
UserAuthentication.validateUserwith the identifier's password): a connection that sent none is admitted asSUCCESS_NOT_SIGNED_IN, a session and not a user until its sign-in. For an application with external login it verifies nothing: the application signs its user in later.- Parameters:
server- The server.appSessionInfo- The application session information of the new connection.clientParams- The client parameters. Their session user identifier is replaced by one with the session ID of the new AppSession.- Returns:
- The new Gyro instance for the application session.
- Throws:
UserException- If the user is not allowed access.
getAppSessionGyro
Gets the AppSession a new client connection belongs to beforeaddUser(ServerShell, SessionInfo, ClientParams)creates it, so that the connection's first worker starts in that AppSession's thread group: alwaysnull, since every new connection starts a new AppSession (seeaddUser(ServerShell, SessionInfo, ClientParams)). Until CC-L15-SESSION-RESUME it returned the live AppSession of the connection's user label and session ID ("-1"for the newest) for an application without external login, and the connection's AppSession was built on that AppSession's session information. The authenticated switch into an existing AppSession of the signed-in user is HUB B-6b.- Parameters:
server- The server instance.clientParams- The client parameters.- Returns:
- Always
null: a new connection belongs to no AppSession yet.
onAppSessionUserChanged
Called when the AppSessionGyro changes its user due to external login: the AppSession moves from the entry-URL key to the key of its real user,userName\tappID, joining theUserSessionsof that user and application when there is one and getting a session ID of that instance (HUB-DESIGN 11 item 1), and the user is counted (item 2). Called byAppSessionGyro.changeExternallyAuthenticatedUserafter the user is verified and set. An AppSession whose user is still undefined is left where it is.A user not counted yet is first checked against the licence (
LicenseCounter, LICENSE-V2-DESIGN 6.3 and 8.4): a refusal leaves the AppSession where it was, its user not counted, and answers false. This release refuses nothing (LV-19, decision B5D-D-a): the enforcement release has the caller turn false into the sign-in's refusal.- Parameters:
appGyro- The application session gyro instance, its authenticated user set.- Returns:
- true when the user is counted, false when the licence refuses it or the AppSession has no authenticated user.
onUserSignedIn
Called inside the monitor when an AppSession gets its user: at creation for an application with its own sign-in, at the external login otherwise. The hook of HUB-DESIGN 9.1'sLOGIN: the hub's claims (B-7d) attach here. The licence counter (B-5d) is not a consumer: it must decide BEFORE the user is counted, soadmission(Object, long, String, String)asks it andcounttells it. No consumer yet; does nothing.- Parameters:
uid- The user ID ofIZS.USERS.appID- The application ID.appSession- The AppSession that has the user now.
onUserReleased
Called inside the monitor when the last AppSession of a user and application ends, or changes to another user. The hook of HUB-DESIGN 9.1'sRELEASE; no consumer yet; does nothing.- Parameters:
uid- The user ID ofIZS.USERS.appID- The application ID.