OlympiaServerSessionManager

Overview

The OlympiaServerSessionManager class represents a session manager that stores session data in the Olympia State Server.

Sessions are stored out-of-process and are able to survive a service restart. Session data can be shared between several services of the same type thus allowing to implement load balancing mechanisms like Round Robin etc.

There are two things one should consider before using the OlympiaServerSessionManager component to store session data:

  1. For obvoius reasons, session access performance is considerably lower for the OlympiaServerSessionManager compared to the In-Memory Session Manager, because accessing a session stored on the Olympia Server takes much more time than accessing a session object stored in memory.

  2. Not all data types can be stored in an Olympia session. Supported types are:

  3. Primitive values:
    • Binary ** Boolean ** Byte ** Currency ** DateTime ** Decimal ** Double ** Guid ** Int8 ** Int16 ** Int32 ** Int64 ** String
  4. Classes inherited from the ComplexType class. In this case methods ComplexType and ComplexType are used to serialize/deserialize data
  5. All .NET classes marked with the Serializable attribute. In this case .NET serialization facility will be used
  6. Arrays of types listed above

The OlympiaServerSessionManager class uses the SuperTcpClientChannel client channel to communicate with the Olympia Server.

Location

 

constructor

Creates a new instance of the OlympiaServerSessionManager class.

 

constructor

 

OlympiaServerSessionManager()

 

Sub New

constructor (Boolean)

 

constructor(register: Boolean)

 

OlympiaServerSessionManager(Boolean register)

 

Sub New (register As Boolean)

Parameters:

  • register:

constructor (Boolean, Boolean)  protected    (declared in SessionManager)

 

constructor(register: Boolean; initializeSessionExpirationTimer: Boolean)

 

OlympiaServerSessionManager(Boolean register, Boolean initializeSessionExpirationTimer)

 

Sub New (register As Boolean, initializeSessionExpirationTimer As Boolean)

Parameters:

  • register:
  • initializeSessionExpirationTimer:

constructor (IContainer)

Creates a new instance of the OlympiaServerSessionManager class and adds the newly created instance to the provided component container.

 

constructor(container: IContainer)

 

OlympiaServerSessionManager(IContainer container)

 

Sub New (container As IContainer)

Parameters:

  • container: Components container

add_OnSessionCreated    (declared in SessionManager)

 

method add_OnSessionCreated(value: SessionEventHandler)

 

void add_OnSessionCreated(SessionEventHandler value)

 

Sub add_OnSessionCreated(value As SessionEventHandler)

Parameters:

  • value:

add_OnSessionDestroyed    (declared in SessionManager)

 

method add_OnSessionDestroyed(value: SessionIDEventHandler)

 

void add_OnSessionDestroyed(SessionIDEventHandler value)

 

Sub add_OnSessionDestroyed(value As SessionIDEventHandler)

Parameters:

  • value:

add_OnSessionExpired    (declared in SessionManager)

 

method add_OnSessionExpired(value: SessionEventHandler)

 

void add_OnSessionExpired(SessionEventHandler value)

 

Sub add_OnSessionExpired(value As SessionEventHandler)

Parameters:

  • value:

ApplicationId

Gets or sets the so-called Application type ID.

This property was introduced to prevent access to sessions not owned by the current server application. Only servers that share the same ApplicationId value have access to the each other's sessions.

 

property ApplicationId: Guid read write;

 

Guid ApplicationId { get; set; }

 

Property ApplicationId As Guid

Channel

Gets or sets the ClientChannel instance that will be used to communicate with the remote Olympia Server.

The OlympiaServerSessionManager class will clone this ClientChannel instance and use a connection pool internally to communicate with the Olympia Server.

By default, the Olympia Server can be accessed via the SuperTCP channel. See more details in the Accessing Olympia paragraph.

 

property Channel: ClientChannel read write;

 

ClientChannel Channel { get; set; }

 

Property Channel As ClientChannel

CreateNewSession  protected

Creates a new session instance with the provided Session ID.

At this point, the session is created locally without notifying the Olympia Server.

 

method CreateNewSession(sessionId: Guid): ISession

 

ISession CreateNewSession(Guid sessionId)

 

