|
Windows Clients
Pooling SamplesUsing COM+ PoolingThe following code sample shows how to create and use a Workspace object using a COM+ pooling configuration:' Create the pooled object Dim obPooledObject As New SASObjectManager.PooledObject Dim obSAS As SAS.Workspace Set obSAS = obPooledObject.SASObject ' Test the object Debug.Print obSAS.Utilities.HostSystem.DNSName ' Return the object to the pool set obSAS=Nothing obPooledObject.ReturnToPool Using SAS Integration Technologies PoolingThe following code sample shows how to create and use a Workspace object using a SAS Integration Technologies pooling configuration:
Set obServer = CreateObject("SASObjectManager.ServerDef")
Set obLogin = CreateObject("SASObjectManager.LoginDef")
Set obObjectFactory = CreateObject("SASObjectManager.ObjectFactory")
' Define a ServerDef and LoginDef for the pool
obServer.MachineDNSName = "localhost"
' For VBScript, set obServer.Protocol to 2 instead of ProtocolBridge
obServer.Protocol = ProtocolBridge
obServer.Port = 8591
obServer.ShutdownAfter = 1
obServer.RunForever = False
obServer.RecycleActivationLimit = 10000
obLogin.LoginName = "mydomain\myuserid"
obLogin.Password = "myPassword"
' Create the pool
Set obPool = obObjectFactory.ObjectPools.CreatePoolByServer(
"myPool", obServer, obLogin)
' Create a pooled object
Set obPooledWorkspace = obPool.GetPooledObject("", "", 10000)
Set obSAS = obPooledWorkspace.SASObject
' Test the object
Debug.Print obSAS.Utilities.HostSystem.DNSName
' Return the object to the pool
Set obSAS = Nothing
obPooledWorkspace.ReturnToPool
Set obPooledWorkspace = Nothing
|