PerClientClassFactory
Overview
The PerClientClassFactory class implements the per-client class factory used for creating instances of services in a Remoting SDK server.
For every client communicating with the server, the class factory will create a new instance of the service implementation and associate it with the corresponding ClientId. The PerClientClassFactory will periodically dispose of expired service instances.
Note that all service implementation fields have to be reinitialized during service activation because otherwise their state would be undefined (i.e. these fields might contain leftover values from the previous request).
This class factory is recommended for service instances that are expensive to create and destroy. It is recommended to use this class factory when the number of clients frequently communicating with the server is limited.
To use a different instantiation mechanism, look into using one of the other class factory implementations, or create a custom class factory descending from the ClassFactory class to implement any custom logic needed.
Location
- Reference: RemObjects.SDK.Server.dll
- Namespace: RemObjects.SDK.Server.ClassFactories
- Ancestry: ClassFactory | ExpiringClassFactory | PerClientClassFactory
constructor (Type, IServiceActivator, Boolean, array of String) protected (declared in ExpiringClassFactory)
constructor(serviceClass: Type; activator: IServiceActivator; enforceSessionCheck: Boolean; roles: array of String)
PerClientClassFactory(Type serviceClass, IServiceActivator activator, Boolean enforceSessionCheck, String[] roles)
Sub New(serviceClass As Type, activator As IServiceActivator, enforceSessionCheck As Boolean, roles As String())
Parameters:
- serviceClass:
- activator:
- enforceSessionCheck:
- roles:
constructor (Type, IServiceActivator, Boolean, array of String, Int32, Boolean)
constructor(serviceClass: Type; activator: IServiceActivator; enforceSessionCheck: Boolean; roles: array of String; timeout: Int32; allowConcurrentAccess: Boolean)
PerClientClassFactory(Type serviceClass, IServiceActivator activator, Boolean enforceSessionCheck, String[] roles, Int32 timeout, Boolean allowConcurrentAccess)
Sub New(serviceClass As Type, activator As IServiceActivator, enforceSessionCheck As Boolean, roles As String(), timeout As Int32, allowConcurrentAccess As Boolean)
Parameters:
- serviceClass:
- activator:
- enforceSessionCheck:
- roles:
- timeout:
- allowConcurrentAccess:
AcquireInstance
method AcquireInstance(clientId: Guid; activate: Boolean): IROService
IROService AcquireInstance(Guid clientId, Boolean activate)
Function AcquireInstance(clientId As Guid, activate As Boolean) As IROService
Parameters:
- clientId:
- activate:
ActivateInstance protected (declared in ClassFactory)
method ActivateInstance(clientId: Guid; instance: IROService)
void ActivateInstance(Guid clientId, IROService instance)
Sub ActivateInstance(clientId As Guid, instance As IROService)
Parameters:
- clientId:
- instance:
CreateInstance (declared in ClassFactory)
method CreateInstance: IROService
IROService CreateInstance()
Function CreateInstance() As IROService
DeactivateInstance protected (declared in ClassFactory)
method DeactivateInstance(clientId: Guid; instance: IROService)
void DeactivateInstance(Guid clientId, IROService instance)
Sub DeactivateInstance(clientId As Guid, instance As IROService)
Parameters:
- clientId:
- instance:
Dispose (declared in ExpiringClassFactory)
Stops and disposes the internal timer.
method Dispose
void Dispose()
Sub Dispose()
DisposeManagedResources protected (declared in ExpiringClassFactory)
method DisposeManagedResources
void DisposeManagedResources()
Sub DisposeManagedResources()
DisposeNativeResources protected (declared in ExpiringClassFactory)
method DisposeNativeResources
void DisposeNativeResources()
Sub DisposeNativeResources()
ExpireAllInstances
Expires all service implementation instances for the client with the given ClientId.
This method affects all services served by the server application that use the per-client class factory.
It is recommended to call this method on client logout to explicitly free all resources currently used by cached service implementation instances.
class method ExpireAllInstances(clientId: Guid)
static void ExpireAllInstances(Guid clientId)
Shared Sub ExpireAllInstances(clientId As Guid)
Parameters:
- clientId: ClientId that should expire
ExpireInstances protected
method ExpireInstances
void ExpireInstances()
Sub ExpireInstances()
ExpireInstances (Guid)
method ExpireInstances(clientId: Guid)
void ExpireInstances(Guid clientId)
Sub ExpireInstances(clientId As Guid)
Parameters:
- clientId:
Finalize protected (declared in ExpiringClassFactory)
method Finalize
void Finalize()
Sub Finalize()
ReleaseInstance (Guid, IROService) (declared in ClassFactory)
Releases a previously acquired service instance, based on the logic of the class factory implementation.
method ReleaseInstance(clientId: Guid; instance: IROService)
void ReleaseInstance(Guid clientId, IROService instance)
Sub ReleaseInstance(clientId As Guid, instance As IROService)
Parameters:
- clientId:
- instance:
ReleaseInstance (Guid, IROService)
Deactivates the service implementation instance by calling its Deactivate method and then removes it from the internal service instances list.
method ReleaseInstance(clientId: Guid; serviceInstance: IROService)
void ReleaseInstance(Guid clientId, IROService serviceInstance)
Sub ReleaseInstance(clientId As Guid, serviceInstance As IROService)
Parameters:
- clientId: Client ID
- serviceInstance: Service Instance to be deactivated and removed from the list
ExpireAllInstances
Expires all service implementation instances for the client with the given ClientId.
This method affects all services served by the server application that use the per-client class factory.
It is recommended to call this method on client logout to explicitly free all resources currently used by cached service implementation instances.
class method ExpireAllInstances(clientId: Guid)
static void ExpireAllInstances(Guid clientId)
Shared Sub ExpireAllInstances(clientId As Guid)
Parameters:
- clientId: ClientId that should expire
constructor (Type, IServiceActivator, Boolean, array of String) protected (declared in ExpiringClassFactory)
constructor(serviceClass: Type; activator: IServiceActivator; enforceSessionCheck: Boolean; roles: array of String)
PerClientClassFactory(Type serviceClass, IServiceActivator activator, Boolean enforceSessionCheck, String[] roles)
Sub New(serviceClass As Type, activator As IServiceActivator, enforceSessionCheck As Boolean, roles As String())
Parameters:
- serviceClass:
- activator:
- enforceSessionCheck:
- roles:
constructor (Type, IServiceActivator, Boolean, array of String, Int32, Boolean)
constructor(serviceClass: Type; activator: IServiceActivator; enforceSessionCheck: Boolean; roles: array of String; timeout: Int32; allowConcurrentAccess: Boolean)
PerClientClassFactory(Type serviceClass, IServiceActivator activator, Boolean enforceSessionCheck, String[] roles, Int32 timeout, Boolean allowConcurrentAccess)
Sub New(serviceClass As Type, activator As IServiceActivator, enforceSessionCheck As Boolean, roles As String(), timeout As Int32, allowConcurrentAccess As Boolean)
Parameters:
- serviceClass:
- activator:
- enforceSessionCheck:
- roles:
- timeout:
- allowConcurrentAccess:
AcquireInstance
method AcquireInstance(clientId: Guid; activate: Boolean): IROService
IROService AcquireInstance(Guid clientId, Boolean activate)
Function AcquireInstance(clientId As Guid, activate As Boolean) As IROService
Parameters:
- clientId:
- activate:
ActivateInstance protected (declared in ClassFactory)
method ActivateInstance(clientId: Guid; instance: IROService)
void ActivateInstance(Guid clientId, IROService instance)
Sub ActivateInstance(clientId As Guid, instance As IROService)
Parameters:
- clientId:
- instance:
CreateInstance (declared in ClassFactory)
method CreateInstance: IROService
IROService CreateInstance()
Function CreateInstance() As IROService
DeactivateInstance protected (declared in ClassFactory)
method DeactivateInstance(clientId: Guid; instance: IROService)
void DeactivateInstance(Guid clientId, IROService instance)
Sub DeactivateInstance(clientId As Guid, instance As IROService)
Parameters:
- clientId:
- instance:
Dispose (declared in ExpiringClassFactory)
Stops and disposes the internal timer.
method Dispose
void Dispose()
Sub Dispose()
DisposeManagedResources protected (declared in ExpiringClassFactory)
method DisposeManagedResources
void DisposeManagedResources()
Sub DisposeManagedResources()
DisposeNativeResources protected (declared in ExpiringClassFactory)
method DisposeNativeResources
void DisposeNativeResources()
Sub DisposeNativeResources()
ExpireInstances protected
method ExpireInstances
void ExpireInstances()
Sub ExpireInstances()
ExpireInstances (Guid)
method ExpireInstances(clientId: Guid)
void ExpireInstances(Guid clientId)
Sub ExpireInstances(clientId As Guid)
Parameters:
- clientId:
Finalize protected (declared in ExpiringClassFactory)
method Finalize
void Finalize()
Sub Finalize()
ReleaseInstance (Guid, IROService) (declared in ClassFactory)
Releases a previously acquired service instance, based on the logic of the class factory implementation.
method ReleaseInstance(clientId: Guid; instance: IROService)
void ReleaseInstance(Guid clientId, IROService instance)
Sub ReleaseInstance(clientId As Guid, instance As IROService)
Parameters:
- clientId:
- instance:
ReleaseInstance (Guid, IROService)
Deactivates the service implementation instance by calling its Deactivate method and then removes it from the internal service instances list.
method ReleaseInstance(clientId: Guid; serviceInstance: IROService)
void ReleaseInstance(Guid clientId, IROService serviceInstance)
Sub ReleaseInstance(clientId As Guid, serviceInstance As IROService)
Parameters:
- clientId: Client ID
- serviceInstance: Service Instance to be deactivated and removed from the list