Function CreateNewSession(sessionId As Guid) As ISession

Parameters:

  • sessionId: Session Id

DestroySession (Guid)    (declared in SessionManager)

 

method DestroySession(sessionId: Guid)

 

void DestroySession(Guid sessionId)

 

Sub DestroySession(sessionId As Guid)

Parameters:

  • sessionId:

DestroySession (ISession)    (declared in SessionManager)

 

method DestroySession(session: ISession)

 

void DestroySession(ISession session)

 

Sub DestroySession(session As ISession)

Parameters:

  • session:

Dispose  protected    (declared in SessionManager)

 

method Dispose(disposing: Boolean)

 

void Dispose(Boolean disposing)

 

Sub Dispose(disposing As Boolean)

Parameters:

  • disposing:

ExpireSessions

This method is empty, because the Olympia Server itself handles session timeouts.

 

method ExpireSessions

 

void ExpireSessions()

 

Sub ExpireSessions

GetAllSessions

Retrieves identifiers of active sessions from the Olympia Server.

Only sessions stored with a valid ApplicationId are enumerated.

 

method GetAllSessions: IList<Guid>

 

IList<Guid> GetAllSessions()

 

Function GetAllSessions As IList<Guid>

GetExistingSession    (declared in SessionManager)

 

method GetExistingSession(sessionId: Guid; updateTime: Boolean): ISession

 

ISession GetExistingSession(Guid sessionId, Boolean updateTime)

 

Function GetExistingSession(sessionId As Guid, updateTime As Boolean) As ISession

Parameters:

  • sessionId:
  • updateTime:

GetSession    (declared in SessionManager)

 

method GetSession(sessionId: Guid): ISession

 

ISession GetSession(Guid sessionId)

 

Function GetSession(sessionId As Guid) As ISession

Parameters:

  • sessionId:

GlobalSessionManager    (declared in SessionManager)

 

class property GlobalSessionManager: ISessionManager read;

 

class ISessionManager GlobalSessionManager { get; }

 

Shared Property ReadOnly GlobalSessionManager As ISessionManager

IsOutOfProcess

Gets a flag indicating that session manager uses out-of-process session storage.

Returns true.

 

property IsOutOfProcess: Boolean read;

 

Boolean IsOutOfProcess { get; }

 

Property ReadOnly IsOutOfProcess As Boolean

LocateExistingSession  protected

Retrieves the session with the provided ID from the Olympia Server. Returns null if the Olympia Server doesn't store a session with the provided ID.

 

method LocateExistingSession(sessionId: Guid; updateTime: Boolean): ISession

 

ISession LocateExistingSession(Guid sessionId, Boolean updateTime)

 

Function LocateExistingSession(sessionId As Guid, updateTime As Boolean) As ISession

Parameters:

  • sessionId: Session Id
  • updateTime:

MaxPoolSize

Gets or sets the maximum size of the connection pool used to communicate with the Olympia Server.

 

property MaxPoolSize: Int32 read write;

 

Int32 MaxPoolSize { get; set; }

 

Property MaxPoolSize As Int32

OnSessionCreated    (declared in SessionManager)

Gets triggered after a new Session has been created. You can use it to perform initialization functions or fill the session with default values.

 

event OnSessionCreated: SessionEventHandler;
delegate: method OnSessionCreated(sender: Object; e: SessionEventArgs)

 

delegate SessionEventHandler OnSessionCreated()
delegate: void OnSessionCreated(Object sender, SessionEventArgs e)

 

Event OnSessionCreated As SessionEventHandler
delegate: Sub OnSessionCreated(sender As Object, e As SessionEventArgs)

OnSessionDestroyed    (declared in SessionManager)

Gets triggered after a new Session has been manually destroyed. You can use it to perform cleanup for a specific session id.

Note: The session has already been Disposed when the OnSessionDestroyed event fires. This event will not fire for sessions that expire.

 

event OnSessionDestroyed: SessionIDEventHandler;
delegate: method OnSessionDestroyed(sender: Object; e: SessionIDEventArgs)

 

delegate SessionIDEventHandler OnSessionDestroyed()
delegate: void OnSessionDestroyed(Object sender, SessionIDEventArgs e)

 

