public class SessionManager extends Object
| Modifier and Type | Field and Description |
|---|---|
protected List<SessionManagerListener> |
listeners |
protected Map<NodeId,Session> |
newSessions |
protected Queue<NodeId> |
newSessionsQueue |
| Constructor and Description |
|---|
SessionManager(UaServer server) |
| Modifier and Type | Method and Description |
|---|---|
protected Session |
activateSession(ServerSecureChannel serverSecureChannel,
NodeId authenticationToken,
UserIdentityToken userToken,
SignatureData clientSignature,
SignedSoftwareCertificate[] signedSoftwareCertificates,
SignatureData userTokenSignature,
String[] localeIds) |
protected void |
activateSessionError(Session session,
UserIdentityToken userToken,
Exception e) |
void |
addListener(SessionManagerListener listener)
Add a new SessionManagerListener.
|
protected void |
cancelSession(NodeId authenticationToken) |
protected void |
close()
Close the session manager.
|
protected void |
closeSession(NodeId authenticationToken,
boolean deleteSubscriptions) |
void |
closeSession(Session session)
Emulates a
CloseSessionRequest, i.e. |
void |
closeSession(Session session,
boolean deleteSubscriptions)
Emulates a
CloseSessionRequest, i.e. |
protected Session |
createSession(ServerSecureChannel serverSecureChannel,
byte[] clientCertificate,
ApplicationDescription clientDescription,
UnsignedInteger maxResponseMessageSize,
Double requestedSessionTimeout,
String sessionName,
SecurityMode securityMode) |
EndpointDescription[] |
getEndpoints() |
int |
getMaxBrowseContinuationPoints()
The maximum number of continuation points supported by the server for browse requests.
|
int |
getMaxHistoryContinuationPoints()
The maximum number of continuation points supported by the server for history read requests.
|
int |
getMaxQueryContinuationPoints()
The maximum number of continuation points supported by the server for query requests.
|
UnsignedInteger |
getMaxRequestMessageSize()
The value is used to inform the clients that they should not send larger messages than this to
the server.
|
int |
getMaxSessionCount() |
double |
getMaxSessionTimeout() |
double |
getMinSessionTimeout() |
UaServer |
getServer() |
Session |
getSession(NodeId authenticationToken)
Get a client session.
|
int |
getSessionCount() |
Collection<Session> |
getSessions()
Get the current
Session(s) in the server (including the ones that are not yet
ActivateSession-ed). |
boolean |
hasListener(SessionManagerListener listener)
Check if the manager already has the specified listener.
|
boolean |
isRunning() |
protected Session |
provideSession(String sessionName,
ApplicationIdentity clientIdentity,
SecurityMode securityMode)
Creates a Session instance for given parameters.
|
void |
removeListener(SessionManagerListener listener)
Remove a SessionManagerListener.
|
void |
setMaxBrowseContinuationPoints(int maxBrowseContinuationPoints)
The maximum number of continuation points supported by the server for browse requests.
|
void |
setMaxBrowseContinuationPoints(UnsignedShort maxBrowseContinuationPoints)
The maximum number of continuation points supported by the server for browse requests.
|
void |
setMaxHistoryContinuationPoints(int maxHistoryContinuationPoints)
The maximum number of continuation points supported by the server for history read requests.
|
void |
setMaxHistoryContinuationPoints(UnsignedShort maxHistoryContinuationPoints)
The maximum number of continuation points supported by the server for history read requests.
|
void |
setMaxQueryContinuationPoints(int maxQueryContinuationPoints)
The maximum number of continuation points supported by the server for query requests.
|
void |
setMaxQueryContinuationPoints(UnsignedShort maxQueryContinuationPoints)
The maximum number of continuation points supported by the server for query requests.
|
void |
setMaxRequestMessageSize(int maxRequestMessageSize)
The value is used to inform the clients that they should not send larger messages than this to
the server.
|
void |
setMaxRequestMessageSize(UnsignedInteger maxRequestMessageSize)
The value is used to inform the clients that they should not send larger messages than this to
the server.
|
void |
setMaxSessionCount(int maxSessionCount) |
void |
setMaxSessionTimeout(double maxSessionTimeout)
The maximum session timeout enabled for the clients.
|
void |
setMinSessionTimeout(double minSessionTimeout)
The minimum session timeout enabled for the clients.
|
protected void |
start()
Start the session manager.
|
protected List<SessionManagerListener> listeners
public SessionManager(UaServer server)
public void addListener(SessionManagerListener listener)
listener - public void closeSession(Session session) throws ServiceException
CloseSessionRequest, i.e. force-close the given Session and also
removes the Subscriptions of the Session. Please note, that under normal conditions, most OPC
UA Clients simply reconnect immediately again.session - the session to closeServiceException - if there is an error, e.g. the Session doesn't exist in the server.public void closeSession(Session session, boolean deleteSubscriptions) throws ServiceException
CloseSessionRequest, i.e. force-close the given Session. Please
note, that under normal conditions, most OPC UA Clients simply reconnect immediately again.session - the session to closedeleteSubscriptions - should the subscriptions of the session also be removed.ServiceException - if there is an error, e.g. the Session doesn't exist in the server.public EndpointDescription[] getEndpoints()
public int getMaxBrowseContinuationPoints()
public int getMaxHistoryContinuationPoints()
public int getMaxQueryContinuationPoints()
public UnsignedInteger getMaxRequestMessageSize()
public int getMaxSessionCount()
public double getMaxSessionTimeout()
public double getMinSessionTimeout()
public UaServer getServer()
public Session getSession(NodeId authenticationToken) throws ServiceException
authenticationToken - the token used to identify a client sessionServiceException - if the session is not found, with ServiceResult=Bad_SessionClosedgetSessionCount()public int getSessionCount()
public Collection<Session> getSessions()
Session(s) in the server (including the ones that are not yet
ActivateSession-ed). The returned collection is a snapshot and unmodifiable, i.e. it doesn't
contain any newly added Sessions after the call is made. If you wish to observe
additions/removals, use addListener(SessionManagerListener) first, and then call this
to get the existing sessions.public boolean hasListener(SessionManagerListener listener)
listener - the listener to checkpublic boolean isRunning()
public void removeListener(SessionManagerListener listener)
listener - public void setMaxBrowseContinuationPoints(int maxBrowseContinuationPoints)
Default: 0 (=unlimited)
maxBrowseContinuationPoints - the maxBrowseContinuationPoints to set, the value must be in
the range of UnsignedShortpublic void setMaxBrowseContinuationPoints(UnsignedShort maxBrowseContinuationPoints)
Default: 0 (=unlimited)
maxBrowseContinuationPoints - the maxBrowseContinuationPoints to setpublic void setMaxHistoryContinuationPoints(int maxHistoryContinuationPoints)
Default: 0 (=unlimited)
maxHistoryContinuationPoints - the maxHistoryContinuationPoints to set, the value must be
in the range of UnsignedShortpublic void setMaxHistoryContinuationPoints(UnsignedShort maxHistoryContinuationPoints)
Default: 0 (=unlimited)
maxHistoryContinuationPoints - the maxHistoryContinuationPoints to setpublic void setMaxQueryContinuationPoints(int maxQueryContinuationPoints)
Default: 0 (=unlimited)
maxQueryContinuationPoints - the maxQueryContinuationPoints to set, the value must be in
the range of UnsignedShortpublic void setMaxQueryContinuationPoints(UnsignedShort maxQueryContinuationPoints)
Default: 0 (=unlimited)
maxQueryContinuationPoints - the maxQueryContinuationPoints to setpublic void setMaxRequestMessageSize(int maxRequestMessageSize)
maxRequestMessageSize - the maximum request message size to set in bytes. Default is null,
which means that the value is not used. May not be a negative value.public void setMaxRequestMessageSize(UnsignedInteger maxRequestMessageSize)
maxRequestMessageSize - the maximum request message size to set in bytes. Default is null,
which means that the value is not used.public void setMaxSessionCount(int maxSessionCount)
maxSessionCount - the maxSessionCount to setpublic void setMaxSessionTimeout(double maxSessionTimeout)
Default: 3600000 (ms)
maxSessionTimeout - the maxSessionTimeout to set in millisecondspublic void setMinSessionTimeout(double minSessionTimeout)
Default: 100 (ms)
minSessionTimeout - the minSessionTimeout to set in millisecondsprotected Session activateSession(ServerSecureChannel serverSecureChannel, NodeId authenticationToken, UserIdentityToken userToken, SignatureData clientSignature, SignedSoftwareCertificate[] signedSoftwareCertificates, SignatureData userTokenSignature, String[] localeIds) throws ServiceException
ServiceExceptionprotected void activateSessionError(Session session, UserIdentityToken userToken, Exception e)
session - userToken - e - ServiceExceptionprotected void cancelSession(NodeId authenticationToken) throws ServiceException
ServiceExceptionprotected void close()
protected void closeSession(NodeId authenticationToken, boolean deleteSubscriptions) throws ServiceException
authenticationToken - ServiceExceptionprotected Session createSession(ServerSecureChannel serverSecureChannel, byte[] clientCertificate, ApplicationDescription clientDescription, UnsignedInteger maxResponseMessageSize, Double requestedSessionTimeout, String sessionName, SecurityMode securityMode) throws ServiceException
ServiceExceptionprotected Session provideSession(String sessionName, ApplicationIdentity clientIdentity, SecurityMode securityMode)
sessionName - name for the SessionclientIdentity - client identity for the SessionsecurityMode - security mode for the sessionprotected void start()
throws StatusException
StatusExceptionCopyright © 2026. All rights reserved.