Event OnSessionDestroyed As SessionIDEventHandler
delegate: Sub OnSessionDestroyed(sender As Object, e As SessionIDEventArgs)

OnSessionExpired    (declared in SessionManager)

Gets triggered after a new Session has been expired. You can use it to perform cleanup and/or inspect the values of the expired session.

Note: The session has already been Disposed when the OnSessionExpired event fires. This event will not fire for sessions that are manually destroyed.

 

event OnSessionExpired: SessionEventHandler;
delegate: method OnSessionExpired(sender: Object; e: SessionEventArgs)

 

delegate SessionEventHandler OnSessionExpired()
delegate: void OnSessionExpired(Object sender, SessionEventArgs e)

 

Event OnSessionExpired As SessionEventHandler
delegate: Sub OnSessionExpired(sender As Object, e As SessionEventArgs)

RegisterSessionManager    (declared in SessionManager)

 

class method RegisterSessionManager(manager: ISessionManager)

 

static void RegisterSessionManager(ISessionManager manager)

 

Shared Sub RegisterSessionManager(manager As ISessionManager)

Parameters:

  • manager:

ReleaseSession

Releases the previously acquired session. The session data is serialized and sent to the Olympia Server.

In most cases, this method is called automatically when a service is deactivated.

 

method ReleaseSession(session: ISession)

 

void ReleaseSession(ISession session)

 

Sub ReleaseSession(session As ISession)

Parameters:

  • session: Session instance

remove_OnSessionCreated    (declared in SessionManager)

 

method remove_OnSessionCreated(value: SessionEventHandler)

 

void remove_OnSessionCreated(SessionEventHandler value)

 

Sub remove_OnSessionCreated(value As SessionEventHandler)

Parameters:

  • value:

remove_OnSessionDestroyed    (declared in SessionManager)

 

method remove_OnSessionDestroyed(value: SessionIDEventHandler)

 

void remove_OnSessionDestroyed(SessionIDEventHandler value)

 

Sub remove_OnSessionDestroyed(value As SessionIDEventHandler)

Parameters:

  • value:

remove_OnSessionExpired    (declared in SessionManager)

 

method remove_OnSessionExpired(value: SessionEventHandler)

 

void remove_OnSessionExpired(SessionEventHandler value)

 

Sub remove_OnSessionExpired(value As SessionEventHandler)

Parameters:

  • value:

SessionCount  protected

Gets the number of sessions stored in the Olympia Server.

Only sessions stored with a valid ApplicationId are counted.

 

property SessionCount: Int32 read;

 

Int32 SessionCount { get; }

 

Property ReadOnly SessionCount As Int32

SessionsExpired

This method implements the Interface IOlympiaSessionManagerEvents interface.

It is called when the OlympiaServerSessionManager instance is notified via a server event that one or more sessions have been marked as expired by the Olympia Server.

This method raises an OnSessionExpired event with session identifiers retrieved via the aExpiredSessionIDs parameter.

This method shouldn't be called directly.

 

method SessionsExpired(expiredSessions: array of Guid)

 

void SessionsExpired(Guid[] expiredSessions)

 

Sub SessionsExpired(expiredSessions As array of Guid)

Parameters:

  • expiredSessions: List of expired sessions Ids sent from the Olympia State Server.

Timeout    (declared in SessionManager)

 

property Timeout: Int32 read write;

 

Int32 Timeout { get; set; }

 

Property Timeout As Int32

TriggerOnSessionCreated  protected    (declared in SessionManager)

 

method TriggerOnSessionCreated(e: SessionEventArgs)

 

void TriggerOnSessionCreated(SessionEventArgs e)

 

Sub TriggerOnSessionCreated(e As SessionEventArgs)

Parameters:

  • e:

TriggerOnSessionDestroyed  protected    (declared in SessionManager)

 

method TriggerOnSessionDestroyed(e: SessionIDEventArgs)

 

void TriggerOnSessionDestroyed(SessionIDEventArgs e)

 

Sub TriggerOnSessionDestroyed(e As SessionIDEventArgs)

Parameters:

  • e:

TriggerOnSessionExpired  protected    (declared in SessionManager)

 

method TriggerOnSessionExpired(e: SessionEventArgs)

 

void TriggerOnSessionExpired(SessionEventArgs e)

 

Sub TriggerOnSessionExpired(e As SessionEventArgs)

Parameters:

  • e:

UnregisterSessionManager    (declared in SessionManager)

 

class method UnregisterSessionManager(manager: ISessionManager)

 

static void UnregisterSessionManager(ISessionManager manager)

 

Shared Sub UnregisterSessionManager(manager As ISessionManager)

Parameters:

  • manager:

 

ApplicationId

Gets or sets the so-called Application type ID.

This property was introduced to prevent access to sessions not owned by the current server application. Only servers that share the same ApplicationId value have access to the each other's sessions.

 

property ApplicationId: Guid read write;

 

Guid ApplicationId { get; set; }

 

Property ApplicationId As Guid

Channel

Gets or sets the ClientChannel instance that will be used to communicate with the remote Olympia Server.

The OlympiaServerSessionManager class will clone this ClientChannel instance and use a connection pool internally to communicate with the Olympia Server.

By default, the Olympia Server can be accessed via the SuperTCP channel. See more details in the Accessing Olympia paragraph.

 

property Channel: ClientChannel read write;

 

ClientChannel Channel { get; set; }

 

Property Channel As ClientChannel

IsOutOfProcess

Gets a flag indicating that session manager uses out-of-process session storage.

Returns true.

 

property IsOutOfProcess: Boolean read;

 

Boolean IsOutOfProcess { get; }

 

Property ReadOnly IsOutOfProcess As Boolean

MaxPoolSize

Gets or sets the maximum size of the connection pool used to communicate with the Olympia Server.

 

property MaxPoolSize: Int32 read write;

 

Int32 MaxPoolSize { get; set; }

 

Property MaxPoolSize As Int32

SessionCount  protected

Gets the number of sessions stored in the Olympia Server.

Only sessions stored with a valid ApplicationId are counted.

 

property SessionCount: Int32 read;

 

Int32 SessionCount { get; }

 

Property ReadOnly SessionCount As Int32

Timeout    (declared in SessionManager)

 

property Timeout: Int32 read write;

 

Int32 Timeout { get; set; }

 

Property Timeout As Int32

GlobalSessionManager    (declared in SessionManager)

 

class property GlobalSessionManager: ISessionManager read;

 

class ISessionManager GlobalSessionManager { get; }

 

Shared Property ReadOnly GlobalSessionManager As ISessionManager

 

RegisterSessionManager    (declared in SessionManager)

 

class method RegisterSessionManager(manager: ISessionManager)

 

static void RegisterSessionManager(ISessionManager manager)

 

Shared Sub RegisterSessionManager(manager As ISessionManager)

Parameters:

  • manager:

UnregisterSessionManager    (declared in SessionManager)

 

class method UnregisterSessionManager(manager: ISessionManager)

 

static void UnregisterSessionManager(ISessionManager manager)

 

Shared Sub UnregisterSessionManager(manager As ISessionManager)

Parameters:

  • manager:

 

constructor

Creates a new instance of the OlympiaServerSessionManager class.

 

constructor

 

OlympiaServerSessionManager()

 

Sub New

constructor (Boolean)

 

constructor(register: Boolean)

 

OlympiaServerSessionManager(Boolean register)

 

Sub New (register As Boolean)

Parameters:

  • register:

constructor (Boolean, Boolean)  protected    (declared in SessionManager)

 

constructor(register: Boolean; initializeSessionExpirationTimer: Boolean)

 

OlympiaServerSessionManager(Boolean register, Boolean initializeSessionExpirationTimer)

 

Sub New (register As Boolean, initializeSessionExpirationTimer As Boolean)

Parameters:

  • register:
  • initializeSessionExpirationTimer:

constructor (IContainer)

Creates a new instance of the OlympiaServerSessionManager class and adds the newly created instance to the provided component container.

 

constructor(container: IContainer)

 

OlympiaServerSessionManager(IContainer container)

 

Sub New (container As IContainer)

Parameters:

  • container: Components container

add_OnSessionCreated    (declared in SessionManager)

 

method add_OnSessionCreated(value: SessionEventHandler)

 

void add_OnSessionCreated(SessionEventHandler value)

 

Sub add_OnSessionCreated(value As SessionEventHandler)

Parameters:

  • value:

add_OnSessionDestroyed    (declared in SessionManager)

 

method add_OnSessionDestroyed(value: SessionIDEventHandler)

 

void add_OnSessionDestroyed(SessionIDEventHandler value)

 

Sub add_OnSessionDestroyed(value As SessionIDEventHandler)

Parameters:

  • value:

add_OnSessionExpired    (declared in SessionManager)

 

method add_OnSessionExpired(value: SessionEventHandler)

 

void add_OnSessionExpired(SessionEventHandler value)

 

Sub add_OnSessionExpired(value As SessionEventHandler)

Parameters:

  • value:

CreateNewSession  protected

Creates a new session instance with the provided Session ID.

At this point, the session is created locally without notifying the Olympia Server.

 

method CreateNewSession(sessionId: Guid): ISession

 

ISession CreateNewSession(Guid sessionId)

 

Function CreateNewSession(sessionId As Guid) As ISession

Parameters:

  • sessionId: Session Id

DestroySession (Guid)    (declared in SessionManager)

 

method DestroySession(sessionId: Guid)

 

void DestroySession(Guid sessionId)

 

Sub DestroySession(sessionId As Guid)

Parameters:

  • sessionId:

DestroySession (ISession)    (declared in SessionManager)

 

method DestroySession(session: ISession)

 

void DestroySession(ISession session)

 

Sub DestroySession(session As ISession)

Parameters:

  • session:

Dispose  protected    (declared in SessionManager)

 

method Dispose(disposing: Boolean)

 

void Dispose(Boolean disposing)

 

Sub Dispose(disposing As Boolean)

Parameters:

  • disposing:

ExpireSessions

This method is empty, because the Olympia Server itself handles session timeouts.

 

method ExpireSessions

 

void ExpireSessions()

 

Sub ExpireSessions

GetAllSessions

Retrieves identifiers of active sessions from the Olympia Server.

Only sessions stored with a valid ApplicationId are enumerated.

 

method GetAllSessions: IList<Guid>

 

IList<Guid> GetAllSessions()

 

Function GetAllSessions As IList<Guid>

GetExistingSession    (declared in SessionManager)

 

method GetExistingSession(sessionId: Guid; updateTime: Boolean): ISession

 

ISession GetExistingSession(Guid sessionId, Boolean updateTime)

 

Function GetExistingSession(sessionId As Guid, updateTime As Boolean) As ISession

Parameters:

  • sessionId:
  • updateTime:

GetSession    (declared in SessionManager)

 

method GetSession(sessionId: Guid): ISession

 

ISession GetSession(Guid sessionId)

 

Function GetSession(sessionId As Guid) As ISession

Parameters:

  • sessionId:

LocateExistingSession  protected

Retrieves the session with the provided ID from the Olympia Server. Returns null if the Olympia Server doesn't store a session with the provided ID.

 

method LocateExistingSession(sessionId: Guid; updateTime: Boolean): ISession

 

ISession LocateExistingSession(Guid sessionId, Boolean updateTime)

 

Function LocateExistingSession(sessionId As Guid, updateTime As Boolean) As ISession

Parameters:

  • sessionId: Session Id
  • updateTime:

ReleaseSession

Releases the previously acquired session. The session data is serialized and sent to the Olympia Server.

In most cases, this method is called automatically when a service is deactivated.

 

method ReleaseSession(session: ISession)

 

void ReleaseSession(ISession session)

 

Sub ReleaseSession(session As ISession)

Parameters:

  • session: Session instance

remove_OnSessionCreated    (declared in SessionManager)

 

method remove_OnSessionCreated(value: SessionEventHandler)

 

void remove_OnSessionCreated(SessionEventHandler value)

 

Sub remove_OnSessionCreated(value As SessionEventHandler)

Parameters:

  • value:

remove_OnSessionDestroyed    (declared in SessionManager)

 

method remove_OnSessionDestroyed(value: SessionIDEventHandler)

 

void remove_OnSessionDestroyed(SessionIDEventHandler value)

 

Sub remove_OnSessionDestroyed(value As SessionIDEventHandler)

Parameters:

  • value:

remove_OnSessionExpired    (declared in SessionManager)

 

method remove_OnSessionExpired(value: SessionEventHandler)

 

void remove_OnSessionExpired(SessionEventHandler value)

 

Sub remove_OnSessionExpired(value As SessionEventHandler)

Parameters:

  • value:

SessionsExpired

This method implements the Interface IOlympiaSessionManagerEvents interface.

It is called when the OlympiaServerSessionManager instance is notified via a server event that one or more sessions have been marked as expired by the Olympia Server.

This method raises an OnSessionExpired event with session identifiers retrieved via the aExpiredSessionIDs parameter.

This method shouldn't be called directly.

 

method SessionsExpired(expiredSessions: array of Guid)

 

void SessionsExpired(Guid[] expiredSessions)

 

Sub SessionsExpired(expiredSessions As array of Guid)

Parameters:

  • expiredSessions: List of expired sessions Ids sent from the Olympia State Server.

TriggerOnSessionCreated  protected    (declared in SessionManager)

 

method TriggerOnSessionCreated(e: SessionEventArgs)

 

void TriggerOnSessionCreated(SessionEventArgs e)

 

Sub TriggerOnSessionCreated(e As SessionEventArgs)

Parameters:

  • e:

TriggerOnSessionDestroyed  protected    (declared in SessionManager)

 

method TriggerOnSessionDestroyed(e: SessionIDEventArgs)

 

void TriggerOnSessionDestroyed(SessionIDEventArgs e)

 

Sub TriggerOnSessionDestroyed(e As SessionIDEventArgs)

Parameters:

  • e:

TriggerOnSessionExpired  protected    (declared in SessionManager)

 

method TriggerOnSessionExpired(e: SessionEventArgs)

 

void TriggerOnSessionExpired(SessionEventArgs e)

 

Sub TriggerOnSessionExpired(e As SessionEventArgs)

Parameters:

  • e:

 

OnSessionCreated    (declared in SessionManager)

Gets triggered after a new Session has been created. You can use it to perform initialization functions or fill the session with default values.

 

event OnSessionCreated: SessionEventHandler;
delegate: method OnSessionCreated(sender: Object; e: SessionEventArgs)

 

delegate SessionEventHandler OnSessionCreated()
delegate: void OnSessionCreated(Object sender, SessionEventArgs e)

 

Event OnSessionCreated As SessionEventHandler
delegate: Sub OnSessionCreated(sender As Object, e As SessionEventArgs)

OnSessionDestroyed    (declared in SessionManager)

Gets triggered after a new Session has been manually destroyed. You can use it to perform cleanup for a specific session id.

Note: The session has already been Disposed when the OnSessionDestroyed event fires. This event will not fire for sessions that expire.

 

event OnSessionDestroyed: SessionIDEventHandler;
delegate: method OnSessionDestroyed(sender: Object; e: SessionIDEventArgs)

 

delegate SessionIDEventHandler OnSessionDestroyed()
delegate: void OnSessionDestroyed(Object sender, SessionIDEventArgs e)

 

Event OnSessionDestroyed As SessionIDEventHandler
delegate: Sub OnSessionDestroyed(sender As Object, e As SessionIDEventArgs)

OnSessionExpired    (declared in SessionManager)

Gets triggered after a new Session has been expired. You can use it to perform cleanup and/or inspect the values of the expired session.

Note: The session has already been Disposed when the OnSessionExpired event fires. This event will not fire for sessions that are manually destroyed.

 

event OnSessionExpired: SessionEventHandler;
delegate: method OnSessionExpired(sender: Object; e: SessionEventArgs)

 

delegate SessionEventHandler OnSessionExpired()
delegate: void OnSessionExpired(Object sender, SessionEventArgs e)

 

Event OnSessionExpired As SessionEventHandler
delegate: Sub OnSessionExpired(sender As Object, e As SessionEventArgs)

See Also

  • Interface IOlympiaSessionManagerEvents

  • Olympia

  • Session Management